WSL icon indicating copy to clipboard operation
WSL copied to clipboard

WSL broke after Windows update

Open refinedkontrol opened this issue 3 years ago • 24 comments

Windows Version

Microsoft Windows [Version 10.0.22621.2715]

WSL Version

Cannot determine N/A

Are you using WSL 1 or WSL 2?

  • [X] WSL 2
  • [ ] WSL 1

Kernel Version

Cannot determine N/A

Distro Version

Cannot determine N/A

Other Software

PS> code --version
1.84.2
1a5daa3a0231a0fbba4f14db7ec463cf99d7768e
x64

Repro Steps

After the following Windows updates, my WSL installation seems to have disappeared. When I run the Ubuntu app, I get this:

(It's repetitive because I followed the prompts to continue/restart.)

Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x8007019e
Error: 0x8007019e The Windows Subsystem for Linux has not been enabled.

Press any key to continue...

[process exited with code 1 (0x00000001)]
You can now close this terminal with Ctrl+D, or press Enter to restart.
Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x8007019e
Error: 0x8007019e The Windows Subsystem for Linux has not been enabled.

Press any key to continue...

[process exited with code 1 (0x00000001)]
You can now close this terminal with Ctrl+D, or press Enter to restart.

I cannot access WSL via VSCode like normal either.

I tried this fix from StackOverflow. I will copy the fix here for the record:

  • Run (Win+R) optionalfeatures.exe
  • untick Windows Subsystem for Linux and click OK Allow the system to restart if prompted
  • Run (Win+R) optionalfeatures.exe again
  • tick Windows Subsystem for Linux and click OK

This will effectively uninstall the WSL and install it again.

The existing WSL installations seem not affected by this procedure in any way (they look exactly like before).

It looks like this commenter on a different StackOverflow question had the same issue.

Expected Behavior

I expected to be able to open the Ubuntu app or the Terminal app and access my WSL command line like normal.

Actual Behavior

Even though I'm running Windows 11, VSCode reports:

Windows Subsystem for Linux not detected. The WSL extension requires Windows 10 with the Windows Subsystem for Linux feature installed.

Source: WSL (Extension)

(For some reason it says Windows 10.)

See additional info under diagnostic logs section...

Diagnostic Logs

I had to answer N/A to a bunch of questions because I couldn't get WSL to give me the information.

Some commands I tried running:

PS> cmd.exe /c ver

Microsoft Windows [Version 10.0.22621.2715]
PS> wsl.exe --version
WSL is finishing an upgrade...
Update failed (exit code: 1603).
Error code: Wsl/CallMsi/E_ABORT
PS> wsl -l -v
WSL is finishing an upgrade...
Update failed (exit code: 1603).
Error code: Wsl/CallMsi/E_ABORT
PS> wsl.exe --status
WSL is finishing an upgrade...
Update failed (exit code: 1603).
Error code: Wsl/CallMsi/E_ABORT
PS> code --version
1.84.2
1a5daa3a0231a0fbba4f14db7ec463cf99d7768e
x64
PS> ver&wsl --list --all -v

Id     Name            PSJobTypeName   State         HasMoreData     Location             Command
--     ----            -------------   -----         -----------     --------             -------
1      Job1            BackgroundJob   Running       True            localhost            ver
WSL is finishing an upgrade...
Update failed (exit code: 1603).
Error code: Wsl/CallMsi/E_ABORT

PS> wsl.exe --help
WSL is finishing an upgrade...
Update failed (exit code: 1603).
Error code: Wsl/CallMsi/E_ABORT

Windows updates that have been installed since the last time WSL worked for me:

Windows updates screenshot

refinedkontrol avatar Nov 27 '23 16:11 refinedkontrol

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!

Open similar issues:

Closed similar issues:

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

github-actions[bot] avatar Nov 27 '23 16:11 github-actions[bot]

Additional info:

Ubuntu app info screenshot

Ubuntu (Windows app) version: 2204.2.33.0

refinedkontrol avatar Nov 27 '23 16:11 refinedkontrol

Thank you @refinedkontrol. Can you try to update to the latest version to be sure that you have it ?

wsl .exe--update --pre-release

OneBlue avatar Nov 27 '23 19:11 OneBlue

Same problem to me after that updates. Every time I tried to open later on I have your same error and after some times a blue screen of death appear. Trying to resinstall wsl didn't work at all.

leone93 avatar Dec 05 '23 08:12 leone93

I too have the same issue, using WSL 2.0.9 (I asssume that verion, I can't issue any comamnds successfully, but the binary is in the MicrosoftCorporationII.WindowsSubsystemForLinux_2.0.9.0_x64__8wekyb3d8bbwe folder).

I really only tried to bounce my system as a workaround. I'm a bit hesitant to really mutate my system further, so I haven't reinstalled, edited registry keys or similar system mutations (I'm afraid to lose my data, though if it's inaccessible I suppose what's the worry?).

johrstrom avatar Dec 05 '23 15:12 johrstrom

I really only tried to bounce my system as a workaround. I'm a bit hesitant to really mutate my system further, so I haven't reinstalled, edited registry keys or similar system mutations (I'm afraid to lose my data, though if it's inaccessible I suppose what's the worry?).

I would recommend trying to install the latest version of WSL before doing anything like that

OneBlue avatar Dec 05 '23 20:12 OneBlue

I would recommend trying to install the latest version of WSL before doing anything like that

Thanks, I'll try this and let this thread know. (I thought 2.0.9 was the latest and didn't dig any further on it).

johrstrom avatar Dec 05 '23 20:12 johrstrom

I would recommend trying to install the latest version of WSL before doing anything like that

Thanks, I'll try this and let this thread know. (I thought 2.0.9 was the latest and didn't dig any further on it).

I cannot install that msi on this machine (a work machine) apparently. I have admin privileges, but alas get the error, even if I try through an administrative powershell.

image

johrstrom avatar Dec 06 '23 14:12 johrstrom

I cannot install that msi on this machine (a work machine) apparently. I have admin privileges, but alas get the error, even if I try through an administrative powershell.

Interesting. Could you try to run (elevated):

msiexec /i path/to/msi /L*V C:\logs.txt

And share C:\logs.txt ?

OneBlue avatar Dec 07 '23 00:12 OneBlue

I ran it and got the logs, but as it's a work machine I'm not entirely sure if I can share it here in it's entirety (I'm asking around for the same).

Is there something specific I can look for/grep to extract?

johrstrom avatar Dec 07 '23 17:12 johrstrom

Is there something specific I can look for/grep to extract?

Not easily. The only thing that this log file should contain would be user names and file paths but to root cause I'd need to see the entire file.

You can always redact things that you don't want to share because posting the log file if you want.

OneBlue avatar Dec 07 '23 19:12 OneBlue

Interesting. Could you try to run (elevated):

msiexec /i path/to/msi /L*V C:\logs.txt

And share C:\logs.txt ?

I have the same problem, and I don't mind sharing the file. logs.txt

xiaoxi-david avatar Dec 08 '23 14:12 xiaoxi-david

I am also having this same issue, and installing the latest version (2.0.14) did not help.

When running the MSI with msiexec /i path/to/msi /L*V, it fails at the end: msi installation logs.txt

When running the MSI with msiexec /a path/to/msi /L*V the installation completes without errors: msi elevated installation logs.txt

koemaeda avatar Dec 08 '23 16:12 koemaeda

I have the same problem, and I don't mind sharing the file. logs.txt

Thank you @xiaoxi-david. Just to confirm, you ran this command as administrator right ? If so, can you please share the output of (elevated powershell):

Get-AppxPackage MicrosoftCorporationII.WindowsSubsystemforLinux -AllUsers

And the content of the registry key: Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WSLService ?

OneBlue avatar Dec 08 '23 19:12 OneBlue

Thank you @xiaoxi-david. Just to confirm, you ran this command as administrator right ?

Yes

If so, can you please share the output of (elevated powershell):

Get-AppxPackage MicrosoftCorporationII.WindowsSubsystemforLinux -AllUsers

image

And the content of the registry key: Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WSLService ?

image

xiaoxi-david avatar Dec 08 '23 20:12 xiaoxi-david

I would recommend trying to install the latest version of WSL before doing anything like that

Thanks, I'll try this and let this thread know. (I thought 2.0.9 was the latest and didn't dig any further on it).

