Ubuntu Linux system maintains a local database (so-called apt package index) of packages that are available from the repositories defined in /etc/apt/sources.list, or in /etc/apt/sources.list.d/. The apt package index can often become outdated as the packages contained in the repositories change, or new repositories are added to the system.
In order to update the local apt package index, you run:
However, for various reasons you may encounter errors while updating the apt package index. Here are several ways to fix common apt-get update errors.
Hash Sum mismatch error
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/vivid-updates/main/i18n/Translation-en Hash Sum mismatch E: Some index files failed to download. They have been ignored, or old ones used instead.
This error can happen when fetching the latest repositories during "apt-get update" was interrupted, and a subsequent "apt-get update" is not able to resume the interrupted fetch. In this case, remove the content in /var/lib/apt/lists before retrying "apt-get update".
$ sudo apt-get update
If the above does not solve the problem, use the following commands instead.
$ sudo apt-get update
404 Not Found error
If you are getting "404 Not Found" error, and you are using a rather old Ubuntu release, there is a chance that the 404 error occurs because your Ubuntu installation is no longer supported.
To find out whether this is the case, first check which Ubuntu release you are using, by running:
Then check out the "End of Life" date of your Ubuntu release by referring to https://wiki.ubuntu.com/Releases
If your release has reached end of life (EOL), you need to modify /etc/apt/sources.list as follows, in order to avoid 404 errors during apt-get update. Replace CODENAME with the codename of Ubuntu release that you are using.
# Required deb http://old-releases.ubuntu.com/ubuntu/ CODENAME main restricted universe multiverse deb http://old-releases.ubuntu.com/ubuntu/ CODENAME-updates main restricted universe multiverse deb http://old-releases.ubuntu.com/ubuntu/ CODENAME-security main restricted universe multiverse # Optional #deb http://old-releases.ubuntu.com/ubuntu/ CODENAME-backports main restricted universe multiverse
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!