microsoft / WSL

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

Error 0x80370102 #4120

Closed sieja closed 9 months ago

sieja commented 5 years ago

git git1

i Reinstalled wsl and virtual machine in Windows features

benhillis commented 5 years ago

@sieja - Could you make sure that virtualization is enabled via your BIOS?

sieja commented 5 years ago

yes, before updating used wsl 1

benhillis commented 5 years ago

Can you ensure both these are enabled?

  1. Hardware Virtualization Assists* in the form of: Intel VT-x AMD AMD-V

  2. Hyper-V requires Hardware Data Execution Prevention: Intel refers to it as Execute Disable (XD). This feature must be enabled in the system BIOS. AMD refers to it as No Execute (NX). This feature must be enabled in the system BIOS.

heliomeiralins commented 5 years ago

hi @benhillis . Enabling Virtualization in the BIOS solved it for me. i know it is kind of obvious but maybe this could be added to the docs. Thanks.

ghost commented 5 years ago

Yeah, hm. I guess this means if you're running a Windows VM you're stuck with WSL 1, yeah? (Unless Generation 1 Hyper-V can have VMs within VMs)

benhillis commented 5 years ago

@Aidolii hyper-v supports nested Virtualization so this is not an issue.

ghost commented 5 years ago

I only mentioned it because I already tried. I made sure to run the Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform command of course. It gave me the error listed above when I attempted to initialize Debian, 80370102.

onomatopellan commented 5 years ago

Make sure it says "Virtualization: Enabled" on Task Manager -> Performance tab -> CPU

Also you can run systeminfo on an elevated Powershell and at the bottom it will tell you if you have Hyper-v support enabled.

ghost commented 5 years ago

@onomatopellan @benhillis image

Also, when I run systeminfo, it tells me: Hyper-V Requirements: A hypervisor has been detected. Features required for Hyper-V will not be displayed.

Microsoft's documentation says that is the expected response for a working nested Hyper-V environment: https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/hyper-v-requirements

onomatopellan commented 5 years ago

@Aidolii So the host OS is Linux? I think that is an important detail. Did you try Windows Sandbox feature to see if it works? It could be that QEMU/KVM needs a patch for running WSL2 in nested virtualization inside KVM.

ghost commented 5 years ago

uh, what? no, the host OS is Windows. I don't know where you got the idea the host OS is Linux.

onomatopellan commented 5 years ago

Sorry, I was confused because of this: https://stackoverflow.com/questions/51364707/how-does-windows-10-task-manager-detect-a-virtual-machine

In my case I'm running WSL2 inside a Hyper-V VM with Win10 v1903 as host and Task Manager says "Logical processors" and "Virtualization". Which CPU are you running, BTW?

About Windows Sandbox feature, it utilizes a lighweight VM too so if you can run it at least we can discard nested virtualization problems.

ghost commented 5 years ago

It says virtual processors because it's a Generation 2 VM with NUMA spanning enabled. Either of those two things could be an issue.

I forget what processor it is off the top of my head, I'll have to check when I get home.

ghost commented 5 years ago

@onomatopellan The host machine is on an i5-6500 (non-K unfortunately). Windows Sandbox is grayed out and says the processor does not have the necessary virtualization capabilities.

Hyper-V Hypervisor does too, interestingly.

onomatopellan commented 5 years ago

@Aidolii Thanks. Intel CPU shouldn't be an issue with nested virtualization. I managed to break my install while disabling and enabling windows features so if you can't enable any hyper-v feature anymore it's probably because of a broken install. Only a refresh/clean install fixed it for me.

ghost commented 5 years ago

@onomatopellan Sorry it took me so long to reply. I was using a modified installation so I wanted to come back with an unmodified install, which took me a while to get around to.

Unfortunately, even with a completely vanilla install of 18917 in a Hyper-V VM, I hit the same roadblocks as before. Bear in mind, Hyper-V Hypervisor is the only Hyper-V Windows feature that is grayed out, Hyper-V Services and Hyper-V Management Tools are still available.

If this is not supposed to happen, please let me know.

benhillis commented 5 years ago

If the hypervisor feature is greyed out, likely virtualization is disabled in your BIOS.

ghost commented 5 years ago

If the hypervisor feature is greyed out, likely virtualization is disabled in your BIOS.

It's grayed out within the Hyper-V VM. It's obviously not grayed out on the host machine, given virtualization needs to be enabled to run a Hyper-V VM.

