I am setting up the dev environment for an open source project (Zulip) and ran into a hash sum mismatch issue when apt-get install
was run inside a container that was being setup with vagrant and docker (using vagrant up --provider=docker
). The hash sum mismatch occurs on seemingly random package, but tends to happen around 40s or 100s into the process consistently.
Relevant error logs:
#6 40.42 Err:32 http://ports.ubuntu.com/ubuntu-ports focal-updates/main arm64 libpam-runtime all 1.3.1-5ubuntu4.7
#6 40.42 Hash Sum mismatch
#6 40.42 Hashes of expected file:
#6 40.42 - SHA512:e2a7a30fc4184da181c6a5842f16eabcdef22b29815b308f39568f63e3d9386dd7d60dfdb03099c6d007e91e34744878f1f91bbf21580e9fdf8b2ac2cb6e31ee
#6 40.42 - SHA256:9e28174f564168fc1befe0ac07638a648ee472b4ecc72e3f8e7722c9802b8d29
#6 40.42 - SHA1:0aa22485903dd1a6bde45bae2186a778bfd92c0c [weak]
#6 40.42 - MD5Sum:f6e96384d3cf0495d9926539894813bc [weak]
#6 40.42 - Filesize:37288 [weak]
#6 40.42 Hashes of received file:
#6 40.42 - SHA512:72fcf491c1f0f3968c28dfdc52763698baa6019b8ae293946a2e255eccfb477b259a3c5e77a93da2eadeb7a0ccbcbbb55a2f5a5630365145936cec34b3421a67
#6 40.42 - SHA256:1e90b4fd7d1064f1cbd039f1539ab03ae3786174f4e9b98c4b9a6052211d0448
#6 40.42 - SHA1:9a839bcd004682b3eb6b84bc7dbe3a6d00100a64 [weak]
#6 40.42 - MD5Sum:12705aaf10b64d8ff4cf07b63351c2ba [weak]
#6 40.42 - Filesize:37288 [weak]
#6 40.42 Last modification reported: Wed, 17 Jan 2024 18:10:37 +0000
I am not aware of any proxies or vpns running on my Mac.
I've tried 3 different mirrors and 2 different networks (different ISPs) to no avail.
Information about my setup:
Posted this question to document a solution and make it searchable. Here's how I solved this problem:
The crux of this problem is something sitting in between your system and the server, and modifying the files that you are supposed to receive. Most likely a proxy or vpn that you do not know is running on your system.
Each step below can be treated independently, and you can test if you get the hash sum mismatch after each step.
Reinstall both docker and vagrant, then restart your mac.
This can be done at System Settings > Network > Other Services > Click on a service > Make Inactive
This is an important step if you're at a university like me. Change DNS under Network > Wi-Fi > Details > DNS to something like 8.8.8.8 (Google) or 1.1.1.1 (Cloudflare, may need more setup).
Screen time creates a process called webfilterproxyd. This likely interferes with incoming data and cannot be killed from activity monitor until you disable screen time in settings.
‼️ Try the steps below at your own risk and please double check what each step does.
I force quit all 3 processes that came up for me when I searched for VPN in activity monitor: Activity Monitor search for vpn
I was able to force quit 1/3 of the processes below after disabling screen time: Activity Monitor search for proxy
Test this by running
curl -I https://registry-1.docker.io/v2/library/ubuntu/manifests/20.04
You should see an error stating that you cannot connect to the server.
Retrying your vagrant up
or apt-get
commands after this should work.