Fix Virtualbox on Windows 10 2004

The Problem

Since upgrading my Windows 10 to version 2004, my Virtualbox hosted virtual machines acted up. My Windows 10 forensic analysis machine would crash on boot and while my Kali and Ubuntu based Linux machines seemingly ran properly, I encountered a “Hash sum mismatch” error when using apt update and git clone refused to clone with an “invalid distance too far back” error.

As it turns out, the error was caused by Hyper-V and Virtualbox.

Before the upgrade to Windows 10 2004 I used the Windows Subsystem for Linux (WSL) along with a Kali Linux distro. Additionally, I had the above-mentioned virtual machines running in Virtualbox. This setup worked perfectly well because WSL does not require any form of virtualization. Instead, it uses a compatibility layer which translates Linux calls into native Windows calls. However, with the update to Windows 10 version 2004 WSL got updated to WSL2 which introduces Hyper-V as a virtualization solution for it’s kernel. Having Virtualbox, or any other virtualization solution installed on the same machine as Hyper-V will result in problems.

The solution

Microsoft and Oracle both state that Virtualbox is compatible with WSL2. Virtualbox would fallback to Hyper-V using Microsoft provided APIs. This would come at the expense of performance and, as observed by myself and others, does not really work well.

The solution to this is simple: disable Hyper-V. This can be done either by uninstalling the feature or by turning it off temporarily. If you decide to turn off Hyper-V and, as a result not use WSL2 anymore, go to the “Turn Windows features on or off” section and deselect “Virtual Machine Platform”.

Disable Virtual Machine Platform

After a reboot, Virtualbox will not use the Hyper-V fallback anymore but run it’s virtual machines using it’s own virtualization and the above-mentioned issues will be solved.

If you like working with WSL2 and don’t use Virtualbox regularly, you can disable Hyper-V temporarily without removing it from the system.

Open a powershell or cmd terminal as Administrator and issue the following command:

bcdedit /set hypervisorlaunchtype off

This will disable Hyper-V during the boot phase of Windows 10.

Hyper-V is disabled

To re-enable Hyper-V, issue the following command:

bcdedit /set hypervisorlaunchtype auto

If you still want to use Linux inside of WSL along with virtual machines in Virtualbox, consider downgrading some or all your Linux distros from WSL2 to WSL. To do that, open a powershell or cmd terminal as Administrator and enter the following command to list all installed Linux distros in WSL:

wsl --list --verbose
List all installed Linux distros

This will list all installed Linux distros on your computer along with the configured WSL version. With the following command, Linux distros can be converted from WSL2 to WSL:

wsl --set-version kali-linux 1
Convert a Linux distro from WSL2 to WSL

13 thoughts on “Fix Virtualbox on Windows 10 2004

  1. Thanks a lot, it has been hours now trying to fix that hash sum mismatch error. I usually use wsl 2 and vbox repetitively! I really don’t understand why would hypervisor affect the files being downloaded on the vbox?

    Can you elaborate on what happens, please?

    Like

    • Hi Ahmed
      Thank you for your feedback. I was actually wondering the same 🙂
      I don’t have a definitive answer, but I believe it has something to do with performance. The release notes of Virtualbox 6.0.0 (you can find it here: https://www.virtualbox.org/wiki/Changelog-6.0), mentions that when Hyper-V and Virtualbox run on the same machine, Virtualbox will use a fallback mode, which will have an impact on performance. My observations were that none of my Windows machines would run, and the Linux machines would run, but with the issues described in my article. I assume that the performance impact is in such manner that Windows would just crash, but the more lightweight Linux would run, but run into timeout problems when searching for packages. But honestly, I don’t know.
      Best regards
      Mathias

      Like

      • Oh yeah!
        Hell of performance issues! a simple enum cannot go smoothly on VBox machine, as well as many checksums, including those on git.
        It’s really frustrating!

        Like

    • in september 2020 patch tuesday they broke wsl ,,,,
      I could not run virtualbox vms at all … The only thing that cleared the problem was the
      bcdedit /set hypervisorlaunchtype off
      Make sure you do a full shutdown too

      Like

  2. Hey, it is me again.
    as I’m using wsl 2 I just wanted to stop the hypervisor as you showed here. yet, this didn’t solve the mismatch error even after reboot. moreover, my wsl2 kali still available on wsl 2.
    Searching further online no one else mentioned the `bcdedit` are you sure about it?

    Like

      • Hi Mathias,
        I actually did reboot the host machine. On bcdedit, it shows:
        “`
        Windows Boot Loader
        ——————-
        identifier {current}
        device partition=C:
        path \WINDOWS\system32\winload.efi
        description Windows 10
        locale en-US
        inherit {bootloadersettings}
        recoverysequence {2a309ba4-cdbf-11ea-b070-ae432f8ab682}
        displaymessageoverride Recovery
        recoveryenabled Yes
        isolatedcontext Yes
        allowedinmemorysettings 0x15000075
        osdevice partition=C:
        systemroot \WINDOWS
        resumeobject {2a309ba2-cdbf-11ea-b070-ae432f8ab682}
        nx OptIn
        bootmenupolicy Standard
        hypervisorlaunchtype Off
        “`
        Yet, My wsl 2 kali-linux machine still available, and my VBox still suffering 😀

        Like

  3. Appreciate your help! Installed Docker desktop and the WSL2 that came with it broke all my VMs… Finally back to normal

    Like

Leave a comment