How do you fix apt-get update "Hash Sum mismatch"

First, you should understand why hash sum mismatch errors occur. In general, there are 2 reasons:

Firstly, Some apt repositories use LZMA (.xz) compressed metadata. apt before version 1.0 fails to decompressed LZMA archives correctly (sometimes) giving the hash sum mismatch error.

There's two work arounds for this:

  1. Tell your apt client not to use XZ compressed metadata
  2. Upgrade apt on your system to a version newer than 1.0

Check out this blog post I wrote about this issue which explains both work arounds in greater detail.

Secondly, APT repositories are inherently racy. The actual APT metadata is buggy and the design of it makes it impossible for apt clients to download the repository metadata in a consistent way if the apt-get update happens while the repository is being updated.

There's two work arounds for this:

  1. Upgrade to a newer version of APT and ensure that the repository you create (or want to use) supports the Acquire-by-hash feature. This fixes the issue at its core, but not be possible in some cases if you don't control the repository.
  2. You can delete the cached metadata on your system and try again. To do this, first run apt-get clean followed by rm -rf /var/lib/apt/lists/*. Next, run apt-get update. This will re-download all the metadata. If the repository you are trying to connect to doesn't update itself while you are running apt-get update, you will be fine. Otherwise, you'll have to do this again.

Figured it out.

My two computers are identical in every way except on my personal computer I installed an internet filter.

The k9 internet filter installed a kernel extension that apparently messes with the traffic.

As soon as I uninstalled the filter, the problem went away.

I'm still researching if there is any way to make apt-get update ignore Hash sum mismatches as a workaround.

Tags:

Ubuntu

Apt