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

all wsl.exe commands hang #4144

Closed
devsnek opened this issue Jun 15, 2019 · 69 comments
Closed

all wsl.exe commands hang #4144

devsnek opened this issue Jun 15, 2019 · 69 comments

Comments

@devsnek
Copy link

devsnek commented Jun 15, 2019

Please fill out the below information:

  • Your Windows build number: (Type ver at a Windows Command Prompt)

Microsoft Windows [Version 10.0.18917.1000]

  • What you're doing and what's happening: (Copy&paste the full set of specific command-line steps necessary to reproduce the behavior, and their output. Include screen shots if that helps demonstrate the problem.)

$ wsl.exe --help
$ wsl.exe -d Debian
etc...

Example with --help passed (screenshot taken 30s after running command)

  • What's wrong / what should be happening instead:

wsl.exe should not hang.

@onomatopellan
Copy link

Run wsl.exe --shutdown on an elevated cmd to make sure there is no VM running that can slowdown everything.

Things to try:
-what it shows on cmd when you type where wsl ?
-on powershell does wsl --help hangs too?
-show the output of wsl -l -v and wsl echo "Hello". Did they hang too?

@devsnek
Copy link
Author

devsnek commented Jun 15, 2019

@onomatopellan everything you suggest also hangs

@devsnek
Copy link
Author

devsnek commented Jun 15, 2019

restarting fixed this, but obviously i don't know if it will happen again...

@onomatopellan
Copy link

onomatopellan commented Jun 15, 2019

I'm running 18917 inside a Hyper-V VM and it didn't happen to me yet.

Next time you can try Process Explorer to see what's happening during the hangs.

@craigloewen-msft
Copy link
Member

Seems related to issue #4047.

@kamil-mrzyglod
Copy link

It occasionally happens on my PC running 10.0.17763.740.

@rlipscombe
Copy link

Seeing this with 10.0.19013.1.

@arsdever
Copy link

Observed 10.0.19041.388.

  • No response to any command. Just hangs
  • where wsl gives nothing

@kdbcinco
Copy link

kdbcinco commented Aug 31, 2020

Also facing this issue recently. I also tried restarting my laptop, but still, the issue persists.

Windows: Version 10.0.19041.450
wsl echo "test": Hangs, non-interruptible (Ctrl + C)
wsl --help: Does not hang
wsl -l -v: Hangs, interruptible
wsl --shutdown: Hangs, interruptible

@kthompson
Copy link

Also experiencing this with 10.0.18363.1049

@8549
Copy link

8549 commented Sep 15, 2020

I'm also running into this problem on 10.0.20211.1000, restarting the host machine (maybe a couple of times) usually does the trick.

@emilsrits
Copy link

emilsrits commented Sep 28, 2020

Started happening recently, all wsl.exe related commands hang except for wsl --help.
OS version: 1909
OS build: 18363.1082

@aadibajpai
Copy link

aadibajpai commented Oct 20, 2020

same issue, except wsl --help is hanging as well

[Version 10.0.19041.572] if that helps

edit: double restart fixed it for now

@nickb937
Copy link

I had this problem too. Trying to install an image would get stuck in the Installing state, or converting an image from WSL1 would report the error "the operation could not be started because a required feature is not installed."

The suggestion of disabling the override of Control Flow Guard in this comment solved the problem: #4626 (comment)

@taseikyo
Copy link

same issue, all wsl commands (including wsl --help) hang
OS version: 1909
OS build: 18363.1198

@jsteenri
Copy link

jsteenri commented Nov 18, 2020

same issue, all wsl commands (including wsl --help) hang for a long time and then return with:

PS C:\WINDOWS\system32> wsl --help
Server execution failed
PS C:\WINDOWS\system32>

Which looks like this same issue described on superuser

OS: Windows 10
OS version: 2004
OS build: 19041.572

No updates to Windows in past eight days, yet this issue begins out of the blue...

@jsteenri
Copy link

jsteenri commented Nov 19, 2020

Update: Disabling Hyper-V seems to have solved my issue. Or rebooting six or eight times; I guess I won't ever know.

Details
ServerFault issue mentioned disabling and re-enabling WSL, but I started by first using 'optionalfeatures.exe' from Command Prompt as described there, yet only unchecking entire "Hyper-V" section and rebooting per this list of suggestions

