MicrosoftDocs / WSL

Source code behind the Windows Subsystem for Linux documentation.
https://docs.microsoft.com/windows/wsl
Other
1.92k stars 581 forks source link

WSL2 breaks VirtualBox 6.1 #798

Open jlearman opened 4 years ago

jlearman commented 4 years ago

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 says:

This lets applications use the Hyper-V architecture for their emulation such as the Google Android Emulator, and VirtualBox 6 and above which are both now compatible with Hyper-V.

Unfortunately, it's not true. Running Windows 10 version 2004 and VirtualBox 6.1, enabling WSL2 causes Ubuntu/VB to boot to a blank rectangular screen with rapidly blinking cursor. This happens despite the VM being configured to use HyperV and with HyperV enabled in Windows Features.

Worse yet, the only way I could manage to get VB working again was to restore to before installation of WSL2 and reinstall ("Repair") VirtualBox.

This is a duplicate of https://github.com/MicrosoftDocs/WSL/issues/536, but that issue is closed and I see no way to reopen it.

See also https://stackoverflow.com/questions/62184881/virtualbox-and-wsl2 and https://superuser.com/questions/1531337/cant-run-virtualbox-6-1-4-with-hyper-v

oki-burokku commented 4 years ago

I have used virtualbox for many years, but I swapped to vmware because of this bug. Was the only choice I had....

nchengyeeshen commented 4 years ago

In addition to that, I'm experiencing weird errors such as corrupted data and broken package signing keys for various Linux distros. VMWare Workstation Player doesn't have these issues.

dnperfors commented 4 years ago

I just upgraded my Windows so that I could install WSL2. After that VirtualBox didn't work anymore (as expected), but I installed the "Windows Hypervisor Platform" and installed the latest version of VirtualBox (6.1.12) and now everything is working as expected. Both WSL2 and VirtualBox are now working side by side...

jlearman commented 4 years ago

Thanks, @dnperfors. I didn't realize that Windows Hypervisor Platform was something to install -- rather, just turned on. I don't remember seeing it in instructions for WSL2, but I might be misremembering. Might be worth a try, but I found other reasons not to use WSL at this time for my purposes.

dnperfors commented 4 years ago

@jlearman, it is not needed for wsl, but to use VirtualBox next to wsl

Cito commented 4 years ago

If you want to use WSL 2, you need to install the "Virtual Machine Platform" feature - but as soon as you do that, VirtualBox does not work properly any more. Installing "Windows Hypervisor Platform" as mentioned by @dnperfors did not change anything for me. The problem manifests itself in very slow performance, core dumps and screen staying black after booting e.g. Ubuntu 20.04.

So it looks like that WSL 2 currently cannot coexist with VirtualBox, at least not with the current version 6.1.12 which I am using. Other people are reporting similar problems with WSL 2 and VirtualBox, e.g. here, here, here and here.

What I find particularly problematic is that there is no official statement of Microsoft or Oracle that they recognize the issue and are working on it, I cannot find any dedicated tickets for this on either side.

So unfortunately, despite all the great advantages of WSL 2, it is not to a viable solution, because I often need to run VirtualBoxes and every time deinstalling the "Virtual Machine Platform" and rebooting the computer before I can do this is just too cumbersome. Downgrading to WSL 1 does not really work for me either, due to various compatibility and performance issues.

nico-abram commented 4 years ago

I ran into this, spent a good while trying to find out what it was, had to reboot to get it to work and now wsl2 doesn't work

I'm also running windows 10 home so I don't think I can use "Windows Hypervisor Platform"

This is annoying because the reason I initially got wsl2 was because I needed it for docker, since I couldnt use hyper-v because of windows 10 home

brookman commented 4 years ago

I experience the same problem. WSL2 and VirtualBox 6.1.12 seem to be incompatible.

xwh16 commented 4 years ago

Upgrading my Virtualbox to 6.1.14 fixed the problem. See its Changelog.

nchengyeeshen commented 4 years ago

I just reinstalled VirtualBox 6.1.14 as @xwh16 suggested. It's still a no-go for me.

