How to Fix Ubuntu/Debian apt-get 404 Not Found Repository Errors

When using the desktop version of Ubuntu you'll eventually get or probably have the problem that apt-get update throws a lot "Failed to fetch 404 Not Found" errors. Additionally, you may have the same problem when running apt-get install. Don't worry, it will be fixed in a minute.

The Problem

You may see messages like the ones below when executing apt-get update or apt-get install. That is because Ubuntu releases are only supported for 9 months. LTS (Long Term Support) releases have support for 5 years. Once support is cut for the version you're using, you'll see those error messages. Ubuntu moves the repositories to another server and the defined URL to reach the sources are no longer available on default location

$ sudo apt-get update
Ign raring Release.gpg  
Ign raring-updates Release.gpg  
Ign raring-backports Release.gpg  
Ign raring-security Release.gpg  
Ign raring Release  
Ign raring-updates Release  
Ign raring-backports Release  
404  Not Found [IP: 80]  
Err raring-security/restricted Sources  
404  Not Found [IP: 80]  
Err raring-security/universe Sources  
404  Not Found [IP: 80]  
Err raring-security/multiverse Sources  
404  Not Found [IP: 80]  
Ign raring-backports/main Translation-en  
Ign raring-backports/multiverse Translation-en  
Err raring-security/main amd64 Packages  

W: Failed to fetch  404  Not Found [IP: 80]

W: Failed to fetch  404  Not Found [IP: 80]

W: Failed to fetch  404  Not Found [IP: 80]

W: Failed to fetch  404  Not Found [IP: 80]


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

How to Fix The Problem

There are two solutions to get your apt commands working again. First: upgrade the Ubuntu release. Second: update the sources url to the old package repositories. Both solutions are described below in more detail.

Distribution Upgrade

The most simple solution is to upgrade your Ubuntu instance to the newest release:

sudo apt-get dist-upgrade  

If the distribution upgrade is not an option right now, you can update the sources url for the Ubuntu repositories to find the old packages.

Update Packages Url

You can use the sed command to update the sources in /etc/apt/sources.list file to the new location for old package repositories2.

Run the following command to update and package repository4 URLs with Since the normal Ubuntu releases link to the archive.… and security.… URLs, the support will be removed after their live cycle of 9 months and respective repositories3 moved to old-releases.….

sudo sed -i -e 's/\|' /etc/apt/sources.list

**Linux Mint additionally requires the execution of this command:**

sudo sed -i -e 's/\|' /etc/apt/sources.list.d/official-package-repositories.list  

To check whether there are other files in /etc/apt/sources.list.d/ which need to be updated, use the following grep command.

grep -E '|' /etc/apt/sources.list.d/*  

That's it. Now you can update your sources again.

sudo apt-get update  


Explore the Library

Find interesting tutorials and solutions for your problems.