microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
16.95k stars 799 forks source link

Error 0x80370102 when running WSL2 in a Win10 VirtualBox VM (macOS Host) #5430

Open brookr opened 4 years ago

brookr commented 4 years ago

Environment

WSL2 on virtualized Windows 10 (2004 Build 19041.392).

Image 2020-06-17 at 5 52 21 PM

Host OS: macOS Catalina 10.15.5

Steps to reproduce

Fresh VM installation from MS-provided ISO. Follow standard installation instructions for WSL2. Install Ubuntu (or 20.04, or 18.04) from the MS Store.

Image 2020-06-17 at 5 59 18 PM

Expected behavior

Launching Ubuntu should complete the installation, and setup a user.

Actual behavior

Error occurs as soon as Ubuntu is launched for the first time.

DHowett commented 4 years ago

If you are running Windows in a VM, your VM host needs to be capable of nested virtualization for you to run WSL2. If it is not, you should consider using WSL1.

brookr commented 4 years ago

Agreed, nested virtualization is essential. VirtualBox has a setting for passing through VT-x. It has to initially be activated by a CLI command, but it's there, and it's turned on:

Image 2020-06-18 at 5 31 25 PM Image 2020-06-18 at 5 27 42 PM
WSLUser commented 4 years ago

FWIW VMWare Fusion works fine with nested virtualization though I'm not on Catalina (which has had a slew of issues)

brookr commented 4 years ago

Right, my colleague has it working in Parallels as well.

So my specific question is: Can WSL 2 run in a VirtualBox VM on a macOS host?

Nested virtualization is turned on, but it is not working. I believe this to be a bug, and I'd like to know if anyone has a workaround.

WSLUser commented 4 years ago

Money would be on a bug in Virtual Box since other solutions work. Getting the diverge will be the trickier part.

grahamhoyes commented 4 years ago

I'm experiencing the same issue running VirtualBox 6.1.10 r138449 on an Ubuntu 20.04 host, with Nested VT-x/AMD-V enabled. Windows guest build 19041.264 (version 2004), latest Ubuntu 20.04 LTS from the Microsoft Store for WSL2.

I would assume that Ubuntu Host -> VirtualBox -> Windows -> Ubuntu WSL2 will rarely happen in the wild (I was just looking to write instructions for colleagues running Windows), but it may be the same issue for those on a macOS host.

brookr commented 4 years ago

VirtualBox docs say this option is supported: https://docs.oracle.com/en/virtualization/virtualbox/6.1/admin/nested-virt.html

On a macOS host, the checkbox to toggle this feature is disabled in the UI, but using the CLI modifyvm command allows it to be turned on. Once it's on, it becomes active in the UI.

brookr commented 3 years ago

I don't think you can install WSL2 on Win10 1909. Are you sure that isn't WSL v1 running there?

WMRamadan commented 3 years ago

Yea I deleted that post when I realized it was actually WSL v1 running on Windows 10 1909. I found that "Nested Virtualization" doesn't really work for WSL2 in Virtualbox on MacOS!

WSLUser commented 3 years ago

You can install WSL2 on 1903 and 1909 as of last week in an optional KB that also has a major wsl1 fix for glibc (so we can all run newer distros on WSL1). Try enabling WSL2 in 1909 and see if the nested virtualization works. Also check if Hyper-V works. If Hyper-V does but not WSL2, then MS can do something to help.

mavaa commented 3 years ago

Virtualbox 6.1.14 r140239 on Arch Linux Host here. I'm almost certain I ran WSL2 in a windows guest (insider preview version) sometime last year, but I'm having no luck getting it working now. Do I have to have Hyper-V enabled or disabled for this to work? I had it on, but after disabling it during troubleshooting, I now get this message:

2020_10_09_15_06_09

marc-ostrow commented 3 years ago

@WSLUser I'm running VBox 6.1.14 r150239 on macOS 10.15.7. I'm running a Windows 10 Enterprise guest (current verinfo: Version 1909 Build 18363.1139) with VT-x/AMD-V, Nested Paging, PAE/NX, and Hyper-V Paravirtualization enabled. I cannot install a version 2 distro, getting:

Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x80370102
Error: 0x80370102 The virtual machine could not be started because a required feature is not installed.

Press any key to continue...

And I have all the Microsoft-Hyper-V optional features enabled.

When I set the default version back to 1, I'm able to install a version 1 distro.

PS C:\Windows\system32> wsl -l -v                                                                                                                                                                           NAME            STATE           VERSION
* Ubuntu-20.04    Running         1
PS C:\Windows\system32>                                                                                                                                                                                     