Results
Now, WSL2 distro is working, all files intact, and Docker Desktop (using WSL2 backend) is also happy. Note, Hyper-V had been enabled, though largely unused, for all of 2020, while WSL2 usage has only been since August. So maybe Hyper-V and WSL don't play nice together, or something from a recent update bungled that?

Theory
Something with Hyper-V (and maybe a recent update) was causing the LxssManager service to be dead upon Windows startup and completely unresponsive to any changes. With Hyper-V now out-of-the-way, Lxssmanager once again appears healthy.
FYI: registry changes suggested by this AskUbuntu answer didn't make any difference earlier

Pro Tip
Although I didn't need it, I felt better making the above change(s) after creating a backup of the WSL2 filesystem as described in this comment. The one for Docker is similarly located at: C:\Users<you>\AppData\Local\Docker\wsl\data

@bpulliam
Copy link

bpulliam commented May 7, 2021

This is another long-running issue that encapsulates many separate issues with a similar symptom. Since the original issue, we have fixed many things that could display that symptom. I'm going to close this issue so that we can accurately track new issues and not lose anything. If you see an issue with unstable Hyper-V or a hang in LxssManager, please file a new issue so we can gather logs and get it fixed. Thanks!

@bpulliam bpulliam closed this as completed May 7, 2021
@Neutrovertido
Copy link

Managed to fix the issue by disabling all WSL related features, rebooting, then enabling them again and rebooting once more.
Later I had to run wsl --set-default-version 2 again.

@JohnCido
Copy link

JohnCido commented Jan 9, 2022

Managed to fix the issue by disabling all WSL related features, rebooting, then enabling them again and rebooting once more. Later I had to run wsl --set-default-version 2 again.

Disabled Hyper-V plus WSL -> reboot -> enable them again -> reboot solved my issue!

@jordan663994
Copy link

I reproduced the issue, and it stops all commands from working, try not breaking your WSL dist.

@jordan663994
Copy link

also try restarting your PC

@tommai78101
Copy link

@JohnCido Can confirm, I did what you said, to fix my issue after upgrading from Windows 10 to Windows 11. Docker Desktop, Hyper-V, and WSL 2 were already installed on Windows 10 prior to the upgrade. I wondered if a change in OS version causes the WSL to fail?

@kedare
Copy link

kedare commented Apr 9, 2022

I have this issue on fresh Windows 11 install (not upgraded from Windows 10), so it's probably not related to a previous upgrade.

@Mistic92
Copy link

I have the same issue now. WSL2 often just got stuck and even help commands does not work at all
image

@XenoBino
Copy link

XenoBino commented Apr 23, 2022

As of 23 Apr 2022, this issue persists. I have encountered it a couple of times since I started using WSL in late 2020.
I am using Windows 11 21H2 OS Build 22000.613, WSL Kernel 5.10.102.1. There are no updates to Windows nor WSL.
This issue is really frustrating as the only known solution is to restart.
I hope it gets series attention.

@inaroquet
Copy link

WSL worked on my machine on Friday. I shut down for the weekend and started up on Monday and I experienced the issue described in this thread.

WSL Ubuntu-20.04 hangs when try to start Ubuntu from the windows search menu
wsl --help: Does not hang
wsl -l -v: Hangs, interruptible
wsl --shutdown: Hangs, interruptible
Docker Desktop which is set to run on WSL backend hangs on launch

I shut down my pc and started it after 30 minutes but this WSL issue persisted.
I restarted my pc and then the issue was resolved and WSL Ubuntu and Docker Desktop worked.

@alkuzad
Copy link

alkuzad commented Mar 5, 2023

I created gist that kill/restart everything related to Docker/WSL and restarts, for me, regardless of the source issue - this successfully unlocks wsl and docker - https://gist.github.com/alkuzad/438993ecfea601cd56536bc360e5f581

@FLAMESpl
Copy link

I have neiher Hyper-V enabled nor lxssmanager running yet my WSL is totally dead. Any tips for me?

@FLAMESpl
Copy link

taskkill /f /im wslservice.exe did the trick

@caner-cetin
Copy link

Had the same issue. To fix it I first went to Device Manager and noticed that "LxssManager" is trying to stop, but it can't. To unblock it I did this. Run the following command to find the PID of the "LxssManager" process: tasklist /svc /fi "imagename eq svchost.exe" Then went to Task Manager and killed the svchost with this PID. After that I saw that "LxssManager" is unblocked and finally running. Now I can run wsl commands again 😅

