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

February 22, 2018 989 views
DigitalOcean Ubuntu 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
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.

Have another answer? Share your knowledge.