ghost commented 5 years ago

Ok, I discovered the issue. Nested virtualization is not enabled on new Hyper-V VMs by default because it disables the Dynamic Memory feature for that VM. You have to enable it after the fact with a command on the host machine (make sure the target is powered off):

Set-VMProcessor <VMName> -ExposeVirtualizationExtensions $true

Alternatively, this command will enable it on every existing VM that is currently powered off (does not affect future VMs):

Get-VM | ? State -eq 'Off' | Set-VMProcessor -ExposeVirtualizationExtensions $true

melophat commented 5 years ago

Ok, I discovered the issue. Nested virtualization is not enabled on new Hyper-V VMs by default because it disables the Dynamic Memory feature for that VM. You have to enable it after the fact with a command on the host machine (make sure the target is powered off):

Set-VMProcessor <VMName> -ExposeVirtualizationExtensions $true

Alternatively, this command will enable it on every existing VM that is currently powered off (does not affect future VMs):

Get-VM | ? State -eq 'Off' | Set-VMProcessor -ExposeVirtualizationExtensions $true

if this is off-topic, or belongs somewhere else, please let me know and I'll move it. Also, if I read the thread correctly, this is regarding trying to enable WSL2 in a Windows 10 vm running on a linux host, but the errors that I'm seeing are basically the same

Will running these commands on a Windows 10 host allow other hypervisors (particularly Virtualbox) to run with WSL2 enabled on the host also? I've found that enabling the VirtualMachinePlatform functionality for WSL2 on my host machine (specs below) gives me an error in both VMWare Workstation 12.5.6 and VirtualBox 6.0.8 r130520 (Qt5.6.2) that virtualization is not enabled in the bios even though it is. if i disable VirtualMachinePlatform and reboot, VMWare and VirtualBox both work again. I do not have Hyper-V installed on my machine. I'd love to take advantage of the benefits of WSL2, but for my docker development setup on my work machine, I need to be able to use at least VirtualBox, so this is a killer for me..

Machine Specs: Dell xps 8900 32GB RAM i7-8700 quad core with HyperThreading, all Virtualization enabled in the bios, XD Enabled in bios Windows 10 Enterprise 1903 build 18362.10006 all latest updates for firmware/bios are installed, as are all the latest windows updates. Currently on the Slow Ring of the Windows Insider Program

Thanks!

ghost commented 5 years ago

this is regarding trying to enable WSL2 in a Windows 10 vm running on a linux host

No, that was someone's incorrect assumption.

Will running these commands on a Windows 10 host allow other hypervisors (particularly Virtualbox) to run with WSL2 enabled on the host also?

Afraid not.

if i disable VirtualMachinePlatform and reboot, VMWare and VirtualBox both work again. I do not have Hyper-V installed on my machine

VMWare and VirtualBox have to publish updates that make themselves compatible, just like they did with Hyper-V. The technology is similar so it shouldn't take much of their time whenever they get around to it.

1001QAdotNET commented 4 years ago

Hi guys

I am having a hard time to make WSL2 work I am on Win10 Fastring, OS Build 19013.1122 System information is reporting these: Processor Intel(R) Core(TM)2 Quad CPU Q9400 @ 2.66GHz, 2667 Mhz, 4 Core(s), 4 Logical Processor(s)

Hyper-V - VM Monitor Mode Extensions Yes Hyper-V - Second Level Address Translation Extensions No Hyper-V - Virtualization Enabled in Firmware Yes Hyper-V - Data Execution Protection Yes Here are my settings: settings And here is the famous error, how do I solve this ? error

melophat commented 4 years ago

this is regarding trying to enable WSL2 in a Windows 10 vm running on a linux host

No, that was someone's incorrect assumption.

Will running these commands on a Windows 10 host allow other hypervisors (particularly Virtualbox) to run with WSL2 enabled on the host also?

Afraid not.

if i disable VirtualMachinePlatform and reboot, VMWare and VirtualBox both work again. I do not have Hyper-V installed on my machine

VMWare and VirtualBox have to publish updates that make themselves compatible, just like they did with Hyper-V. The technology is similar so it shouldn't take much of their time whenever they get around to it.

Thanks for the clarification, Ghost. Hopefully they'll get these wrinkles ironed out soon.

transientuser commented 4 years ago

I have a Windows 10 Pro PC (not VM) running build 19041. I had WSL2 working. I am not sure when it broke but it might have been after I got VMWare Workstation working again. Nothing has changed in my BIOS (all virtualization options are on). Now I am seeing the following:

