microsoft / WSL

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

Not able to switch to WSL2. Error code: Wsl/Service/CreateVm/HCS/HCS_E_HYPERV_NOT_INSTALLED #11384

Open ghoebenreich opened 5 months ago

ghoebenreich commented 5 months ago

Windows Version

Microsoft Windows [Version 10.0.22621.3155]

WSL Version

2.1.5.0

Are you using WSL 1 or WSL 2?

Kernel Version

5.15.146.1-2

Distro Version

Ubuntu 22.04

Other Software

No response

Repro Steps

I have WSL1 running for the Linux Ubuntu 22.04 with name ubuntu

Executingwsl --set-version ubuntu 2 issues the error: For information on key differences with WSL 2 please visit https://aka.ms/wsl2 Conversion in progress, this may take a few minutes. WSL2 is not supported with your current machine configuration. Please enable the "Virtual Machine Platform" optional component and ensure virtualization is enabled in the BIOS. Enable "Virtual Machine Platform" by running: wsl.exe --install --no-distribution For information please visit https://aka.ms/enablevirtualization Error code: Wsl/Service/CreateVm/HCS/HCS_E_HYPERV_NOT_INSTALLED

I enabled the "Virtual Machine Platform". I also disabled it /Reboot/ enabled /reboot. No matter what I do I always get the same error. I checked the BIOS and I have VT-x and all other Virtualization options enabled in the BIOS.

wsl.exe --install --no-distribution :

The operation completed successfully.

I'm running this on: Dell Precision 7560 with CPU 11th Gen Intel(R) Core(TM) i9-11950H @ 2.60GHz / Intel64 Family 6 Model 141 Stepping 1, GenuineIntel. No My CPU supports SLAT.

bcdedit /enum | findstr -i hypervisorlaunchtype shows hypervisorlaunchtype Auto

Not sure what settings I still have to check. I captured the WSL logs WslLogs-2024-03-27_11-10-14.zip

Would be great if someone can tell me what's still wrong.

Expected Behavior

wsl --set-version ubuntu 2

should give a positive result and switch ubuntu to WSL version 2.

Actual Behavior

I enabled the "Virtual Machine Platform". I also disabled it /Reboot/ enabled /reboot. No matter what I do I always get the same error. I checked the BIOS and I have VT-x and all other Virtualization options enabled in the BIOS.

wsl.exe --install --no-distribution :

The operation completed successfully.

I'm running this on: Dell Precision 7560 with CPU 11th Gen Intel(R) Core(TM) i9-11950H @ 2.60GHz / Intel64 Family 6 Model 141 Stepping 1, GenuineIntel. No My CPU supports SLAT.

bcdedit /enum | findstr -i hypervisorlaunchtype shows hypervisorlaunchtype Auto

Not sure what settings I still have to check. I captured the WSL logs WslLogs-2024-03-27_11-10-14.zip

Would be great if someone can tell me what's still wrong. I looked at similar issues like Issue 10332 but it did not solve my issue

Diagnostic Logs

No response

github-actions[bot] commented 5 months ago
Diagnostic information ``` Detected appx version: 2.1.5.0 Detected user visible error: Wsl/Service/CreateVm/HCS/HCS_E_HYPERV_NOT_INSTALLED ```
OneBlue commented 5 months ago

Thank you @ghoebenreich. From the logs, everything looks good so I wonder if you have another hypervisor installed ? Maybe VirtualBox or vmware ?

ghoebenreich commented 5 months ago

HI @OneBlue, I previously had virtualbox installed and docker for windows, but I removed/deinstalled both, I'm running this on bare-metal laptop. How do I check what hypervisor is installed, are there some registry entries to check? I also tried to use the hyper-v installation, but I removed it too (deselected Hyper-V on "Tun Windows features on or off" Tab, since I thought I need it for the WSL2, but according to the documentation only "Virtual Machine Platform" is needed which is installed. Any ideas? Any help is much appreciated.

OneBlue commented 5 months ago

Thank you @ghoebenreich. Let's try one thing: Can you run bcdedit /set hypervisorlaunchtype on as elevated, reboot and see if that solves the issue ?

ghoebenreich commented 5 months ago

@OneBlue I only can set it to autoor off, when I set the bcdedit /set hypervisorlaunchtype on I get

PS C:\Windows\System32> bcdedit /set hypervisorlaunchtype bool on
The integer data is not valid as specified.
Run "bcdedit /?" for command line assistance.
The parameter is incorrect.
benhillis commented 5 months ago

@ghoebenreich - did you try auto?

ghoebenreich commented 5 months ago

@benhillis I had hypervioslaunchtypealways set to auto. I tried to off and auto it again, no change.

ghoebenreich commented 5 months ago

@OneBlue , @benhillis does anybody has some more ideas. Since nothing worked for WSL2, I installed Hyper-V from the windows components. Downloaded Ubuntu 22, but also was not able to start. It tells me a Hyper-V component is not running. Maybe this has something to do with it, that some registry setting or permission setting is blocking something for hyper-v as well.

onomatopellan commented 5 months ago

In an elevated PowerShell if you run systeminfo what it says at the last part, the "Hyper-V Requirements:"?

ghoebenreich commented 5 months ago

@onomatopellan :

Hyper-V Requirements: A hypervisor has been detected. Features required for Hyper-V will not be displayed.

onomatopellan commented 5 months ago

That's correct. Your Windows session is running under the hypervisor. I guess you already tried everything but do you perhaps have Memory integrity disabled? If so enable it and restart the computer.

Also I'd try to enable Windows Sandbox feature:

Optional Windows Features dlg

If you can run it we can discard any Hyper-v issue and point definitely to WSL2.

ghoebenreich commented 4 months ago

@onomatopellan Sorry for the late response. I checked the memory integrity. It tells me that there is an incompatible driver installed, but does not list the driver and refuses to enable it :(. Maybe that's one of my core issues. Thanks for the hint. I will try to enable Windows Sandbox and report back.

HO-COOH commented 3 months ago

None of the method above works for me, not even Windows Sandbox. And I clearly remembered my docker worked before

image

ghoebenreich commented 2 months ago

@onomatopellan I was able get it working finally. Not exactly sure how, but I did the following. I went back to the BIOS and unchecked anything which is related to HyperV support. Booted again and verified with the systeminfo that I don't have a Hyper V. I worked for sometime without changing that. Had some reboots. After a week of working I switched on one setting after the other again, without reinstalling any Windows features. To my surprise I was able to call wsl --default-version 2 and my Ubuntu container got updated to use wsl2. Since that it seems to work:

image

Note: I tried to activate the Memory integrity, before and after this without any success. I still get a deny which says I have an incompatible driver installed, but windows is unable to list which it always says 0, which is a pain, but fortunately I don't depend on the Memory integrity.

Thanks for the help I got.