VirtualBox

Opened 3 years ago

Last modified 13 months 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)

VBox.log (29.0 KB ) - added by Janis Baumanis 3 years ago.
VM Log

Download all attachments as: .zip

Change History (11)

by Janis Baumanis, 3 years ago

Attachment: VBox.log added

VM Log

comment:1 by ainars, 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 Captain_Chaos, 2 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.

Last edited 2 years ago by Captain_Chaos (previous) (diff)

comment:3 by pjfarley3, 2 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

Last edited 2 years ago by pjfarley3 (previous) (diff)

comment:4 by Denis Kozlov, 2 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.

Last edited 2 years ago by Denis Kozlov (previous) (diff)

comment:6 by Klaus Espenlaub, 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 Nico.Orru, 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?

Last edited 2 years ago by Nico.Orru (previous) (diff)

comment:8 by Stefano, 22 months ago

VirtualBox 6.1.36 was just released, but starting Virtualbox with hypervisorlaunchtype = auto still results in perf degradation and green turtle icon.

in reply to:  8 comment:9 by BGNLouie, 21 months ago

Replying to Stefano:

VirtualBox 6.1.36 was just released, but starting Virtualbox with hypervisorlaunchtype = auto still results in perf degradation and green turtle icon.

confirmed, issue still exists..

comment:10 by virthoster, 13 months ago

I'm afraid I have to bump this issue, as I'm still experiencing the problem as of Virtualbox 7.0.6.

I apparently had WSL in some state of semi-enablement, but as I wanted to start using Podman Desktop, I had to go the full way and completely enable WSL. Prior when Virtualbox was working fine; WSL was on, Virtual Machine Platform was on, and I think both Hyper-V and the Hypervisor platform were turned off. I had a Linux guest in a saved state using the KVM hypervisor.

I have since run the bcdedit /set hypervisorlaunchtype auto command as well as toggling the Virtual Machine Platform off then back on again to get WSL2 to completely activate and accept the installation of Podman Desktop. After doing that however, I found that I could no longer restore the state of my virtual machine- VirtualBox would report an exception that some memory could not be read. I cleared the saved state of my virtual machine, then manually rebooted it, which results in the extremely slow boot times, various kernel errors and the dreaded green turtle like others are reporting.

What seems to be working for me now is I've edited the virtual machine config and forced the paravirtualization interface to Hyper-V, where it used to be Auto (KVM) before. It looks like that has restored performance to where it was at before.

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use