apt
command is used to install, update, remove packages in Linux distributions like Ubuntu, Debian, Mint, Kali. apt
is mainly used with the deb
packages. With the apt update
or apt-get update
command the repository information is downloaded to from the deb
repositories to the local repositories. Hash is used to checking if the downloaded file is valid. If there is a problem we may face with the Hash Sum mismatch
error.
“Hash Sum mismatch” Error
First, we will look at how the Hash Sum mismatch
error occurs during the apt update
or apt-get update
command usage.
$ apt update && apt dist-upgrade -y

We can see that following errors and warnings are printed during the update repository information.
- Last modification reported: Wed, 26 Jun 2019 12:03:10 +0000
- Hashes of expected file:
- – Filesize:17059946 [weak]
- Last modification reported: Wed, 26 Jun 2019 12:03:10 +0000
- Release file created at: Wed, 26 Jun 2019 12:04:12 +0000
- E: Some index files failed to download. They have been ignored, or old ones used instead.
“Hash Sum mismatch” Solution
In order to solve the Hash Sum mismatch
error, we need to remove downloaded repository information from the /var/lib/apt/lists/
directory. We will use rm -rf
command for this. We will also provide the sudo
command.
$ sudo rm -rf /var/lib/apt/lists/*
Then the update command like below will work.
$ sudo apt update