익명 16:00

WSL2 fails to start with CreateVm/HCS/ERROR_FILE_NOT_FOUND after a reboot, but t...

WSL2 fails to start with CreateVm/HCS/ERROR_FILE_NOT_FOUND after a reboot, but the install looks healthy

After rebooting, no WSL distro will start. Every wsl invocation fails immediately:

The system cannot find the file specified.
Error code: Wsl/Service/CreateInstance/CreateVm/HCS/ERROR_FILE_NOT_FOUND

WSL was working fine. When I restarted, it wouldn't work with the wierd file not found error.

Environment

  • Windows 11 23H2 (build 22631)

  • WSL 2.7.11.0, kernel 6.18.33.2-2

  • Distros stored in the default location

What I have already checked

I've tried:

  • %USERPROFILE%\.wslconfig contains no file paths at all (no kernel=, no swapFile=), so it isn't pointing at something that has gone missing.

  • VirtualMachinePlatform is Enabled:

  Get-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform | ft FeatureName, State
  • vmcompute and hns are both Running.

  • The distro ext4.vhdx files are all present, and their registrations under HKCU\Software\Microsoft\Windows\CurrentVersion\Lxss are intact.

  • The WSL package reports itself as healthy:

  Get-AppxPackage -AllUsers *WindowsSubsystemForLinux* | fl Name, Version, Status
  # Version : 2.7.11.0
  # Status  : Ok

Repair attempts that failed

winget fails near the end of the install:

Installer failed with exit code: 0x80070002 : The system cannot find the file specified.

The AppX deployment log showed that the winget manifest is a version behind what is installed, so it is treated as a downgrade:

Windows cannot install package MicrosoftCorporationII.WindowsSubsystemForLinux
because it has version 2.7.10.0. A higher version 2.7.11.0 of this package is
already installed.

Installing the matching .msixbundle from the WSL releases page directly fails too:

Add-AppxPackage: Deployment failed with HRESULT: 0x80073CFB, The provided package
is already installed, and reinstallation of the package was blocked.
... the provided package has the same identity as an already-installed package but
the contents are different.

What file is WSL actually failing to find, and how do I get it back without unregistering my distros?



Top Answer/Comment:

I'm still not sure what caused it, but what fixed it was downloading the msixbundle for the exact version of WSL that I had installed from github: https://github.com/microsoft/WSL/releases

Then extracting modules.vhd:

cd $env:TEMP
Copy-Item "$HOME\Downloads\Microsoft.WSL_<version>_x64_ARM64.msixbundle" .\wsl.zip -Force
Expand-Archive .\wsl.zip .\wslbundle -Force
Copy-Item .\wslbundle\Microsoft.WSL_<version>_x64.msix .\wslx64.zip -Force
Expand-Archive .\wslx64.zip .\wslx64 -Force
dir .\wslx64

and then, from an elevated cmd/powershell:

wsl --shutdown
msiexec /fa "$env:TEMP\wslx64\wsl.msi" /qb /l*v "$env:TEMP\wslrepair.log"
dir "C:\Program Files\WSL\tools"
wsl
상단 광고의 [X] 버튼을 누르면 내용이 보입니다