Kali Linux: apt update returns "Hash Sum mismatch" error
QUICK FIX:
- Shut down Kali VM.
- Run
bcdedit /set hypervisorlaunchtype off
in CMD. - Reboot.
EXPLANATION:
This issue is caused by the Windows Hypervisor Platform. This issue cannot be resolved for now (as far as I know).
A partial fix is at hand though. And I say "partial" because it involves disabling the platform (also known as "Hyper-V") which will probably break other virtualization solutions you have installed since this is enabled manually. Anyway, here's how to disable it and get your Kali VM running again;
Shut down the Kali Virtual Machine.
Press Windows logo key + X, then hit A to run Command Prompt as administrator.
- Type
bcdedit /set hypervisorlaunchtype off
- When you see "The operation completed succesfully", type
reboot
After reboot, boot Kali and update/upgrade.
Related videos on Youtube
bdben
Updated on September 18, 2022Comments
-
bdben almost 2 years
I'm experiencing exactly the same issue as described in this question: Kali Linux: apt-get update returns “Hash Sum mismatch” error. Before you mark this as a duplicate however, I have tried the solutions posted there, as well as on numerous other sites, including:
sudo apt-get clean sudo rm -rf /var/lib/apt/lists/* sudo apt-get update
Editing
/etc/apt/sources.list
with alternate official mirrors, such asdeb http://mirrors.ocf.berkeley.edu/kali kali-rolling main non-free contrib
ordeb https://http.kali.org/kali kali-rolling main non-free contrib
Everything worked after I first imported the VM. I ran
sudo apt update
and it found some ~650 packages to upgrade. I ransudo apt upgrade
and it encountered an error partway through. That error was solved usingsudo apt --fix-broken install
, but that is when this hash sum error began. Unfortunately due to hours of troubleshooting I no longer have the details of the earlier error, but I believe it was an error extracting a package due to corrupt data.I've tried multiple official mirrors, but I get the same error. Additionally, when I downloaded the Packages.gz file here on my Windows machine (VM host) and computed the SHA256 hash, I got the exact hash that
apt
printed as the expected value. This led me to believe that the error was not with the mirror but with my VM.The next thing I tried was
wget https://mirrors.ocf.berkeley.edu/kali/dists/kali-rolling/main/binary-amd64/Packages.gz
followed bysha256sum Packages.gz
, which provided yet another different hash output.To be clear, I have seen 3 different hashes for the same file:
- The "correct" hash shown by
apt
as expected, which is the one that windows also produced after downloading the file using a browser - The incorrect hash calculated by
apt
, which led to the error - A different hash calculated by
sha256sum
after downloading the file usingwget
using the same URL as for the browser download
I should also note that I have only been referencing the SHA256 hash in each step. The other hash functions are also mismatched when I run
sudo apt update
, but the file size is the same. I had considered that downloads might be failing due to limited disk space (it is a VM after all) but I don't think that's the case.What am I missing?
-
roaima over 4 yearsFlatten it and install from scratch. It's a pen-testing distribution so you shouldn't have anything of value on it anyway.
-
bdben over 4 yearsThat was my thought as well. Unfortunately I re-imported the .ova and got the same issue. So I tried installing into a fresh VM using an installer iso, and the install failed at the package selection step (not sure if it's the same cause).
-
bdben over 4 yearsMaybe it's a virtualbox issue I suppose, now that I'm typing this comment.
-
roaima over 4 yearsIt's possible it's a transient fault in one or more of the mirrors.
-
RyanQuey about 4 yearsI had the same issue. Check out this answer here, he solves it. Particularly for Windows 10 host using Virtualbox. For me when I asked that question, some packages worked fine but Docker was one that did not. The key is disabling Hyper-V and getting rid of that Green Turtle
- The "correct" hash shown by
-
Sime Kappa about 4 yearsThis is the solution! Thank you very much, nothing else did work, but this simple solution worked for me.
-
Rishabh Deep Singh almost 4 yearsbcedit is not recognized as an internal or external command
-
Nullman almost 4 years@RishabhDeepSingh you missed a letter its bcdedit
-
Paul over 3 yearsFor Mac VMWare, this worked for me: communities.vmware.com/t5/VMware-Fusion-Discussions/…