Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to boot Windows 10 guest using VirtualBox with enabled Hyper-V and WSL2 installed [closed]

I recently updated my Windows 10 version to version 2004. I also updated WSL to WSL2.

I encountered a problem while trying to use a Virtual Machine (Windows 10 Host/Windows 10 Guest) through VirtualBox 6.1.8. Everytime I try to boot it, it becomes really slow and doesn't make it past the boot loading screen.

I thought the newest versions of VB fixed this issue (according to this documentation from Microsoft).

What can I do to fix this?

like image 983
tbmsilva Avatar asked Jun 04 '20 00:06

tbmsilva


People also ask

Does wsl2 interfere with VirtualBox?

Will I be able to run WSL 2 and other 3rd party virtualization tools such as VMware, or VirtualBox? Some 3rd party applications cannot work when Hyper-V is in use, which means they will not be able to run when WSL 2 is enabled, such as VMware and VirtualBox.

Does Hyper-V need to be enabled for wsl2?

While WSL 2 uses Microsoft's Hyper-V as a hypervisor under the hood to run the utility VM, it does not require you to enable Windows' Hyper-V role or feature; WSL works perfectly fine without it.

Can VirtualBox work with Hyper-V enabled?

Oracle VM VirtualBox can be used on a Windows host where Hyper-V is running. This is an experimental feature. No configuration is required. Oracle VM VirtualBox detects Hyper-V automatically and uses Hyper-V as the virtualization engine for the host system.

Can I run wsl2 in a virtual machine?

WSL 2 uses the latest and greatest in virtualization technology to run a Linux kernel inside of a lightweight utility virtual machine (VM). However, WSL 2 is not a traditional VM experience.


3 Answers

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 suggesting that turning off some features of VirtualBox will make it work, however 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

like image 53
Zaigham R. Avatar answered Oct 08 '22 06:10

Zaigham R.


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.

like image 24
Shorxy Avatar answered Oct 08 '22 06:10

Shorxy


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://learn.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

like image 2
Marcelino Avatar answered Oct 08 '22 07:10

Marcelino