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

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s