Ubuntu apt Hash Sum Mismatch
So today I was attempting to change some things up on one of our servers and running a normal SaltStack highstate was timing out and causing the minion process to basically just hang. After some investigation looking over the logs in /var/log/salt/minion it was obvious the issue was with apt-get updating it’s package listings.
But that’s strange, this box is on Digital Ocean and they have their own local mirrors. Turns out it’s a fairly common scenario with Ubuntu + mirrors + badly configured proxies. If you’re seeing things like this in your logs:
W: Failed to fetch http://mirrors.digitalocean.com/ubuntu/dists/utopic/universe/source/Sources: Hash Sum mismatch Failed to fetch http://mirrors.digitalocean.com/ubuntu/dists/utopic-updates/main/binary-amd64/Packages: Hash Sum mismatch : Failed to fetch http://mirrors.digitalocean.com/ubuntu/dists/utopic-updates/universe/binary-amd64/Packages: Hash Sum mismatch E: Some index files failed to download. They have been ignored, or old ones used instead. E: Couldn't rebuild package cache
There is a pretty easy fix. You just need to clear our your existing apt source caches and re-update like this:
rm /var/lib/apt/lists/* rm /var/lib/apt/lists/partial/* apt-get update
This totally solved the issue for me. Not only unlocking/unsticking apt, but also making subsequent apt calls a touch faster. Hope this helps someone else!
Posted 04 December 2014