Question

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

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

root@somehost:~# apt-get update -y
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
...
Ign:25 http://sfo1.mirrors.digitalocean.com/ubuntu xenial-updates/universe amd64 Packages
Get:25 http://sfo1.mirrors.digitalocean.com/ubuntu xenial-updates/universe amd64 Packages [759 kB]
Err:25 http://sfo1.mirrors.digitalocean.com/ubuntu 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 http://sfo1.mirrors.digitalocean.com/ubuntu/dists/xenial-updates/universe/binary-amd64/Packages.gz  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 \
-X POST \
-H 'Content-Type: application/json' \
 -H "Authorization: Bearer $(lpass show --notes do_token)" \
 -d "{\"name\":\"somehost.com\",\"region\":\"sfo2\",\"size\":\"512mb\",\"image\":\"ubuntu-16-04-x64\",\"ssh_keys\":[\"$(ssh-keygen -E md5 -lf id_rsa.pub | awk '{ gsub(/MD5:/, "", $2); print $2 }')\"]}" \
 https://api.digitalocean.com/v2/droplets

# Recover IP Address of host

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

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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.