WSL fails to start with HCS_E_HYPERV_NOT_INSTALLED error after Windows 11 in-place upgrade despite hyper-v being on
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
### Windows Version
Microsoft Windows [Version 10.0.22631.4169]
### WSL Version
2.3.24.0
### Are you using WSL 1 or WSL 2?
- [x] WSL 2
- [ ] WSL 1
### Kernel Version
5.15.153.1-2
### Distro Version
Ubuntu 20.04
### Other Software
CPU: AMD Ryzen 7-7700X with AMD SVM **enabled**
### Repro Steps
Windows 11 cumulative update for 23H2 was failing repeatedly. Out of the possible solutions [on the windows support forums](https://answers.microsoft.com/en-us/windows/forum/all/windows-update-error-0x800f0905/8f7d18f9-c1fa-4fba-b92b-7c04c27e96b5) the only way to install it that worked was to do an in-place upgrade (with the windows installation iso labelled as 24H2 from [https://www.microsoft.com/en-us/software-download/windows11](https://www.microsoft.com/en-us/software-download/windows11)). Following the in-place upgrade windows features related to WSL appear twice in the Windows Features dialog and were all disabled.
Despite being disabled, running wsl.exe was possible, but produced:
`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/CreateInstance/CreateVm/HCS/HCS_E_HYPERV_NOT_INSTALLED`
'wsl.exe --install --no-distribution' said that wsl was already installed.
After enabling the Virtual Machine Platform, Windows Hypervisor Platform, and Windows Subsystem for Linux features, the same error persists.
Note: before the in-place upgrade wsl was also refusing to start but with a different error. Exact error is no longer available but it was something about `the handle is invalid` and error code `0x80070006`. Here are the logs for it: [WslLogs-2024-10-13_14-45-44.zip](https://github.com/user-attachments/files/17366630/WslLogs-2024-10-13_14-45-44.zip). Considering that windows updates have previously broken wsl functionality for me, I thought that installing the update could resolve the issue. It just got worse :)
### Expected Behavior
WSL is able to start when hyper-v platform is enabled.
### Actual Behavior
`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/CreateInstance/CreateVm/HCS/HCS_E_HYPERV_NOT_INSTALLED`
This is despite Virtual Machine Platform, Windows Hypervisor Platform, and Windows Subsystem for Linux features now being turned on.

### Diagnostic Logs
[WslLogs-2024-10-14_12-40-11.zip](https://github.com/user-attachments/files/17366548/WslLogs-2024-10-14_12-40-11.zip)
Contributor guide
Research direction
Start by reviewing the attached WslLogs-2024-10-14_12-40-11.zip and the earlier WslLogs-2024-10-13_14-45-44.zip, then reproduce the failure with WSL 2 after enabling the listed Windows features. Done means identifying the cause of HCS_E_HYPERV_NOT_INSTALLED after the in-place upgrade and defining a verified fix or clear product diagnosis.
Written by the indexing model from the issue text.
Assessment
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100