I have an automated script which, among other tasks, updates the sources with apt-get update and then installs additional packages through apt-get install.

Occasionally (10—20% of the time), apt-get update fails with the following errors:

init[356]: W: Failed to fetch http://http.us.debian.org/debian/dists/jessie/main/source/Sources 404 Not Found
init[356]: E: Some index files failed to download. They have been ignored, or old ones used instead.

Indeed, the browser shows that the referenced file doesn't exist: the corresponding directory contains only the following files:

  • Release
  • Sources.gz
  • Sources.xz

The stdout from such failed apt-get update is this one:

Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
Ign http://http.us.debian.org jessie InRelease
Get:2 http://security.debian.org jessie/updates/main Sources [160 kB]
Get:3 http://http.us.debian.org jessie-updates InRelease [142 kB]
Get:4 http://security.debian.org jessie/updates/main amd64 Packages [302 kB]
Get:5 http://security.debian.org jessie/updates/main Translation-en [161 kB]
Hit http://http.us.debian.org jessie Release.gpg
Get:6 http://http.us.debian.org jessie-updates/main Sources [15.5 kB]
Get:7 http://http.us.debian.org jessie-updates/main amd64 Packages/DiffIndex [5,440 B]
Get:8 http://http.us.debian.org jessie-updates/main Translation-en/DiffIndex [2,704 B]
Hit http://http.us.debian.org jessie Release
Get:9 http://http.us.debian.org jessie/main amd64 Packages [6,761 kB]
Get:10 http://http.us.debian.org jessie/main Translation-en [4,580 kB]
Err http://http.us.debian.org jessie/main Sources
  404  Not Found
Fetched 12.2 MB in 28s (433 kB/s)

The two last HTTP requests being:


By comparison, here's apt-get update ran manually from the same machine after the original one failed:

Ign http://http.us.debian.org jessie InRelease
Get:1 http://http.us.debian.org jessie-updates InRelease [142 kB]
Get:2 http://http.us.debian.org jessie Release.gpg [2,373 B]              
Hit http://security.debian.org jessie/updates InRelease
Hit http://security.debian.org jessie/updates/main Sources
Hit http://security.debian.org jessie/updates/main amd64 Packages
Get:3 http://http.us.debian.org jessie-updates/main amd64 Packages/DiffIndex [5,440 B]
Hit http://security.debian.org jessie/updates/main Translation-en
Get:4 http://http.us.debian.org jessie-updates/main Translation-en/DiffIndex [2,704 B]
Get:5 http://http.us.debian.org jessie Release [148 kB]
Get:6 http://http.us.debian.org jessie-updates/main Sources [15.5 kB]
Get:7 http://http.us.debian.org jessie/main Sources [7,057 kB]
Get:8 http://http.us.debian.org jessie/main amd64 Packages [6,761 kB]
Get:9 http://http.us.debian.org jessie/main Translation-en [4,580 kB]
Fetched 18.7 MB in 12s (1,557 kB/s)                                            
Reading package lists... Done

and the three URIs corresponding to the Get:7 to Get:9:


Why is apt-get update occasionally figuring out that it should download Sources.xz, while other times trying to get the missing Sources?


Download xz (or gz) compressed listfiles from everywhere

echo 'Acquire::CompressionTypes::Order:: { "xz"; "gz"; };' > /etc/apt/apt.conf.d/47compress

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.