Issue still persists, and I am tired of doing this over and over again when everything hangs. Becomes annoying reaaaally quick.

and I was here last month again. this is the only reason I choose bare metal over WSL, this critical issue is here FOR ONE WHOLE YEAR.

and yeah this comment is for bumping the issue.

@ryandwalker
Copy link

Shutting down and then booting back up did not fix the issue. But a "restart" immediately fixed the issue. Apparently it is not always the same in Windows to shutdown and boot up again as it is to restart. I tried several times to shutdown and then start and that didn't work, but one true "restart" of Windows fixed it.

@aldobarr
Copy link

aldobarr commented May 3, 2023

Shutting down and then booting back up did not fix the issue. But a "restart" immediately fixed the issue. Apparently it is not always the same in Windows to shutdown and boot up again as it is to restart. I tried several times to shutdown and then start and that didn't work, but one true "restart" of Windows fixed it.

You need to untick "Turn on fast startup" in control panel -> hardware and sound -> power options -> system settings
in order for a shutdown to do what you expect. Otherwise you need to restart for windows to truly turn off and reset.

@natechoiniere
Copy link

You need to untick "Turn on fast startup" in control panel -> hardware and sound -> power options -> system settings
in order for a shutdown to do what you expect. Otherwise you need to restart for windows to truly turn off and reset.

There is no such option.

@CaptainXLAB
Copy link

Strangely this happened to me just now, first time trying WSL2. Started when I ran wsl --shutdown and it didn't respond. After reading a lot of stuff, I landed on LxssManager service in services.msc and saw it was stuck at "stopping".

Did this on my experiments build - used ProcessHacker to simply terminate the svchost instance that was running LxssManager and started the service again. WSL commands instantly started working again. Not sure if this can cause any data loss but this worked without restarting once or without disabling anything.

Keep in mind I'm using KProcessHacker3.sys driver with unrestricted access for full control... trying to kill the process with other methods might result in some sort of access denied message. You can also try with a command prompt running as SYSTEM to do this but I haven't tested it yet.

It's been a while since I've updated this build, happened on Windows 10 OS Build 19044.2816 and v21H2.

Hope this helps if someone wants to deal with this without rebooting or disabling/re-enabling features :)

@guillemdj
Copy link

taskkill /f /im wslservice.exe did the trick

in my case this caused an immediate BSOD 😭

@caner-cetin
Copy link

People still fly by to this issue and can replicate it, why is this closed?

@t-money-g
Copy link

This is still happening on 19044.3086 on Windows Enterprise.

@migounette
Copy link

@guillemdj's comment works for me

C:\Windows\System32>taskkill /f /im wslservice.exe
SUCCESS: The process "wslservice.exe" with PID 6424 has been terminated.

During this operation, a crash occured... it may help WSL team to understand the issue
image

C:\Windows\System32>wsl --status
Default Distribution: Ubuntu-20.04
Default Version: 2

You can also collect logs with - https://github.com/microsoft/WSL/blob/master/diagnostics/collect-wsl-logs.ps1

@domenicquirl
Copy link

domenicquirl commented Aug 22, 2023

Just encountered this on 10.0.22000.2295. I got it working again going off of this comment, but LxssManager wasn't even running when I first checked. So I had to manually start it (which didn't help yet), then kill it, and only then did the wsl commands stop hanging.

@diamondzxd
Copy link

Happened just now, all wsl commands hanging except wsl --help

@Parideboy
Copy link

Happened just now, all wsl commands hanging except wsl --help

Same here, can't use wsl anymore, no matter what I try

@diegocaprioli
Copy link

Managed to fix the issue by disabling all WSL related features, rebooting, then enabling them again and rebooting once more. Later I had to run wsl --set-default-version 2 again.

This worked for me. Thanks!

@NewEpoch2020
Copy link

I used the following command to shut down the LxssWanager service to solve the problem.
for /f "tokens=2" %a in ('tasklist /svc /fi "imagename eq svchost.exe" ^| findstr LxssManager') do pskill -t %a

@syamsoul
Copy link

syamsoul commented Jan 3, 2024

Managed to fix the issue by disabling all WSL related features, rebooting, then enabling them again and rebooting once more. Later I had to run wsl --set-default-version 2 again.