Then when I try to set the distro version to 2

PS C:\Windows\system32> wsl --set-version Ubuntu-20.04 2                                                                                                                                                  Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
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
PS C:\Windows\system32>

But the VirtualMachinePlatform optional feature is enabled

PS C:\Windows\system32> Get-WindowsOptionalFeature -Online -FeatureName 'Vir*'                                                                                                                            

FeatureName      : VirtualMachinePlatform
DisplayName      : Virtual Machine Platform
Description      : Enables platform support for virtual machines
RestartRequired  : Possible
State            : Enabled
CustomProperties :

PS C:\Windows\system32>
WSLUser commented 3 years ago

I was asking to test Hyper-V. You don't need it to run WSL2, just VMM. So now you enabled Hyper-V, try spinning up Ubuntu from the Quick Create Gallery. If this works and you can run everything you want, then we can say this is a WSL2 issue.

bitcrazed commented 3 years ago

Note that for Hyper-V you need to enable a VM to support nested virtualization: https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/nested-virtualization

baslr commented 3 years ago

@brookr @marc-ostrow @grahamhoyes @mavaa can you run https://downloadcenter.intel.com/download/28539 (Intel Processor Identification Utility) inside the guest where you want to run wsl2 and post all three screens (assuming you have a Intel CPU)?

marc-ostrow commented 3 years ago

;-) Application does not run in a guest. I'm on macOS.

But system information returns the following

Model Name: MacBook Pro Model Identifier: MacBookPro16,1 Processor Name: 8-Core Intel Core i9 Processor Speed: 2.3 GHz Number of Processors: 1 Total Number of Cores: 8 L2 Cache (per Core): 256 KB L3 Cache: 16 MB Hyper-Threading Technology: Enabled Memory: 32 GB

baslr commented 3 years ago

@marc-ostrow I'm sorry, I don't understand. Did you mean your guest is not Windows or the Intel Processor Identification Utility crashes in your Windows guest? If your guest is Windows can you run it a second time? The first time I run it in a Windows guest it crashed. A second run didn't crashed.

mavaa commented 3 years ago

2020_10_23_09_55_56 This is what I get, also tried running it twice, seems like it can't be run inside a VM?

mavaa commented 3 years ago

Just a note, I'm running KVM as a paravirtualization interface right now, not sure if that's relevant here. I've tried going through all the diffierent options earlier when trying to get wsl2 to work, so I can change it again if needed.

marc-ostrow commented 3 years ago

I'm running Win10 Enterprise Guest on a macOS Host, VirtualBox 6.1.14. I could not run the intel processor identification utility in the Win10 Enterprise Guest, no.

In lieu of attempting to find a macOS version (I did not see one specifically for macOS), so I provided basic CPU information. What exactly are you looking for from the processor identification utility?

baslr commented 3 years ago

Screenshot_2020-10-22_15-16-29 @marc-ostrow its this screen. A technology overview of the CPU. This screenshot is from a virtual windows 10.

aleixsr commented 3 years ago

Hello, same issue here using MacOS as guest and Virtualbox. Using wsl version 1 works.

ivictbor commented 3 years ago

I wanted to create a clear post on the pretty popular resource about installing WSL2, so I wanted to run it on clear Windows inside VirtualBox 6.1.18 to make sure all steps are not affected by my Windows environment. Another story that I had to disable VirtualMachinePlatform on host to be able to use VirtualBox because Hyper V clashes with VBox 😅

DISM /Online /Disable-Feature:Microsoft-Hyper-V
PowerShell Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Hypervisor -All
bcdedit /set hypervisorlaunchtype off

Even after reboot, the nested VT option in VirtualBox was grayed out, so I did:

VBoxManage modifyvm VM-NAME --nested-hw-virt on

image

Even after that, inside of VM I have 0x80370102

I mean, it is pretty hard to recommend WSL to someone with such circumstances ¯_(ツ)_/¯

outdoteth commented 3 years ago

After downgrading wsl to version 1 I could get Ubuntu to run but I'm still facing an issue of Docker not running - I think Docker requires wsl2.

$ wsl --set-default-version 1

I'm running Ubuntu -> Virtual box (windows) -> Ubuntu.

marc-ostrow commented 3 years ago

You should be able to run Docker Desktop for Windows with WSL v1 just fine with the following caveat:

You should configure your /etc/wsl.conf file to automount C:\ to the root, and setup options as follows:

[automount] root = / options = "metadata,umask=22,fmask=11"

