Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wsl: WSL installation seems to be corrupted (error code: Wsl/CallMsi/Install/REGDB_E_CLASSNOTREG). #12624

Open
1 of 2 tasks
llzzzzoo opened this issue Feb 23, 2025 · 12 comments
Open
1 of 2 tasks

Comments

@llzzzzoo
Copy link

llzzzzoo commented Feb 23, 2025

Windows Version

Microsoft Windows [Version 10.0.26100.3194]

WSL Version

0.0.0.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

No response

Distro Version

No response

Other Software

No response

Repro Steps

1. Environment

I have downloaded wsl in the Microsoft Store. Here are the files in C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_2.4.11.0_x64__8wekyb3d8bbwe

Image

Here is my registry.

Image

I don't have these.

  • 计算机\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\WSL

  • 计算机\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\WSL

And I refer to DS's advice and proceed as follows

  1. Modify the registry
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\WSL]
@="Open WSL Here"
"Icon"="C:\\Windows\\System32\\wsl.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\WSL\command]
@="wsl.exe --cd \"%V\""
  1. The following commands were entered in PowerShell
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
sfc /scannow
DISM /Online /Cleanup-Image /RestoreHealth

And restart my PC

  1. I have cleaned up %windir%\System32\lxss folder manually and removed WSL-related packages (e.g. CanonicalGroupLimited.Ubuntu*) from %USERPROFILE%\AppData\Local\Packages.

Expected Behavior

After inputting wsl in PowerShell, it won't appear as below.

Image

Actual Behavior

Three attempts

  1. In PowerShell
    After inputting wsl in PowerShell, it appears as below.

Image

  1. In msi

Image

Image

  1. Reference to an issue

Image

Diagnostic Logs

This log shows me typing wsl into powershell 7.0 until I get the result shown in the image below.

Image

WslLogs-2025-02-23_14-08-28.zip

@llzzzzoo
Copy link
Author

It's been a week and I still can't solve this problem, programming is a long way off!

Copy link

Diagnostic information
.wslconfig found
Detected appx version: 2.4.11.0

@llzzzzoo
Copy link
Author

Anyone else have the same problem?

@shaojunjie0912
Copy link

same

Image

@devpresleycobb
Copy link

I was able to fix this with the following commands:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2

reference: https://learn.microsoft.com/en-us/windows/wsl/install-manual

@llzzzzoo
Copy link
Author

I was able to fix this with the following commands:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart wsl --set-default-version 2

reference: https://learn.microsoft.com/en-us/windows/wsl/install-manual

In the registry, I find my wsl version is 2.

Image

I tried this method, but it can't work.

Image

@shaojunjie0912
Copy link

This is really a terrible issue. It appeared out of nowhere, with no warning, and it's really frustrating. I just ran wsl --update, and I didn't do anything else.

@OneBlue
Copy link
Collaborator

OneBlue commented Feb 25, 2025

Based out the output it's looking like the installer can't write the registry to configure WSL. Do you have any security program / AV running that could block WSL ?

Also let's try to look at the MSI log. Can you download the latest MSI and then run as elevated:

msiexec /i /path/to/msi /l*vx C:\wsllogs.txt

And share the content of C:\wsllogs.txt ?

@llzzzzoo
Copy link
Author

I have Windows Defender and Kaspersky. After I closed Kaspersky, it still cannot work.
wsllogs.txt

@OneBlue
Copy link
Collaborator

OneBlue commented Feb 26, 2025

Interesting. Looking through the logs, this appears to be the root cause:

MSI (s) (30:1C) [18:37:08:751]: Note: 1: 1401 2: HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\WSL 3: 5 
MSI (s) (30:1C) [18:37:08:751]: Note: 1: 2205 2:  3: Error 
MSI (s) (30:1C) [18:37:08:752]: Note: 1: 2228 2:  3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1406 
MSI (c) (E4:C8) [18:37:08:760]: Font created.  Charset: Req=1, Ret=134, Font: Req=, Ret=宋体

Can you check if HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell exists, and if so what its permissions are ? Based on the error code, it looks like the permissions are the issue

@llzzzzoo
Copy link
Author

  1. Exist.

Image

  1. Its permission is SYSTEM

Image

@llzzzzoo
Copy link
Author

llzzzzoo commented Mar 4, 2025

Anything else I can do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants