Unable to boot Windows 10 guest using VirtualBox with enabled Hyper-V and WSL2 installed
Downgrade to WSL1, if you want to save yourself from days of wasted effort.
I've upgraded to WSL2 and tried a bit to get VirtualBox to work with it and I couldn't find anything useful. There are few guides which suggest that turning off some features of VirtualBox which make it work but it will make it even slower than what it is right now, which really defeats the purpose.
https://github.com/MicrosoftDocs/WSL/issues/536
https://superuser.com/q/1531337
Since VirtualBox 6.0 support for Hyper-V has been added, but it is still experimental, which explains the bad performance (https://docs.oracle.com/en/virtualization/virtualbox/6.0/admin/hyperv-support.html).
I was able to fix this issue via disabling WSL2 in the Windows Features.
If you go into Control Panel > All Control Panel Items > Programs and Features > Windows Features
you will find a list, where you can disable or enable some Windows features.
Probably Hyper-V is already disabled in the features and you may wonder why VirtualBox still doesn't work properly. That is because WSL2 uses Hyper-V under the hood, even if it is not enabled for your custom use.
To make your VirtualBox usable again you have to uncheck the features Virtual Machine Platform
and Windows Subsystem for Linux
too and restart your PC for the effect to take place.
Clearly this will disable your PC to use WSL2 but at any time you may reactivate these features to work with WSL2 again. If you are not forced to use VirtualBox and WSL2 at the same time this works like a charm.
You must activate "Windows Hypervisor Platform".
To do this, search for "windows resources" on Start menu. Open the "Activate/Deactivate Windows Resources" in the search result.
Select the option "Windows Hypervisor Platform" on the list and click Ok. This is an API exposed by Microsoft to make third parties virtualization providers compatible with Hyper-V, witch is used by WSL2.
That's because only one hypervisor may run at once on the host machine. So, the Microsoft Hyper-V hypervisor used by WSL2 prevents the VirtualBox to use the processor virtualization extensions.
See the FAQ below:
https://docs.microsoft.com/en-us/windows/wsl/wsl2-faq#will-i-be-able-to-run-wsl-2-and-other-3rd-party-virtualization-tools-such-as-vmware-or-virtualbox