Debian APT repos not found? Switch to the archive!

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.

This entry was posted in Debian, Linux, Systems Administration. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

4 Comments

  1. H H Chau
    Posted August 7, 2012 at 10:14 am | Permalink

    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

    • Timothy Creswick
      Posted October 29, 2012 at 9:36 pm | Permalink

      That’ll work if you’re already using a mirror that keeps the archives.

      Glad it was helpful.

  2. Posted August 11, 2012 at 2:10 pm | Permalink

    Thanks a lot for the guide, that saved me some time today .

    Greetings from Leeds :)

    • Timothy Creswick
      Posted October 29, 2012 at 9:35 pm | Permalink

      Glad it was helpful!

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

What is 15 + 15 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple question (so we know that you are a human)