Here's a screenshot showing cryptographic errors when trying to install Ubuntu Server. I have Virtual Machine Platform and Windows Hypervisor Platform installed.

EDIT: The installation crashed shortly after.

image

stevenvanryckeghem commented 4 years ago

Virtualbox improved stability in their latest test builds: https://www.virtualbox.org/wiki/Testbuilds

Also: https://forums.virtualbox.org/viewtopic.php?f=6&t=90853&start=285#p483776

Cito commented 4 years ago

So to sum up, 6.1.14 contains one fix, but two other fixes for the memory corruption issue are not yet contained in 6.1.14.

I can confirm that 6.1.14 still produces frequent hash sum mismatches, as @nchengyeeshen reported, and network issues.

stevenvanryckeghem commented 4 years ago

So to sum up, 6.1.14 contains one fix, but two other fixes for the memory corruption issue are not yet contained in 6.1.14.

Indeed

I can confirm that 6.1.14 still produces frequent hash sum mismatches, as @nchengyeeshen reported, and network issues.

At first sight, it looks like the latest test builds of Virtualbox doesn't produce hash sum mismatches and network issues.

nico-abram commented 4 years ago

Does virtualbox work side-by-side with WSL2 in the latest test versions, on windows 10 HOME (Which if I recall correctly cannot use hyper-v or something) ?

dnperfors commented 4 years ago

I stand corrected, just like @nchengyeeshen, I do get checksum errors when trying to update my vm. I just tried it with the test build of VirtualBox and for me that solved the sum mismatches.

pihalve commented 4 years ago

I just tried installing VirtualBox 6.1.14 on Windows 10 with WSL2 installed, and I get exact same problem as original poster of this issue. Windows features enabled: Hyper-V, Virtual Machine Platform, Windows Hypervisor Platform, Windows Subsystem for Linux. As a side note, I also have Docker Desktop installed and configured to use WSL2. This was actually the reason I installed WSL2 in the hope that I could have both Docker Desktop and VirtualBox working side-by-side.

nchengyeeshen commented 4 years ago

@pihalve VMWare Workstation Player works based on my experience. Not sure why VirtualBox doesn't work though.

winstonma commented 4 years ago

@nchengyeeshen I follow the instruction in https://github.com/MicrosoftDocs/WSL/issues/536#issuecomment-567369801 and it solves my problem. See if it solve yours.

If it doesn't work then you can try running the following command (enable Hyper-V):

# Run from elevated prompt (admin privileges)
bcdedit /set hypervisorlaunchtype auto

I did both so I am not sure if the instruction in https://github.com/MicrosoftDocs/WSL/issues/536#issuecomment-567369801 is sufficient.

Now my PC can run both docker and virtualbox

Cito commented 4 years ago

@winstonma As far as I understand this workaround hurts performance. Probably better to use the latests test build of VB or to wait for VB 6.1.16.

winstonma commented 4 years ago

Thanks @Cito I just want to highlight that WSL2 and VB 6.1 can co-exist.

Honestly I didn't know the performance problem. I just use VB 6.1 because I need to use VirtualBox to interact with the USB peripherals (mainly tiny task). For pure software I would stick with Docker.

rotateLeft commented 4 years ago

Commenting to add my experience...hopefully not reducing the SNR.

Gave WSL2 a spin recently after discussing it with a colleague. Doing so had the unfortunate side effect of making my Fedora 31 x64 VirtualBox 6.1.14 r140239 (Qt5.6.2) VM act strangely...assigning 4 CPUs caused Guru Meditation when booting the VM, assigning 2 CPUs seemed to fix the issues, but then I get ZLIB checksum errors when trying to install Node packages.

A fresh Fedora 32 VM also wouldn't boot after install (install completed OK, but in hindsight was quite slow).

Uninstalling "Virtual Machine Platform" and other features for WSL, and now everything is speedy and stable with 4 CPUs assigned to the fresh Fedora VM. I have not tried the above workaround.

nchengyeeshen commented 4 years ago

@rotateLeft Yea, but without Virtual Machine Platform WSL 2 will no longer work