Then to perform any volume mounts, absolute source paths to /c/...some-path... will work, when Docker Desktop for Windows (without WSLv2 support turned on) can only see the windows filesystem.

heku commented 3 years ago

Same issue, wsl1 works, wsl2 never work. Arch Linux (host) -> Windows 11 (VritualBox guest) CPU is i5-4590 with VT-d and virualization enabled in BIOS All related checkboxes (nested virtualizaiton, nested paging etc) checked in VirtualBox VM settings. Hyper-V Hypervisor option is greyed out in GUI but can be turned on successfully by powershell

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
yssource commented 2 years ago

Same issue, wsl1 works, wsl2 never work. Arch Linux (host) -> Windows 10 (VritualBox guest)

Driaan commented 2 years ago

same issue.. windows 11 -> virtualbox -> windows 11

sengokyu commented 2 years ago

Same issue, but I think this is not WSL issue, may be Hyper-V issue. Is this right ? The system device Microsoft Hyper-V Virtual Machine Bus Provider does not work in a guest vm.

Screenshot from 2021-12-27 11-58-47

My environment:

ricardonogues commented 2 years ago

@sengokyu I don't know if this fixes your problem but WSL2 works fine with windows 11 on qemu. I have the same setup as you but instead use qemu. The only problem with qemu is that if the VM goes into idle mode (I'm using the idle mode term because I don't really know what's happening) it freezes. If you do not interact with it for a couple of miutes or so the VM just stops working forcing me to reset it.

svenjacobs commented 2 years ago

Same problem here. Want to help a colleague that uses Windows so I created a VirtualBox VM on my macOS host.

Enable Nested VT-x/AMD-V is enabled in VirtualBox machine (via VBoxManage modifyvm <vmname> --nested-hw-virt on). Trying to install Ubuntu on WSL2 fails with aforementioned error message. Downgrading to WSL1 via wsl --set-default-version 1 helps but my colleague is probably using WSL2.

VirtualBox: 6.1.32 macOS: 12.2

Megachar0x01 commented 1 year ago

Base os : ubuntu 22.04 hypervisor: Version 6.1.38 guest Os : windows 10 (fuly upgraded)

wsl1 works fine wsl2 giving same error .

WMRamadan commented 1 year ago

Host OS: Ubuntu 22.04 Hypervisor: VirtualBox 7.0.8 Guest OS: Windows 10 22H2

WSL2 still not working in VirtualBox yet works when running inside of VMWare Player 17. I believe this is a VirtualBox specific bug!

mherkazandjian commented 9 months ago

any updates on this issue? i think the problem still persists.

siims-biz commented 9 months ago

Waiting myself for a solution. Guest OS Win 10 22H2 cannot get WSL2 to work. WSL 1/Ubunto works. Setting version to 2 - keeps failing. Made also the experience that Intel Processor Identification Utility-Legacy.exe did not want to run inside the VM.

noodlescripter commented 8 months ago

Problem still there, not able to run docker in vmbox using wsl-2 and hyper-v.

oskar-skog commented 7 months ago

Could this be related? https://forums.virtualbox.org/viewtopic.php?p=540307#p540307

If I'm interpreting it correctly, Hyper-V (or VMP) cannot work in a VirtualBox VM, at least not on older versions of VirtualBox.

MSkwar commented 4 months ago

I'm facing the persistent WSL2 error 0x80370102 across Windows 10 Pro (22H2 Build 19045.4046) and Windows 11 Pro VMs running on VirtualBox 7.0.14 hosted by Ubuntu 22.04 LTS. Despite extensive troubleshooting and configuration adjustments, the issue remains unresolved. Here’s a brief overview:

### Setup and Configuration:

Host OS: Ubuntu 22.04 LTS
Virtualization Tool: VirtualBox 7.0.14, with Guest Additions
VM OS: Windows 10 Pro, 22H2 Build 19045.4046, fully updated; 
       Windows 11 Pro, 23H2 Build 22631.3235, fully updated
BIOS: VT-x is supported and enabled; checked and confirmed
VMs Features: No Hyper-v, Windows Subsystem For Linux enabled, Windows Hypervisor Platform enabled, Virtual Machine Platform enabled

Troubleshooting Steps Taken:

Observations:

Seeking Insights:

I'm looking for any insights, settings adjustments, patches, or workarounds specific to running WSL2 within VirtualBox VMs. The issue is consistent across Windows 10 and 11, indicating a deeper virtualization compatibility challenge. Any shared experiences or advice on navigating this would be greatly appreciated, especially given its importance for my security testing work.