I cannot install that msi on this machine (a work machine) apparently. I have admin privileges, but alas get the error, even if I try through an administrative powershell.

image

I tried the same thing and got the same error.

refinedkontrol avatar Dec 08 '23 21:12 refinedkontrol

Thank you @xiaoxi-david. Looks like you somehow have an older wslservice left behind. Can you try to run (elevated cmd):

sc.exe delete wslservice

And see if that solves the issue ?

OneBlue avatar Dec 08 '23 21:12 OneBlue

Can you try to run (elevated cmd):

sc.exe delete wslservice

I may have to change something first, because I can't run it. image

xiaoxi-david avatar Dec 08 '23 22:12 xiaoxi-david

Found a way to recover my files ✅

I tried a few other things to fix the issue. Deleted some folders from the registry in an attempt to reinstall WSL. Nothing worked. I suspect I damaged my WSL install further.

Decided to cut my losses...

Retrieved the WSL disk image file from:

C:\Users\my.username\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc\LocalState\ext4.vhdx

Opened the ext4.vhdx file with Linux Reader by DiskInternals. I cannot vouch for the safety of this software. I ran it in a VM.

That worked and I was able to recover my files.

Lost hope that I can fix WSL on my machine without doing an OS reinstall.

refinedkontrol avatar Dec 12 '23 19:12 refinedkontrol

Can you try to run (elevated cmd):

sc.exe delete wslservice

Ah that's too bad. This might be something that we'll need to do as part of the WSL 2.0 installation logic. I'll update this thread when I'll have more info on the subject;

OneBlue avatar Dec 13 '23 18:12 OneBlue