microsoft / WSL

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

wsl.exe frozen (unable to run any distributions or wsl --list) #7372

Open sfreed141 opened 3 years ago

sfreed141 commented 3 years ago

Windows Build Number

Microsoft Windows [Version 10.0.19043.1165]

WSL Version

Kernel Version

unable to run

Distro Version

n/a

Other Software

No response

Repro Steps

Open terminal (cmd or powershell doesn't matter) and run wsl.exe. I see the same behavior with wsl.exe --list and wsl.exe --status

Expected Behavior

WSL terminal opens

Actual Behavior

wsl.exe appears to freeze. Must be killed with ctrl+c.

Possibly related to #7363.

Diagnostic Logs

I attached a debugger and this is the callstack:

wsl-hang
benhillis commented 3 years ago

Could you check the status of the "lxssmanager" service? I suspect it is stuck in the stopping state, I've seen this previously.

sfreed141 commented 3 years ago

image LxssManager appears to be running, but the two *User variants are stopped. I tried starting them both but LxssManagerUser wouldn't start and LxssManagerUser_34193772 would go back to stopped after a few seconds.

benhillis commented 3 years ago

The LxssManagerUser service isn't used in this path, that's for a niche scenario of trigger starting distros through \\wsl$.

Looks like a deadlock in the lxssmanager service, that process is pretty locked down so there's not a great way to generate a dump of it. Do you have any repro steps for how you got into this state?

sfreed141 commented 3 years ago

No repro steps unfortunately. I ran into it while using Visual Studio (the CMake extension tries listing WSL distros at some point and caused VS to hang). I can't confirm because of the hang but believe I only have two distros installed, Ubuntu 18.04 LTS and Ubuntu 20.04 LTS. I think they're both WSL1 but I'm not 100% sure.

I'll try reinstalling WSL and restarting Windows to see if that fixes the issue (I was holding off in case there were any additional logs you might want).

sfreed141 commented 3 years ago

Confirmed restarting my computer fixed the issue. Here's the output of wsl --list -v and wsl --status in case it helps:

❯ wsl --list -v
  NAME                   STATE           VERSION
* Ubuntu-20.04           Stopped         1
  docker-desktop         Stopped         2
  Ubuntu-18.04           Stopped         1
  docker-desktop-data    Stopped         2

❯ wsl --status
Default Distribution: Ubuntu-20.04
Default Version: 2

Windows Subsystem for Linux was last updated on 7/20/2021
WSL automatic updates are on.

Kernel version: 5.10.16

Also as for repro steps I remember I had VSCode open and connected to one of the WSL instances (using the remote extension). Perhaps having that open for a long time (and sleep cycles from closing/opening laptop) could've been part of the issue.

zzjin commented 3 years ago

I/m face the same issue when closing vscode. After using and closing vscode and wait some time, wsl will try to shutdown itself, but cannot start forever.

Any command wsl, wsl --shutdown wsl --status hang for ever with not any output message.

Version 10.0.22449.1000 wsl2 ubuntu 20.04

hohwille commented 11 months ago

I am also facing the same problem. Even Windows reboot does not help and LxssManager service is shown in status Stopping and all tasks are greyed out. Do I need to uninstall WSL and reinstall from scratch or is there a better way to get out of this situation (I asap need to be able to run docker again to continue working).

hohwille commented 11 months ago

After a long timeout I get an error message:

$ wsl -l
Server execution failed
hohwille commented 11 months ago
$ wsl --update
Installing: Windows Subsystem for Linux
Windows Subsystem for Linux has been installed.

$ wsl -v
WSL-Version: 2.0.9.0
Kernelversion: 5.15.133.1-1
WSLg-Version: 1.0.59
MSRDC-Version: 1.2.4677
Direct3D-Version: 1.611.1-81528511
DXCore-Version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows-Version: 10.0.19045.3693

$ wsl --update
Es wird nach Updates gesucht.
Die neueste Version von Windows-Subsystem für Linux ist bereits installiert.

$ wsl -l
Server execution failed