How to Fix ‘Failed to Fetch / Hash Sum Mismatch’ Error in Ubuntu apt-get

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.xz while serving the newer InRelease index 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.

  1. Open your terminal (Ctrl + Alt + T).
  2. Purge the local APT cache:
    sudo apt clean
  3. Remove all downloaded package lists from disk:
    sudo rm -rf /var/lib/apt/lists/*
    sudo rm -rf /var/lib/apt/lists/partial/*
  4. Recreate the clean directories:
    sudo mkdir -p /var/lib/apt/lists/partial
  5. 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.

  1. Run apt update with direct cache-busting flags:
    sudo apt -o Acquire::http::No-Cache=True -o Acquire::BrokenProxy=true update
  2. 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.

  1. Backup your current sources list:
    sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
  2. 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
  3. 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.

  1. Install the HTTPS transport package if missing:
    sudo apt install apt-transport-https ca-certificates -y
  2. Replace http://archive.ubuntu.com with https://archive.ubuntu.com in your /etc/apt/sources.list.
  3. 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.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.