microsoft / WSL

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

WslRegisterDistribution failed with error: 0x80070057 #11284

Closed karashiiro closed 7 months ago

karashiiro commented 7 months ago

Windows Version

Microsoft Windows [Version 10.0.22621.3235]

WSL Version

2.1.4.0

Are you using WSL 1 or WSL 2?

Kernel Version

No response

Distro Version

Ubuntu 20.04.6 LTS

Other Software

No response

Repro Steps

Unclear, I had a power outage and WSL was broken when I started my computer again - nothing else appears to be broken.

Expected Behavior

WSL registers the Linux distro successfully.

Actual Behavior

When starting an existing WSL installation using Ubuntu 20.04, it failed with an error: Error code: Wsl/Service/CreateInstance/CreateVm/HCS/E_INVALIDARG.

I unregistered the distro and attempted to install Ubuntu 20.04.06 LTS, and was unable to do so successfully (both on WSL 1 and WSL 2). The error I get when booting the distro is now WslRegisterDistribution failed with error: 0x80070057. I also tried installing Debian and got the same error. I've been experiencing this issue for a few days now, and attached two sets of logs from both when I started seeing this and today.

Diagnostic Logs

https://github.com/microsoft/WSL/files/14559913/WslLogs-2024-03-09_15-34-38.zip https://github.com/microsoft/WSL/files/14559914/WslLogs-2024-03-11_07-13-32.zip

github-actions[bot] commented 7 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

OneBlue commented 7 months ago

Thank you for reporting this @karashiiro. It looks like your Hyper-V firmware might be expired. Can you share the output of: (powershell)

(Get-Item C:\Windows\System32\vmfirmware.dll).VersionInfo
karashiiro commented 7 months ago
ProductVersion   FileVersion      FileName
--------------   -----------      --------
10.0.22621.1     10.0.22621.1 (W… C:\Windows\System32\vmfirmware.dll
OneBlue commented 7 months ago

Thank you @karashiiro. These versions look correct. Let's look at the signatures. Can you share the output of: (powershell)

Get-AuthenticodeSignature c:\windows\system32\vmfirmware.dll | select *
karashiiro commented 7 months ago
SignerCertificate      : [Subject]
                           CN=Microsoft Windows, O=Microsoft Corporation, L=Redmond, S=Washington, C=US

                         [Issuer]
                           CN=Microsoft Windows Production PCA 2011, O=Microsoft Corporation, L=Redmond, S=Washington, C=US

                         [Serial Number]
                           33000004158295A1A3D82E2857000000000415

                         [Not Before]
                           2/2/2023 4:05:42 PM

                         [Not After]
                           1/31/2024 4:05:42 PM

                         [Thumbprint]
                           8870483E0E833965A53F422494F1614F79286851

TimeStamperCertificate : [Subject]
                           CN=Microsoft Time-Stamp Service, OU=Thales TSS ESN:0842-4BE6-C29A, OU=Microsoft Ireland Operations Limited, O=Microsoft Corporation,
                         L=Redmond, S=Washington, C=US

                         [Issuer]
                           CN=Microsoft Time-Stamp PCA 2010, O=Microsoft Corporation, L=Redmond, S=Washington, C=US

                         [Serial Number]
                           33000001DA8ED5C95A00D111B10001000001DA

                         [Not Before]
                           10/12/2023 12:06:59 PM

                         [Not After]
                           1/10/2025 11:06:59 AM

                         [Thumbprint]
                           42A21F2189631D46CDA18D3FC23857467FEC480D

Status                 : Valid
StatusMessage          : Signature verified.
Path                   : C:\windows\system32\vmfirmware.dll
SignatureType          : Catalog
IsOSBinary             : True
OneBlue commented 7 months ago

Thank you @karashiiro. Looking at the logs again this issue might be caused by a corrupted WSL installation.

Can you try to run wsl.exe --update --pre-release to see if that solves the issue ?

karashiiro commented 7 months ago

That gave another error:

Checking for updates.
Updating Windows Subsystem for Linux to version: 2.1.5.
The older version of Windows Subsystem for Linux cannot be removed.  Contact your technical support group.
Update failed (exit code: 1603).
Log file: C:\Users\luca\AppData\Local\Temp\wsl-install-logs.txt
Error code: Wsl/UpdatePackage/ERROR_INSTALL_FAILURE

Logs: wsl-install-logs.txt

OneBlue commented 7 months ago

Hmm it does indeed look like a corrupted installation. Does manually downloading the MSI helps ?

If that doesn't work, you can also try: Get-AppxPackage MicrosoftCorporationII.WindowsSubsystemforLinux -AllUsers | Remove-AppxPackage in an elevated powershell

karashiiro commented 7 months ago

Manual MSI installation failure: image

Tries and fails to read C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_2.0.9.0_x64__8wekyb3d8bbwe\wsl.msi, which indeed does not exist.

Cancelling gives this before exiting: image

The command doesn't give an error, and attempting to wsl --install -d Ubuntu-20.04 now works 🚀

Attempting to run wsl --update afterwards causes it to break again in the same way, but re-running the PowerShell command fixes it.

karashiiro commented 7 months ago

While it's concerning that wsl --update breaks things again, my WSL installation seems to otherwise be working now, so thank you for all your help!

OneBlue commented 7 months ago

Interesting. It looks like your machine is hitting some sort of MSIX issue where the MSIX package doesn't properly install. Closing for now since the issue is resolved.