#730237 apt-get update reports spurious failures (Unable to connect to ...)

Package:
apt
Source:
apt
Description:
commandline package manager
Submitter:
"Edward Z. Yang"
Date:
2013-11-23 02:36:06 UTC
Severity:
normal
#730237#5
Date:
2013-11-23 02:26:49 UTC
From:
To:
When one entry in sources.list is incorrect, apt-get update may
incorrectly report that other sources (which are fine) are also broken.
This is because apt-get first looks for InRelease before actually
downloading Release.gpg; so a single failing source will skip the rest
of the downloads, and then later when apt-get sweeps the cache looking
for missing Release.gpg, it concludes the other sources are not working
either. Here is an example transcript:

# with the broken http://localhost:80 repo in sources.list

(saucy-amd64)root@sabre:/etc# cat apt/sources.list
deb http://localhost:9999/ubuntu/ saucy main restricted universe multiverse
deb-src http://localhost:9999/ubuntu/ saucy main restricted universe multiverse
deb http://localhost:9999/ubuntu/ saucy-updates main restricted universe multiverse
deb-src http://localhost:9999/ubuntu/ saucy-updates main restricted universe multiverse
deb http://localhost:9999/ubuntu/ saucy-proposed main restricted universe multiverse
deb-src http://localhost:9999/ubuntu/ saucy-proposed main restricted universe multiverse
deb http://localhost:9999/secure/ saucy-security main restricted universe multiverse
deb-src http://localhost:9999/secure saucy-security main restricted universe multiverse
deb http://localhost/repo ./

(saucy-amd64)root@sabre:/etc# apt-get update
Ign http://localhost:9999 saucy InRelease
Ign http://localhost:9999 saucy-updates InRelease
Ign http://localhost:9999 saucy-proposed InRelease
Ign http://localhost:9999 saucy-security InRelease
Err http://localhost ./ InRelease

Err http://localhost:9999 saucy Release.gpg
  Unable to connect to localhost:9999:
Err http://localhost:9999 saucy-updates Release.gpg
  Unable to connect to localhost:9999:
Err http://localhost:9999 saucy-proposed Release.gpg
  Unable to connect to localhost:9999:
Err http://localhost:9999 saucy-security Release.gpg
  Unable to connect to localhost:9999:
Err http://localhost ./ Release.gpg
  Unable to connect to localhost:80:
Reading package lists... Done
W: Failed to fetch http://localhost/repo/./InRelease

W: Failed to fetch http://localhost:9999/ubuntu/dists/saucy/Release.gpg Unable to connect to localhost:9999:

W: Failed to fetch http://localhost:9999/ubuntu/dists/saucy-updates/Release.gpg Unable to connect to localhost:9999:

W: Failed to fetch http://localhost:9999/ubuntu/dists/saucy-proposed/Release.gpg Unable to connect to localhost:9999:

W: Failed to fetch http://localhost:9999/secure/dists/saucy-security/Release.gpg Unable to connect to localhost:9999:

W: Failed to fetch http://localhost/repo/./Release.gpg Unable to connect to localhost:80:

W: Some index files failed to download. They have been ignored, or old ones used instead.

# Now with the broken entry removed

(saucy-amd64)root@sabre:/etc# cat apt/sources.list
deb http://localhost:9999/ubuntu/ saucy main restricted universe multiverse
deb-src http://localhost:9999/ubuntu/ saucy main restricted universe multiverse
deb http://localhost:9999/ubuntu/ saucy-updates main restricted universe multiverse
deb-src http://localhost:9999/ubuntu/ saucy-updates main restricted universe multiverse
deb http://localhost:9999/ubuntu/ saucy-proposed main restricted universe multiverse
deb-src http://localhost:9999/ubuntu/ saucy-proposed main restricted universe multiverse
deb http://localhost:9999/secure/ saucy-security main restricted universe multiverse
deb-src http://localhost:9999/secure saucy-security main restricted universe multiverse

(saucy-amd64)root@sabre:/etc# apt-get update
Ign http://localhost:9999 saucy InRelease
Ign http://localhost:9999 saucy-updates InRelease
Ign http://localhost:9999 saucy-proposed InRelease
Ign http://localhost:9999 saucy-security InRelease
Get:1 http://localhost:9999 saucy Release.gpg [933 B]
Get:2 http://localhost:9999 saucy-updates Release.gpg [933 B]
Get:3 http://localhost:9999 saucy-proposed Release.gpg [933 B]
Get:4 http://localhost:9999 saucy-security Release.gpg [933 B]
Get:5 http://localhost:9999 saucy Release [49.6 kB]
Get:6 http://localhost:9999 saucy-updates Release [49.6 kB]
Get:7 http://localhost:9999 saucy-proposed Release [49.6 kB]
Get:8 http://localhost:9999 saucy-security Release [49.6 kB]
Get:9 http://localhost:9999 saucy/main Translation-en [711 kB]
Get:10 http://localhost:9999 saucy/multiverse Translation-en [101 kB]
Get:11 http://localhost:9999 saucy/restricted Translation-en [2686 B]
Get:12 http://localhost:9999 saucy/universe Translation-en [3886 kB]
[etc]

P.S. the attached config is kind of misleading because this was done
from a chroot.