Home FAQ Fix ‘E: The package cache file is corrupted, it has the wrong hash’ Error In Ubuntu
Fix 'E: The package cache file is corrupted, it has the wrong hash' Error In Ubuntu 18.04 LTS

Fix ‘E: The package cache file is corrupted, it has the wrong hash’ Error In Ubuntu

By sk
1129 Views

Today, I tried to update the repository lists in my Ubuntu 18.04 LTS desktop and got an error that says - E: The package cache file is corrupted, it has the wrong hash. Here is what I run from the Terminal and its output:

$ sudo apt update

Sample output:

Hit:1 http://it-mirrors.evowise.com/ubuntu bionic InRelease
Hit:2 http://it-mirrors.evowise.com/ubuntu bionic-updates InRelease 
Hit:3 http://it-mirrors.evowise.com/ubuntu bionic-backports InRelease 
Hit:4 http://it-mirrors.evowise.com/ubuntu bionic-security InRelease 
Hit:5 http://ppa.launchpad.net/alessandro-strada/ppa/ubuntu bionic InRelease 
Hit:7 http://ppa.launchpad.net/leaeasy/dde/ubuntu bionic InRelease 
Hit:8 http://ppa.launchpad.net/rvm/smplayer/ubuntu bionic InRelease 
Ign:6 https://dl.bintray.com/etcher/debian stable InRelease 
Get:9 https://dl.bintray.com/etcher/debian stable Release [3,674 B]
Fetched 3,674 B in 3s (1,196 B/s) 
Reading package lists... Done
E: The package cache file is corrupted, it has the wrong hash
The package cache file is corrupted, it has the wrong hash

"The package cache file is corrupted, it has the wrong hash" Error In Ubuntu

After couple Google searches, I found a workaround to fix this error.

If you ever encountered with this error, don't panic. Just run the following commands to fix it.

Before running the following command, double check you have added "*" at the end. It is very important to add * at the end of this command. If you don't add it, it will delete /var/lib/apt/lists/ directory and there is no way to bring it back. You have been warned!

$ sudo rm -rf /var/lib/apt/lists/*

Now I tried again to update the system using command:

$ sudo apt update

apt update command output in Ubuntu 18.04

This time it works!! Hope this helps.


Suggested read:


Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

3 comments

Dave April 9, 2020 - 1:48 am

Hello, I tried your fix for “E: The package cache file is corrupted, it has the wrong hash”, it didn’t fix it. Now there are many errors when I run apt-get update – issues with the /var/lib/apt/lists directory. Any thoughts?

Reply
sk April 9, 2020 - 11:06 am

Share the error message. I can see what I can do.

Reply
Steve August 13, 2020 - 7:12 am

Fixed it for me. Thanks!

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More