On recent versions of Ubuntu, you may get the following error when trying to run apt-get update or apt-get install:
Failed to fetch 404 Not Found
Usually, the reason for this error is changing locations of Ubuntu repositories. According to the versioning policies of Ubuntu, normal releases are supported for 9 months, whereas LTS (Long Term Support) releases are supported for 5 years. After the support period has expired, the repository is moved to another server and will no longer be available in the standard location.
Solution
The best solution to this issue is to upgrade the Ubuntu version, which will update sources for apt-get as well. To update, run the command:
sudo apt-get dist-upgrade
If you prefer not to update, or cannot update the system for another reason, then it is also possible to update the file /etc/apt/sources.list. To use this solution, you should already be familiar with choosing custom repositories.
Applies to: