apt – How can I fix a 404 Error when updating packages? Debian

Summary: In this post i resolved the issue to fix a 404 Error when updating packages on Debian server. The reason of the error is some missing packages due to outdated. When we using old version of the OS and we didn’t update it constantly, then we are facing the issue of missing packages.

Today I stumbled into a weird problem. My debian server 5 couldn’t update anymore. My /etc/apt/sources.list looked like this:

  deb-src http://archive.ubuntu.com/ubuntu/  main restricted universe multiverse

Running apt-get update gave all sorts of problems as it couldn’t find repository servers anymore:

  $ sudo apt-get update
Ign http://us.archive.ubuntu.com  Release.gpg
Ign http://us.archive.ubuntu.com  Release
Ign http://us.archive.ubuntu.com /main Packages
Ign http://us.archive.ubuntu.com /universe Packages
Ign http://us.archive.ubuntu.com /main Packages
Ign http://us.archive.ubuntu.com /universe Packages
Err http://us.archive.ubuntu.com /main Packages
404 Not Found [IP: 91.189.92.180 80]
Err http://us.archive.ubuntu.com jaunty/universe Packages
404 Not Found [IP: 91.189.92.180 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/main/
404 Not Found [IP: 91.189.92.180 80]

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty/universe/Packages
404 Not Found [IP: 91.189.92.180 80]

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

To upgrade a really old Debian release, we first need to edit our sources.list and change all (xx.)archive.ubuntu.com to old-releases.ubuntu.com.

   $ sudo emacs /etc/apt/sources.list

So your lines should instead of

   deb http://archive.ubuntu.com/ubuntu jaunty main restricted universe

look like

   deb http://old-releases.ubuntu.com/ubuntu main restricted universe

it works the same on other releases.
Now update the repos

   $ sudo apt-get update
Thanks to Matjaž Kljun for guiding to the solution.

Leave a Reply

Your email address will not be published. Required fields are marked *