Opened 3 years ago
Last modified 2 years ago
#20357 new defect
VM launch fail on Windows 10 when WSL2 and Docker is enabled
| Reported by: | Janis Baumanis | Owned by: | |
|---|---|---|---|
| Component: | other | Version: | VirtualBox 6.1.22 |
| Keywords: | Cc: | ||
| Guest type: | Linux | Host type: | Windows |
Description
We are using Docker containers and Vagrant + VirtualBox virtual machines in Windows 10 (now 20H2). Would be very convenient to make both parties (Docker+WSL2 and VirtualBox) working together on same machine. However when Docker Desktop with WSL2 support is installed, existing VirtualBox virtual machines (Linux 64-bit quests with installed VirtualBox Guest additions) fail to launch. Instead error message appear:
WHvCapabilityCodeHypervisorPresent is FALSE! Make sure you have enabled the 'Windows Hypervisor Platform' feature. (VERR_NEM_NOT_AVAILABLE). VT-x is not available (VERR_VMX_NO_VMX).
"Windows Hypervisor Platform" feature enabling in Windows features does not change anything. It is not possible to change paravirtualization interface type under VM "Settings - System - Acceleration" too - OK button remain disabled.
To get VirtualBox VMs running again either "hypervisorlaunchtype" must be disabled through Windows Command Prompt with command
bcdedit /set hypervisorlaunchtype off
or Docker Desktop must be uninstalled together with "Windows Hypervisor Platform", "Virtual Machine Platform" and "Windows Subsystem for Linux" feature disabling in Windows Features with subsequential Windows restart. Both actions obviously permit Docker container using together with VirtualBox. Are there is another way how to use VirtualBox 64-bit VMs in Windows host together with WSL2 + Docker installed in same Windows host?
I seen Hyper-V virtualization support appearing in VirtualBox changelog starting from version 6.1.18 with Hyper-V related fixes in 6.1.22. However it does not help for us. Didn't found any useful information about how to run Docker+WSL2 and VirtualBox together in Internet either.
Environment info:
Host: Windows 10 20H2, 64-bit Guests: Ubuntu Linux 18.04 LTS, 64-bit Hardware: Dell OptiPlex 980, Intel Core i5-750 CPU (has VT-x support), 16 GB RAM Dell BIOS, version A18, VT-x is enabled
Attachments (1)
Change History (10)
by , 3 years ago
comment:1 by , 3 years ago
The same problem for: Edition Windows 10 Pro Version 21H1 OS build 19043.1110
with VB v6.1.26r145957
comment:2 by , 3 years ago
This works for me in VirtualBox 6.1.30 (but NOT the latest version, 6.1.32). I have WSL2 and Docker Desktop installed and working, as well as my VirtualBox VMs set to Hyper-V as the paravirtualization interface.
comment:3 by , 3 years ago
Confirmed. I had the exact same issue with 6.1.32 upgrading from 6.1.20, and then again when I downgraded to 6.1.28. Installing 6.1.30 allowed me to use both WSL2 and VirtualBox VM's in default mode. I have yet to try VM's in Hyper-V paravirtualization but that will be my next test.
Windows 10 Pro (64-bit), Version 21H2, Build 19044.1526, All Hyper-V turned off, WSL turned on
Virtual OS's (all 64-bit): Debian 10 (Buster), Ubuntu 20.04.2.0, RHEL 8.5
Virtualbox 6.1.30
Peter Farley, Brooklyn, NY
comment:4 by , 3 years ago
I can confirm the issue and the workaround, to some extent.
Host setup:
- Intel i7-9700K, 64GB RAM
- Windows 10 Pro 21H1 64-bit
- WSL 2 with kernel 5.10.16
- Docker Desktop 4.5.1
- VirtualBox 6.1.32
Windows features:
- Hyper-V = Off
- Virtual Machine Platform = On
- Windows Hypervisor Platform = Off
- Windows Subsystem for Linux = On
Executing bcdedit /enum {current} shows that hypervisorlaunchtype = auto.
Docker containers and WSL images work fine, but a Windows 10 VM in VirtualBox is running extremely slow (e.g. takes hours to boot it up), with the green turtle sign displayed in the status bar.
Relevant lines from VM logs:
HM: HMR3Init: Attempting fall back to NEM: VT-x is not available ... NEM: WHvCapabilityCodeHypervisorPresent is TRUE, so this might work... ... CPUM: No hardware-virtualization capability detected
Now, I close down all apps. Open the command prompt as an administrator and execute bcdedit /set hypervisorlaunchtype off. Reboot!
Start that same Windows 10 VM in VirtualBox, and voila - it is blazingly fast! A blue "V" icon is displayed in place of the green turtle in the status bar.
Relevant lines from VM logs:
HM: HMR3Init: VT-x w/ nested paging and unrestricted guest execution hw support
So, the workaround is working, but requires constantly toggling the hypervisorlaunchtype setting between off and auto and then rebooting, to get either VirtualBox or Docker/WSL working, but never both at the same time it seems.
In sum, Docker uses WSL, WSL uses Hyper-V, VirtualBox can't use hardware virtualization when Hyper-V is active.
Wouldn't it be nice if they all played nicely together.
comment:6 by , 2 years ago
The 'extremely slow performance' regression introduced in 6.1.32 was unfortunately fixed after 6.1.34 was already released, and there are no test builds yet which include the fix.
Workaround: configure the VM to use 1 VCPU. This avoids the regression entirely, but of course it can greatly decrease performance if the VM really needs multiple CPUs.
comment:7 by , 2 years ago
Unfortunately the workaround is not acceptable for my use case, 1 VCPU is not even close to be near to be able to support any of the workloads I'm employing on the VM. Will the regression be fixed in the next release?
follow-up: 9 comment:8 by , 2 years ago
VirtualBox 6.1.36 was just released, but starting Virtualbox with hypervisorlaunchtype = auto still results in perf degradation and green turtle icon.
comment:9 by , 2 years ago
Replying to Stefano:
VirtualBox 6.1.36 was just released, but starting Virtualbox with
hypervisorlaunchtype = autostill results in perf degradation and green turtle icon.
confirmed, issue still exists..


VM Log