If you’re running an older release of Debian and you’re seeing messages like this when you try and apt-get installs, then it’s probably because your release has been taken off the main mirrors and can no longer be updated that way.
W: Failed to fetch http://ftp.uk.debian.org/debian/dists/lenny/main/binary-amd64/Packages 404 Not Found [IP: 83.142.228.128 80] W: Failed to fetch http://ftp.uk.debian.org/debian/dists/lenny/main/source/Sources 404 Not Found [IP: 83.142.228.128 80] W: Failed to fetch http://security.debian.org/dists/lenny/updates/main/binary-amd64/Packages 404 Not Found [IP: 195.20.242.89 80] W: Failed to fetch http://security.debian.org/dists/lenny/updates/main/source/Sources 404 Not Found [IP: 195.20.242.89 80] E: Some index files failed to download, they have been ignored, or old ones used instead.
You essentially have two choices; either upgrade your distribution to the latest release, or switch to the archive mirrors.
In general when I’m in a hurry I like to just switch to the archive mirrors because it’s quick and I usually don’t want to get into distribution upgrades in the middle of the day.
With that in mind, it’s pretty simple.
First, edit your /etc/apt/sources.list file. Comment out (or delete) everything except your primary mirror reference. It’ll look something like this:
deb http://ftp.uk.debian.org/debian/ lenny main deb-src http://ftp.uk.debian.org/debian/ lenny main
To update this to the archive mirror, change these lines to:
deb http://archive.debian.org/debian/ lenny main deb-src http://archive.debian.org/debian/ lenny main
Save the file and return to the console.
Next, you need to purge the APT cache, this is a simple:
apt-get clean all
Finally, you probably need to update the GPG keyring. If not, you’ll probably see errors that look like this:
W: GPG error: http://archive.debian.org lenny Release: The following signatures were invalid: KEYEXPIRED 1337087218 The following signatures couldn't be verified because the public key is not available: NO_PUBKEY AED4B06F473041FA
To update the keyring, simply run this command:
apt-get install debian-archive-keyring
…and you’re all done. You should be able to use apt-get install normally as before.
4 Comments
Thanks a lot. The follow just works for me. For some reason, I’m still on lenny. Cheers. 7-Aug-2012
apt-get install debian-archive-keyring
That’ll work if you’re already using a mirror that keeps the archives.
Glad it was helpful.
Thanks a lot for the guide, that saved me some time today .
Greetings from Leeds
Glad it was helpful!