How do I fix a "Hash Sum mismatch" error when running apt-get update on Ubuntu 16.04?

Posted February 22, 2018 10.8k views
DigitalOceanUbuntu 16.04

Running apt-get update -y fails with the following error message:

root@somehost:~# apt-get update -y
Get:1 xenial-security InRelease [102 kB]
Ign:25 xenial-updates/universe amd64 Packages
Get:25 xenial-updates/universe amd64 Packages [759 kB]
Err:25 xenial-updates/universe amd64 Packages
  Hash Sum mismatch
Fetched 25.1 MB in 6s (3,638 kB/s)
Reading package lists... Done
E: Failed to fetch  Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead.

What does this error mean?
Where can I learn more?
How do I solve this problem?

Steps to reproduce

curl \
-s \
-H 'Content-Type: application/json' \
 -H "Authorization: Bearer $(lpass show --notes do_token)" \
 -d "{\"name\":\"\",\"region\":\"sfo2\",\"size\":\"512mb\",\"image\":\"ubuntu-16-04-x64\",\"ssh_keys\":[\"$(ssh-keygen -E md5 -lf | awk '{ gsub(/MD5:/, "", $2); print $2 }')\"]}" \

# Recover IP Address of host

ssh -i id_rsa root@$IP apt-get update -y

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Did you by chance happen to try to do this again? I’m thinking there was an issue with the mirrors themselves. I had this very exact same problem on multiple droplets just running “sudo apt update” – but the issue seems to have been resolved for me.