Apt-Get Update Keeps Getting the Same Package – How to Fix

aptPROXY

I started an apt-get update on my desktop machine today and was still running after 30 minutes.

It keeps downloading from the same repository. There is a Get counter on each line and that keeps incrementing. I eventually aborted it.

The output I get is:

Get:53 http://nz.archive.ubuntu.com trusty-updates Release [63.5 kB]           
Hit http://security.ubuntu.com trusty-security/multiverse Translation-en       
Get:54 http://nz.archive.ubuntu.com trusty-updates Release [63.5 kB]           
Hit http://security.ubuntu.com trusty-security/restricted Translation-en       
Get:55 http://nz.archive.ubuntu.com trusty-updates Release [63.5 kB]           
Get:56 http://nz.archive.ubuntu.com trusty-updates Release [63.5 kB]           
Get:57 http://security.ubuntu.com trusty-security/universe Translation-en [67.8 kB]
Get:58 http://nz.archive.ubuntu.com trusty-updates Release [63.5 kB]           
Get:59 http://nz.archive.ubuntu.com trusty-updates Release [63.5 kB]           
...
Get:8286 http://nz.archive.ubuntu.com trusty-updates Release [63.5 kB]          
Get:8287 http://nz.archive.ubuntu.com trusty-updates Release [63.5 kB]          
Get:8288 http://nz.archive.ubuntu.com trusty-updates Release [63.5 kB]          
Get:8289 http://nz.archive.ubuntu.com trusty-updates Release [63.5 kB]          
Get:8290 http://nz.archive.ubuntu.com trusty-updates Release [63.5 kB]          

I'm running this at work and we have a proxy server. I also tried it on one of the servers at work that I look after. Same result – it is stuck on the same line.

Both my desktop and servers run Ubuntu 14.04.

It might be related to this question, but I get the problem with apt-get update whereas that issue has a problem with apt-get upgrade

I haven't been able yet to try this at home.

Best Answer

I narrowed it down to two files:

http://nz.archive.ubuntu.com/ubuntu/dists/trusty-updates/Release
http://nz.archive.ubuntu.com/ubuntu/dists/trusty-updates/Release.gpg

When I started an apt-get-update, a number of files would appear in /var/lib/apt/lists/partial, including these two.

The list would quickly become shorter and eventually only these two files would be left.

I had a look at http://nz.archive.ubuntu.com/ubuntu/dists/trusty-updates and noticed that Release.gpg in partial had the same size, but file Release was too short. I also noticed that these files were updated last night on the server.

The funny thing was that I could view and download file Release.gpg in my browser, but I could only view file Release in my browser: when I tried to download it ("Save File As.."), Firefox responded that it couldn't read file /tmp/Xu4f... and file Release on disk would be empty.

Suddenly, everything started working again: apt-get update ran to completion within a few seconds and I could download file Release without a problem.

The only explanation I can think of is that there was a caching issue somewhere, because these files were updated last night.