I Can't restart wsl2, the command wsl --shutdown and any other wsl command hangs forever. Also I found the service LxssManager in stopping status also hangs forever.
How can I restart wsl ?
I Can't restart wsl2, the command wsl --shutdown and any other wsl command hangs forever. Also I found the service LxssManager in stopping status also hangs forever.
How can I restart wsl ?
It looks like the hang LxssManager service is preventing wsl to restart, I found a way to stop LxssManager and then I was able to restart wsl normally.
First get the PID of svchost.exe running LxssManager, open the cmd as administrator and run:
tasklist /svc /fi "imagename eq svchost.exe" | findstr LxssManager
Grab the returned PID, then run task manager as administrator, in the details tab, search for the svchost.exe containing the PID, right click it and select 'end process tree'.
Now you should be able to restart wsl normally with 'wsl shutdown and wsl.
L
etc. will take you to services starting with that letter. –
Catafalque tasklist /svc /fi "services eq LxssManager"
–
Ribbonfish I was in the same situation and restarting LxssManager service solved my problem.
Start a command prompt with administrative rights (I am logged with a normal user) and copy and paste in order to run the following commands:
sc.exe queryex LxssManager
sc.exe stop LxssManager
sc.exe start LxssManager
sc.exe queryex LxssManager
P.S. If after the second queryex command LxssManager PID is not different then stop did not succeed and you should try to run the commands after switching user to an administrative one.
P.P.S. If you still cannot stop the service, you should use Task Manager to "End process tree" in Details tab (using the PID displayed by queryex command). Make sure you are signed in (is more powerfull than 'run as') as an administrative user.
In PowerShell 7 you can use
Get-CimInstance -ClassName Win32_Service -Filter "Name='LxssManager'"
to find PID of the process. In my case the State
of the returned object is Stop Pending
. Use the returned PID to kill LxssManager
:
Stop-Process -Id $(Get-CimInstance -ClassName Win32_Service -Filter "Name='LxssManager'").ProcessId -Force
This made wsl.exe
responsive again on my machine.
If you can't kill / restart the process from neither cmd, powershell and task manager (on administrative account), what worked for me was using this tool https://github.com/winsiderss/systeminformer/releases/tag/v2.39.
In this thread it is explained why this type of processes can be almost unkillable https://github.com/microsoft/WSL/issues/1086.
For wsl2 try:
on CMD with admin access:
taskkill /F /FI "IMAGENAME eq wsl.exe"
taskkill /F /FI "IMAGENAME eq wslhost.exe"
taskkill /F /FI "IMAGENAME eq wslservice.exe"
ERROR: The search filter cannot be recognized.
–
Emmetropia wslservice.exe
kills all the others. This is the only way I found now as the LxssManager related answers are no more working for my blocked WSL2. –
Raeleneraf © 2022 - 2024 — McMap. All rights reserved.
tasklist /svc /fi "imagename eq svchost.exe" | findstr LxssManager
– Triglyceride