When I try my original ubuntu shell I get.

image

So I tried loading the ubuntu 20.04 just for yucks and see this:

image

Suggestions?

onomatopellan commented 4 years ago

@transientuser From that Windows Features window untick "Virtual Machine Platform" and restart Windows. Then tick it again and restart Windows.

This is from the May 2020 release notes:

We are aware of an issue where using the DISM (Deployment Image Servicing and Management) tool to repair corruption on systems running the May 2020 Update does not always report the correct status. This will be fixed in an upcoming servicing release.

It looks like Dism never knows when a feature is really enabled so you need to try several times until it works.

transientuser commented 4 years ago

You really had my hopes up but it did not work. I tried uncheck / reboot / recheck / reboot a couple of times, then tried going through the whole wsl2 install process. Then I tried uninstalling ubuntu / reinstalling. And I also tried installing SUSE.

Same results each time. And now that I have uninstalled ubuntu and reinstalled it and SUSE I see this:

image

transientuser commented 4 years ago

image

onomatopellan commented 4 years ago

If you want to uninstall that Legacy distro you can with wsl.exe --unregister Legacy.

You can also try to enable "Windows Sandbox". If it works at least you will know you have everything needed (containers, virtualization) for running WSL2.

Edit: I just remembered some users had a similar problem and they fixed it configuring Windows Defender. Follow these steps https://github.com/microsoft/WSL/issues/4626#issuecomment-553416411

transientuser commented 4 years ago

Ok. I unistalled everything. Virtual platform, WSL, ubuntu. Rebooted. Followed the install steps, loaded the kernel update, installed ubuntu, bounced lxxsmanager (a couple of times) and it finally worked. So I am good now.

Now if only I could get past windows update hanging at 61% for 2004 on my other computer I would be golden

nolram88 commented 4 years ago

Is there a comprehensive checklist and order to follow? also how did you uninstall everything? @transientuser

gyao96 commented 4 years ago

@transientuser I have been struggling with exactly the same issue. Could you offer some detail explanations on what exactly did you do? What do you mean by uninstalling virtual platform and wsl, just uncheck them at "Turn windows features on and off" ? Thanks!

nolram88 commented 4 years ago

Ok. I unistalled everything. Virtual platform, WSL, ubuntu. Rebooted. Followed the install steps, loaded the kernel update, installed ubuntu, bounced lxxsmanager (a couple of times) and it finally worked. So I am good now.

Now if only I could get past windows update hanging at 61% for 2004 on my other computer I would be golden

Ok i had luck following these instructions. i didnt have to bounce lxxmgr but uninstalling everything rebooting and installing everything and rebooting did it for me.

mvaraga commented 4 years ago

I was getting the same error message, so I was not sure if my PC is capable of virtualization. I tried to run Windows Sandbox as it also requires virtualization. While trying to run sandbox I was getting some error messages too. Finally, I was able to fix it by enabling hypervisor and setting hypervisorlaunchtype to auto. I've managed to fix it by these steps https://www.partitionwizard.com/partitionmanager/no-hypervisor-was-found.html

gyao96 commented 4 years ago

