Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
brookr opened this issue Jun 18, 2020 · 38 comments
Open
Labels
failure-to-launch failure to launch

Comments

@brookr
Copy link

brookr commented Jun 18, 2020

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
Copy link
Member

DHowett commented Jun 18, 2020

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
Copy link
Author

brookr commented Jun 19, 2020

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
Copy link

WSLUser commented Jun 19, 2020

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

@brookr brookr changed the title Error 0x80370102 when running WSL2 in a Win10 VM (macOS Host) Error 0x80370102 when running WSL2 in a Win10 VirtualBox VM (macOS Host) Jun 19, 2020
@brookr
Copy link
Author

brookr commented Jun 19, 2020

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
Copy link

WSLUser commented Jun 20, 2020

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

@grahamhoyes
Copy link

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
Copy link
Author

brookr commented Jun 24, 2020

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
Copy link
Author

brookr commented Aug 25, 2020 via email

@WMRamadan
Copy link

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
Copy link

WSLUser commented Aug 25, 2020

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
Copy link

mavaa commented Oct 9, 2020

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
Copy link

marc-ostrow commented Oct 14, 2020

@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
Copy link

WSLUser commented Oct 15, 2020

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
Copy link
Contributor

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
Copy link

baslr commented Oct 22, 2020

@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
Copy link

marc-ostrow commented Oct 22, 2020 via email

@baslr
Copy link

baslr commented Oct 23, 2020

@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
Copy link

mavaa commented Oct 23, 2020

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
Copy link

mavaa commented Oct 23, 2020

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
Copy link

marc-ostrow commented Oct 23, 2020 via email

@baslr
Copy link

baslr commented Oct 23, 2020

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
Copy link

aleixsr commented Dec 4, 2020

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

@ivictbor
Copy link

ivictbor commented Feb 4, 2021

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 ¯_(ツ)_/¯

@therealkenc therealkenc added the failure-to-launch failure to launch label Feb 11, 2021
@outdoteth
Copy link

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
Copy link

marc-ostrow commented Mar 1, 2021 via email

@heku
Copy link

heku commented Jul 11, 2021

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
Copy link

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

@Driaan
Copy link

Driaan commented Dec 14, 2021

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

@sengokyu
Copy link

sengokyu commented Dec 27, 2021

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:

  • Host: Ubuntu 20.04
  • VirtualBox 6.1.30
  • Guest: Windows 11 (Dec 2021 Update)

@ricardonogues
Copy link

@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
Copy link

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
Copy link

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

wsl1 works fine wsl2 giving same error .

@WMRamadan
Copy link

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
Copy link

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

@siims-biz
Copy link

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
Copy link

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

@oskar-skog
Copy link

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
Copy link

MSkwar commented Mar 2, 2024

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:

  • VirtualBox Configurations: Adjusted VRAM settings, CPU cores (reduced to 1 from 4), and experimented with "Nested VT-x/AMD-V" settings. Enabled and disabled "Paravirtualization Interface" with various settings (Default, Hyper-V) which sometimes led to boot issues or VM getting stuck in automatic repair, particularly when Windows features conflicted with these settings.
  • Windows Features: Enabled necessary features like "Windows Subsystem for Linux" and "Virtual Machine Platform." Disabling "Virtual Machine Platform" allows the VM to boot normally but then WSL2 can't be used, which defeats the purpose.
  • WSL2 Installation: Attempts to initialize WSL2 consistently result in the 0x80370102 error, pointing towards a virtualization feature issue within this nested environment.
  • Reinstallation Attempts: Both VirtualBox and the Windows VM have been reinstalled to ensure there are no underlying issues from the installation process.

Observations:

  • VMs enter a repair loop without "Nested VT-x/AMD-V" enabled.
  • Enabling "Nested VT-x/AMD-V" and "Virtual Machine Platform" leads to boot issues, suggesting nested virtualization conflicts.
  • No improvement from adjusting paravirtualization settings (noted difference between Windows 10 and 11; legacy and default).

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
failure-to-launch failure to launch
Projects
None yet
Development

No branches or pull requests