Thank you.... it worked for me..

  1. wsl --set-default-version 2
  2. reboot

@DanKaplanSES
Copy link
Contributor

DanKaplanSES commented Jan 24, 2024

@grandchild

Even shorter output than what @WinniX posted:
...
C:\> tasklist /nh /svc /fi "services eq lxssmanager"
...
But [killing that process] from the TaskManager/Details tab [works]. So hey -- at least no reboot required.

I'm on Windows 10 so that might be the difference, but when I tried to kill this in the task manager, it displays me a pop up that forces me to restart UPDATE: I misunderstood the alert button. Clicking that shuts down the process, not the computer. :

image

It's worth stating that after I followed the recommended steps, it didn't make a difference: wsl.exe still hangs.


Managed to fix the issue by disabling all WSL related features, rebooting, then enabling them again and rebooting once more. Later I had to run wsl --set-default-version 2 again.

Disabled Hyper-V plus WSL -> reboot -> enable them again -> reboot solved my issue!

I'm on Windows 10. Would anyone be able to explicitly list these features/services that should be disabled? I don't know if I'm doing it right because after restarting, WSL and the same set of hyper-v services were enabled automatically.

UPDATE: It turns out "features" in these comments refer to Start Menu > Turn Windows Features on or off. Windows 10 has many settings with "features" in the name, so I wanted to disambiguate this detail for others.

I still don't know what "WSL related features" means as it could mean many things. I'm assuming these:

image

@mback4
Copy link

mback4 commented Mar 5, 2024

I can really only replicate this problem by opening vscode from wsl/ubuntu and then forgetting to close the window when I let my computer go to sleep at the end of the workday. Coming back typically wsl has hung, won't respond to wsl --shutdown at all.

Using taskkill to terminate the wslservice.exe fixes the problem for me.

@1EDExg0ffyXfTEqdIUAYNZGnCeajIxMWd2vaQeP

Killing wslservices.exe is not a good workaround, as it results in a bluescreen.

@caner-cetin
Copy link

caner-cetin commented Mar 25, 2024

Killing wslservices.exe is not a good workaround, as it results in a bluescreen.

thought my gmail glitched wtf is that name lmao, also I never got BSOD when killing wsl.exe, don't kill wslservices.exe

@luka-markovic
Copy link

luka-markovic commented Apr 3, 2024

what revived it in my case was killing of all wsl related processes in taskmgr, then restarting lxssmanager service. It seems like every weekly windows update and subsequent mandatory restart (this is on a company laptop) messes it up. You also dont need to have hyper-v in enabled in features, just wsl and virtual machine platform.

@hicotton02
Copy link

I have the same issue. I have even uninstalled any distros, disabled all features, rebooted, enabled the features, rebooted, and tried to reinstall the distro. It hangs still. I am on Win 11 with latest updates. At this point, I am looking at reinstalling Windows....

@sedlund
Copy link

sedlund commented May 30, 2024

for me I had rclone configured as a service that mounts a remote network storage as a drive. and that storage was down.

this caused all the wsl commands (wsl -l wsl --shutdown) to hang and WSL from starting.

after stopping the rclone service wsl began working again.

@maxfelker
Copy link

Having the same issue with Window 10 Version 22H2 OS build 19045.4651. My issue was the my physical hard drive ran out of memory while I was using VS Code and building docker images. This comment tipped me off:

taskkill /f /im wslservice.exe did the trick

I right clicked on my terminal and Ran as Adminstrator then ran the command above. In the same terminal I then ran wsl.

From there I was able to open WSL by either opening up the Ubuntu app from the start bar or typing wsl into my terminal running at user level. That resolved my issue, did not get BSoD.

@HernandoR
Copy link

HernandoR commented Aug 28, 2024

Constantly experience this Issue, regardless reboots.

  1. go windows control panel, notices that WSL is not enabled,(though wsl is running). Enble and reboot-> wsl --shutdown still hangs
  2. Disable WSL in windows control panel, reboot. -> wsl --list --running shows my Ubuntu
  3. try wsl --uninstall cmdl shows error and fail, but the log shows uninstalled.
  4. try to call wsl --list --running no wsl is running,
  5. reboot and enable wsl in the windows control panel
  6. use wsl --update installed wsl. wsl --status seems correct to me ( version 2)

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