Running sudo apt update or attempting to install software in Ubuntu only to be stopped by the error: ‘E: Failed to fetch http://archive.ubuntu.com/… Hash Sum mismatch’ and ‘E: Some index files failed to download. They have been ignored, or old ones used instead’ disrupts package management. In Debian and Ubuntu package management architecture, the Advanced Package Tool (APT) verifies the cryptographic integrity of downloaded repository metadata using SHA256 hashes defined in the repository’s InRelease or Release file. When an upstream mirror proxy serves cached, out-of-sync index files, or local package lists become corrupted during transmission, APT aborts to protect your system from compromised binaries.
Why Does APT Throw ‘Hash Sum Mismatch’?
A Hash Sum mismatch indicates the computed checksum of a downloaded file does not match the upstream manifest:
- Caching Proxy Desynchronisation: Upstream mirror proxies (or corporate caching proxies) delivering cached versions of
Packages.xzwhile serving the newerInReleaseindex file. - Interrupted Package List Downloads: Dropped network packets leaving partially written binary lists in
/var/lib/apt/lists/partial/. - Mismatched Repository Mirror: Geographically allocated mirror servers taking hours to sync latest security releases from the canonical archive.
- Stale Local Metadata Cache: Corrupted metadata files persisting inside
/var/lib/apt/lists/.
Step 1: Clean and Remove Corrupted Local APT Lists
Purging local package metadata forces APT to perform a completely clean, fresh download.
- Open your terminal (Ctrl + Alt + T).
- Purge the local APT cache:
sudo apt clean - Remove all downloaded package lists from disk:
sudo rm -rf /var/lib/apt/lists/* sudo rm -rf /var/lib/apt/lists/partial/* - Recreate the clean directories:
sudo mkdir -p /var/lib/apt/lists/partial - Re-run the update command:
sudo apt update
Step 2: Bypass Transparent Caching Proxies
Force APT to request fresh un-cached copies directly by sending no-cache HTTP headers.
- Run
apt updatewith direct cache-busting flags:sudo apt -o Acquire::http::No-Cache=True -o Acquire::BrokenProxy=true update - If successful, persist this setting by creating a configuration file:
echo 'Acquire::http::No-Cache "true";' | sudo tee /etc/apt/apt.conf.d/99no-cache echo 'Acquire::BrokenProxy "true";' | sudo tee -a /etc/apt/apt.conf.d/99no-cache
Step 3: Switch to the Main Ubuntu Archive Mirror
If a local country mirror (e.g. in.archive.ubuntu.com or uk.archive.ubuntu.com) is desynchronised, switch to the authoritative central mirror.
- Backup your current sources list:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak - Replace country-specific mirror URLs with the main canonical archive:
sudo sed -i -E 's|http://[a-z]{2}.archive.ubuntu.com|http://archive.ubuntu.com|g' /etc/apt/sources.list - Update package lists:
sudo apt update
Step 4: Switch from HTTP to HTTPS Mirrors
HTTPS prevents ISP-level transparent HTTP caches and transparent squid proxies from intercepting and corrupting archive files.
- Install the HTTPS transport package if missing:
sudo apt install apt-transport-https ca-certificates -y - Replace
http://archive.ubuntu.comwithhttps://archive.ubuntu.comin your/etc/apt/sources.list. - Re-run
sudo apt update.
Purging /var/lib/apt/lists/, bypassing caching proxies with no-cache headers, and switching to canonical HTTPS repository mirrors permanently resolves ‘Failed to fetch Hash Sum mismatch’ errors in Ubuntu.