zarinfam commented 4 years ago

errors such as corrupted data and broken package signing keys for various Linux distros.

I confirm these kinds of errors on VirtualBox version 6.1.14 r140239. I saw a thread in the VirtualBox forum that said this problem will be fixed in the upcoming release (maybe 6.1.16).

przenz commented 4 years ago

@winstonma As far as I understand this workaround hurts performance. Probably better to use the latests test build of VB or to wait for VB 6.1.16.

I have tried one of latest build and seems that 6.1.15 r140809 at least doesn't have problems with checksum calculation in apt.

emedez commented 4 years ago

I upgraded to VirtualBox 6.1.16 and was able to install Ubuntu 20.04 Desktop without problems.

nchengyeeshen commented 4 years ago

@emedez I just successfully install Ubuntu 20.04.2. I also managed to update it via apt with no cryptographic errors. It's looking good for VirtualBox 6.1.16.

tlenex commented 4 years ago

@emedez @nchengyeeshen I still have problems booting ubuntu 20.04 Desktop x64 on win 10 pro x64 host with wsl2 (fully upgraded 2004, enabled Hyper-V as well as Hypervisor Platform and Virtual Machine Platform in system functions) with VirtualBox 6.1.16 - still blinking _ from live cd boot. What am I missing? image

ciarancourtney commented 4 years ago

@emedez @nchengyeeshen I still have problems booting ubuntu 20.04 Desktop x64 on win 10 pro x64 host with wsl2 (fully upgraded 2004, enabled Hyper-V as well as Hypervisor Platform and Virtual Machine Platform in system functions) with VirtualBox 6.1.16 - still blinking _ from live cd boot. What am I missing? image

6.1.16 seems to work with hyper-v ok on Intel, but still broken on AMD?

hellow554 commented 4 years ago

Nope, I also have the problem and I use an i7-10750H, so it's not an AMD exclusive problem

tlenex commented 4 years ago

Intel i9-10900K here, bios has enabled features: intel virtualization and intel vt-d

It seems that they are still working on it: https://forums.virtualbox.org/viewtopic.php?p=485745#p485745

chli commented 4 years ago

i7-2600K, still broken for me with VirtualBox 6.1.16 Windows Home x64 2004

I can start my debian "sid" VM (Linux Kernel 5.9.0.1-amd64) when I type in a Windows admin console:

bcdedit /set hypervisorlaunchtype off

and then reboot.

But if I enable it (needed for WSL2) with:

bcdedit /set hypervisorlaunchtype auto

and then reboot, my VM doesn't boot anymore but there are still things happening in the Linux Kernel before it hangs. (I left it overnight last time and nothing happened after that last message).

Attached are the Kernel logs, the one that didn't boot has extra "console=ttyS0 console=tty0 ignore_loglevel" as parameters so I can capture the Kernel log in a virtual serial port through VirtualBox.

Hyper-V off: kernel-boot-hyperv-off.txt Hyper-V on: kernel-hang-hyperv-on.txt

tlenex commented 4 years ago

It seems that this is not WSL issue, but VirtualBox software's - I'd suggest closing this topic and sending feedback to VirtualBox developers directly about using it in Hyper-V mode. Ideally on their forums. https://forums.virtualbox.org/viewforum.php?f=6

Latest releases seems promising for some people. We just need to wait for them to cover all hardware settings with Hyper-V enabled.

Pet-slack commented 4 years ago

In my case, it seems that this is an issue only with linux VMs because I have other OSes VMs (OpenBSD, Pfsense, Vyos, Palo Alto FW) that are working fine.

nchengyeeshen commented 4 years ago

@emedez @nchengyeeshen I still have problems booting ubuntu 20.04 Desktop x64 on win 10 pro x64 host with wsl2 (fully upgraded 2004, enabled Hyper-V as well as Hypervisor Platform and Virtual Machine Platform in system functions) with VirtualBox 6.1.16 - still blinking _ from live cd boot. What am I missing? image

6.1.16 seems to work with hyper-v ok on Intel, but still broken on AMD?