I managed to solve it by first enabling "Windows Hypervisor Platform" and "Containers" image After rebooting the error message changed to "Virtual hard disk files must be uncompressed and unencrypted and must not be sparse". Then I solved it according to Post 4103. Quote from @dmchurch ::: Go to the Ubuntu directory in your profile folder (something like %USERPROFILE%\AppData\Local\Packages\CanonicalGroupLimited...), right click on "LocalState", Properties, Advanced, deselect "Compress contents" (and I suppose "Encrypt contents" as well if that's checked). When it asks whether you want to apply to just this folder or to all subfolders and files, you can say "just this folder", because all you're doing is clearing that "compress" flag. After that the wsl --set-version command should work.

steipete commented 4 years ago

Same here. Used VMware Fusion and needed to enable VT-X in CPU settings.

flanhyperbole commented 4 years ago

I solved this by disabling Virtual Machine Platform, Windows Hypervisor Platform and Windows Subsystem for Linux in the "Turn Windows features off and on" and the rebooting, re-enabling and rebooting again. This was after had checked BIOS, Task Manager and systeminfo to see that the values there were as specified above.

I still had an issue after this where the wsl session crashed as I was trying to create a user for the new distro, but found that the distro had been installed so was able to create new user inside wsl and then use commands here to change default user

My trip up at that stage was that the listed version has a different command - eg Ubuntu-18.04 becomes ubuntu1804 to change the config.

bmy4415 commented 4 years ago

I want to share my case. I got exactly same error when installing Ubuntu 18.04. In my case, the main reason was due to CPU virtualization. After I enabled CPU Virtualization, it works.

Hardware SPEC

AMD Ryzen3600 CPU / B450M mainboard

Actions

  1. Go to BIOS menu
  2. Go to Advanced Frequency Settings
  3. Go to Advanced CPU Core Settings
  4. Enable SVM Mode
  5. Click Save & Exit
  6. Click Save & Exit Setup

After doing above, I can install Ubuntu 18.04 without any errors.

Thanks

Naworm commented 4 years ago

To fix the problem, just execute this as administrator, then reboot : bcdedit /set hypervisorlaunchtype auto

It's 100% working for me 😉 For VirtualBox user : this option will slow down you VMs, you can roll back with bcdedit /set hypervisorlaunchtype off

johannfenech commented 4 years ago

This fixed it for me https://blog.johannfenech.com/fix-wslregisterdistribution-failed-with-error-0x80370102/

lzy1g1225 commented 4 years ago

Enable 'No Execute' for AMD works for me. (holy shit after many trying and even reinstalled my windows10!!)

luizfernandonb commented 4 years ago

"Virtualization" and "Execute Disable Bit" are already enabled in the BIOS but even so the error 0x80370102 appears, I don't know what to do anymore :/

Parazit1989 commented 4 years ago

I fixed this error only by disabling the VT-d technology in the BIOS

KingKami commented 4 years ago

To fix the problem, just execute this as administrator, then reboot : bcdedit /set hypervisorlaunchtype auto

It's 100% working for me 😉 For VirtualBox user : this option will slow down you VMs, you can roll back with bcdedit /set hypervisorlaunchtype off

This is what worked for me but I can't run my vmware virtual machines anymore unless I set it back to off really annoying...

Naworm commented 4 years ago

To fix the problem, just execute this as administrator, then reboot : bcdedit /set hypervisorlaunchtype auto It's 100% working for me 😉 For VirtualBox user : this option will slow down you VMs, you can roll back with bcdedit /set hypervisorlaunchtype off

This is what worked for me but I can't run my vmware virtual machines anymore unless I set it back to off really annoying...

I am sure that if you update your VMs and VMware software it will be fixed

KingKami commented 4 years ago

To fix the problem, just execute this as administrator, then reboot : bcdedit /set hypervisorlaunchtype auto It's 100% working for me 😉 For VirtualBox user : this option will slow down you VMs, you can roll back with bcdedit /set hypervisorlaunchtype off

This is what worked for me but I can't run my vmware virtual machines anymore unless I set it back to off really annoying...

I am sure that if you update your VMs and VMware software it will be fixed

I Had vmware 15.5.5 as mentionned in the vmware blog. As you said I tried to get new updates for vmware and 15.5.6 was out after reboot it works thanks.

lexfrei commented 4 years ago

Disabing the Limit CPUID Max works for me. Thx, @johannfenech

vartikaNits commented 4 years ago

To fix the problem, just execute this as administrator, then reboot : bcdedit /set hypervisorlaunchtype auto

It's 100% working for me 😉 For VirtualBox user : this option will slow down you VMs, you can roll back with bcdedit /set hypervisorlaunchtype off

It worked for me as well! Thanks a lot!

LukeSamkharadze commented 4 years ago

Ok. I unistalled everything. Virtual platform, WSL, ubuntu. Rebooted. Followed the install steps, loaded the kernel update, installed ubuntu, bounced lxxsmanager (a couple of times) and it finally worked. So I am good now.

bcdedit /set hypervisorlaunchtype auto

I tried this steps and it works like a charm. Thankss

rafaelnordavind commented 4 years ago

Ok. I unistalled everything. Virtual platform, WSL, ubuntu. Rebooted. Followed the install steps, loaded the kernel update, installed ubuntu, bounced lxxsmanager (a couple of times) and it finally worked. So I am good now.

bcdedit /set hypervisorlaunchtype auto

I tried this steps and it works like a charm. Thankss

It Works!! Thank you

neuf007 commented 4 years ago

Hello I had the same problem as you and I couldn't find anything on the web ... I noticed a little tweak in Vmware. The attached capture shows you what I just checked to make it work properly

image