Hey @ciarancourtney, do you have Windows Hypervisor Platform enabled?

image

ciarancourtney commented 4 years ago

Hey @ciarancourtney, do you have Windows Hypervisor Platform enabled?

Yes, I've all 3 features you've highlighted enabled on an AMD machine, and an Intel machine.

My CentOS 6 vbox guest only works on the Intel Machine (just fine alongside WSL2), but not on my AMD machine.

The final kernel log line is TSC doesn't count with p0 frequency and various messages RE cgroups before that, could be a red herring.

Cito commented 4 years ago

VB 6.1.16 + WSL 2 seems to work for me now on Win 10 Pro with i7-6700K CPU and these installed options: Virtual Machine Platform, Windows Hypervisor Platform and WSL, but not the Hyper-V Platform.

tlenex commented 4 years ago

@Cito just tried disabling "Hyper-V Platform" still no success

nchengyeeshen commented 4 years ago

@ciarancourtney I'm out of ideas 🤷‍♂️ . I moved my entire workflow to WSL2 and have stopped using VirtualBox for now.

goigle commented 4 years ago

VB 6.1.16 + WSL 2 seems to work for me now on Win 10 Pro with i7-6700K CPU and these installed options: Virtual Machine Platform, Windows Hypervisor Platform and WSL, but not the Hyper-V Platform.

I'm on an AMD platform (Ryzen 7 2700x). VirtualBox 6.1.14 did not work for me, but it seems 6.1.16 is working now. For Windows features, I have neither Hyper-V nor the Windows Hypervisor Platform installed. Only the Virtual Machine Platform and Windows Subsystem for Linux are installed.

Before 6.1.16 I could barely get the Live CD for Ubuntu opened and it crashed at install, now it's Ubuntu inside of VirtualBox is actually installing. I have both WSL2 and VirtualBox open right now and both are working fine

Edit: The install worked and VirtualBox is 'usable', but it's a mildly miserable experience. It's much slower than normal even with 8GB RAM, 128MB VRAM, and 4 processors allocated. I tried enabling the Windows Hypervisor Platform to see what that would do but that didn't change anything. There's a couple errors on startup about not being able to send host log messages and /dev/sda5

hejunion commented 4 years ago

I did the same, had to restore to VBox . Used to using docker-machine for Docker dev. Although there certain flaws when running docker-compose ( volume mount, network access ) , but managed to resolve it finally.

It was said WSL2 Docker Desktop has seamless running on Windows 10 Home as well. So I want to move for it, but... WSL2 Docker Desktop installation went well, docker-compose start containers well.
But suffer extremous slow for my local WordPress, even serveral seconds dealy on login click, almost not feasible. ( Searching around other people with the same issues ).

Have to restore to my using version VirtualBox-5.2.44. Quiet sad for WSL2 Docker Desktop, Windows never stand well with Linux. Switching to Mac now with work migrating ...

temp4422 commented 4 years ago

VirtualBox Version 6.1.16 r140961 (Qt5.6.2) - NOT working with WSL2.

Ubuntu VM is very slow and laging. Windows VM can't start and shows: "Cannot enable nested VT-x/AMD-V without nested-paging and unresricted guest execution! (VERR_CPUM_INVALID_HWVIRT_CONFIG)." MacOS VM stuck in EFI shel.

Specs: Windows 10 Pro, Version 20H2, OS build 19042.572; Processor: Intel i7-7700HQ CPU @ 2.80GHz. After disabling "Virtual Machine Platform" (and reboot) everything work without any problems.

Cito commented 4 years ago

@mrxdkox For me, 6.1.16 works quite well with Linux guests. But I have a different CPU. Maybe the setting Nested VT/x option also plays a role. The switch is greyed out in my machines. But I also noticed crashes in a Windows guest after activating WSL.

m-atoms commented 4 years ago

Same problem here. I'll provide configuration/debugging info so it's easier to track where we're at.

Windows 10 host, Ubuntu 20.02 guest - updated to VirtualBox 6.1.16

Host Machine:

Enabled the following Windows features:

note: tried with and without Hyper-V enabled, did not change result

Tried both of the following acceleration settings in VirtualBox but neither affects the outcome: vbox_6 1 16_default_accel vbox_6 1 16_hyperv_accel

In normal mode, boot to the blinking cursor blank screen that others have mentioned: vbox_6 1 16_boot_screen

Booting in safe mode provides a bit more info but still gets stuck: vbox_6 1 16_safemode_boot_screen

IvanaGyro commented 4 years ago

After I changing the setting of "Paravirtualization Interface" at "guest machine setting-System-Acceleration" from Legacy to Hyper-V, the Windows guest can boot properly.

Updated: 'Nested Paging' have to be disabled.

VirtualBox:

Host Machine:

Enabled Windows Features:

Disabled Windows Features:

Cito commented 4 years ago

After I changing ... from Legacy to Hyper-V, the Windows guest can boot properly.

Unfortunately, booting a Windows guest with 6.1.16 still does not work for me, no matter how I set this option. Only after disabling the WSL2/VM feature it boots properly. Strangely, booting a Linux guest works well for me with WSL2. (i7-6700K CPU)

aetherqi commented 4 years ago

After I changing the setting of "Paravirtualization Interface" at "guest machine setting-System-Acceleration" from Legacy to Hyper-V, the Windows guest can boot properly.

VirtualBox:

  • 6.1.16 r140961

Host Machine:

  • CPU: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz 1.99 GHz
  • Windows 10 Pro build 19042.610

Guest OS:

  • Windows Server 2012 R2 Datacenter

Enabled Windows Features:

  • Virtual Machine Platform
  • WSL2

Disabled Windows Features:

  • Hyper-V

Thanks @Cito setting Hyper-V as the "Paravirtualization Interface" in VirtualBox (6.1.16) allowed my vagrant box (version 2.2.13) to start. All of WSL2, Virtual Machine Platform, Windows Hypervisor Platform were enabled.

martinalbion commented 4 years ago

I've tried all of these fixes with VBox 6.1.16, VM's consistently hang on boot with WSL in a functioning configuration. I installed VMware 16 Player which installed successfully but I have yet to test. If it works in a satisfactory way I may abandon VBox on Windows. I want to use the WSL with VS Code. Adoption == Support. I may edit this post later to report success or failure for Player.

kenny1983 commented 4 years ago

@martinalbion Yes please let us know how you go with VMWare Player. This issue is extremely frustrating and needs to be fixed, but in the meantime I will also ditch VirtualBox if VMWare Player performs better alongside WSL2.

In case anyone is interested, here is my scenario:

Host:

Guest:

image

The guest runs fairly smoothly as long as I have Guest Additions installed and Settings -> Personalisation -> Colours -> Transparency effects toggled to off. As soon as I re-enable Transparency effects, the guest becomes unusable as the UI does not update upon mouse clicks or key presses.

The absolutely critical setting seems to be "Virtual Machine Platform" - with that enabled, WSL2 works but VirtualBox guest takes well over an hour to boot. With it disabled, guest is OK (given the above provisos) but WSL2 reports Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS. For information please visit https://aka.ms/wsl2-install.

martinalbion commented 4 years ago

VMware Player is a success so far. I haven't learned or tried all the features yet, but Centos 8 installed and boots. The terminal can ping sites and the browser works too.

Here are the relevant details:

Windows Features: Hyper-V - OFF Virtual Machine Platform - ON Windows Hypervisor Platform - ON Windows Subsystem for Linux - ON

Windows Update: Windows Feature Update 20H2 - APPLIED

I'll post again when more informative testing can be documented. I really liked VMware Fusion in my Mac days so I'm probably just going to switch. I tried to run Virtual Box again in the above Windows Configuration but the Green Turtle would not relent.

kenny1983 commented 4 years ago

Thanks @martinalbion, I can also confirm that VMWare Workstation 16 Player works much better for me. To everyone else in this thread who hasn't made the switch, do yourselves a favour and say good @#$%ing riddance to VirtualBox once and for all!