WSL: All WSL commands hang (including wsl --shutdown) but WSL is constantly using 30-40% CPU

Version

Microsoft Windows [Version 10.0.22621.160]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.10.102.1

Distro Version

Ubuntu 20.04

Other Software

No response

Repro Steps

This mostly seems to be happening when the device wakes from sleep - after a system restart, I can access the WSL distro as expected

  • Start a WSL distro (Ubuntu 20.04)
  • See it hang
  • Try to do a wsl --shutdown
  • See that hang as well

image

Expected Behavior

  • Start a WSL distro (Ubuntu 20.04)
  • The command line should open

Actual Behavior

  • Start a WSL distro (Ubuntu 20.04)
  • The terminal hangs completely (see screenshot above)

Diagnostic Logs

Feedback Hub logs: https://aka.ms/AAh9fcl

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 298
  • Comments: 352 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Same here @ddonov, when docker desktop is running and notebook awakes from sleep.

My workaround is to kill the wslservice.exe in a admin powershell: taskkill /f /im wslservice.exe

This issue has been automatically closed since it has not had any author activity for the past 7 days. If you’re still experiencing this issue please re-open it.

Thank you!

Please reopen, this issue should not have been closed. This happens all the time, usually after waking the computer from sleep. Usually a simple wsl --shutdown worked after a ~30s wait, but today even this method failed as all wsl commands hang indefinitely. I need to go into task manager and shut down vmwp.exe, as otherwise the vmmem process persists even if I kill all wsl processes manually, and the wsl commands hang anyways.

This problem is really frustrating as it forces me to restart Docker and all containers, as well as my IDE, which with large projects can take some time.

@benhillis

This issue has been automatically closed since it has not had any author activity for the past 7 days. If you’re still experiencing this issue please re-open it.

Thank you!

This is some kind of joke, right?

I have this issue as well. Killing the WSL process from taskmanager recovers, but it does it again. Especially (but not only) after it comes back from sleep.

Update here - we have identified a couple of causes of the vmmem process geting into this state (which also causes the wslservice executable to stop responding). Unfortunately, these issues are in the Windows OS, so we’re working through the process of backporting the fixes.

You just need to do

wsl --shutdown

Hi folks, reopening this so it can be visible to the WSL team. It was closed automatically since we didn’t get any feedback from the original author. Thanks for flagging us on it!

PLEASE FIX WHATEVER IS CAUSING THIS!!! There are literally DOZENS of threads online about this issue, including several on this GitHub repo! All was good in Win10, now WSL goes zombie after a sleep/hybernate and it is not even clear how to bring it back without rebooting the WHOLE SYSTEM.

Guys I found a fix - delete windows and install Linux 😃

I’m not the original poster, but I’m having a similar issue: every wsl command hangs (including wsl --shutdown), this causes problems with Docker, but because of the issues with WSL I can’t even reinstall Docker itself (I initially thought it was a Docker issue but everything seems to point back to WSL).

wsl.exe dmesg also hangs so I can’t post its output.

I attached the logs from collect-wsl-logs.ps1:

WslLogs-2022-08-25_08-34-21.zip

This issue has been automatically closed since it has not had any author activity for the past 7 days. If you’re still experiencing this issue please re-open it.

Thank you!

Same here @ddonov, when docker desktop is running and notebook awakes from sleep.

My workaround is to kill the wslservice.exe in a admin powershell: taskkill /f /im wslservice.exe

ERROR: The process “wslservice.exe” not found

This should not have been closed - maybe the person went on vacation (7days?) Happens often when attempting to switch folders using VSCode. Hangs – generally just reboot to get back to working again for a while.

Heavy CPU from vmmemwsl

Windows ARM64 image

Same problem here. Killing WSL from Task Manager solves the issue but is obviously not ideal.

I have the same problem, WSL2 freeze! And wsl --shutdown doesn’t work! I use only vscode, no WSLg apps…

Does the command taskkill /f /im wslservice.exe work for you?

Hi folks! We are actively investigating this issue, and I’ll post any updates to this thread as soon as they’re ready.

I also wanted to add a thank you for all the users sharing their logs, work arounds, and pain points surrounding this problem. I can very much see that this is a frustrating bug to deal with, and we haven’t been as communicative on this issue as I’d like (which I’ll own up to!). Going forwards I’ll keep a specific eye on this GitHub thread, even when not posting direct updates.

We solved this issue by moving all dev machines and servers to real linux. Good bye M$

I can’t believe this still isn’t fixed and nobody cares lol

Agreed

I moved to Windows from Apple back when WSL1 was a thing - WSL2 was so good, and the integration with VS Code meant most of the dev team moved to it. We enjoyed using dev containers in WSL in VS code, but this issue has been as you say half a year with nothing from MS

WSL now crashes every few days, force stopping everything all the time, I’ve personally moved to a remote dev environment on Alpine and most of my dev team have been forced to move to linux laptops

MS were really doing some very exciting things in the software development space but this issue being ignored is quite shocking 😦

This started happening to me after upgrading WSL to the Microsoft Store version. Interestingly, when the problem occurs, both of my distributions (Ubuntu and Debian) hang and CPU usage goes to 80-90%.

The only way to (temporarily) solve the problem is to open a PowerShell shell as administrator and use taskkill /f /im wslservice.exe.

Nice that this worked for you but the problem most people here are facing is that wsl process (e.g. wmmem) totally hangs. So wsl -l -v does not answer at all nor wsl --shutdown or any other wsl command. I just rebooted my windows and still have the same problem after reboot. I already updated wsl to the latest release (not pre-release) but still no luck. I need docker for my daily work but professional work with docker on windows does not seem to be possible. My need to switch to Mac…

I found a combo of killing all the wsl services and then restarting LxssManager service managed to get it working.

In an admin powershell session:

taskkill /f /im wslservice.exe
taskkill /f /im wslhost.exe
taskkill /f /im wsl.exe
wsl --shutdown
Get-Service LxssManager | Restart-Service

Don’t know if it’ll work for everyone but it worked for me

I was having this issue as well and the following worked for me.

  1. From cmd run optionalfeatures.exe
  2. This will open a window of optional windows features. Scroll down to “Windows Subsystem for Linux” and uncheck it and then click “Ok”.
  3. Reboot
  4. Open cmd again and run optionalfeatures.exe again
  5. Scroll down and re-check “Windows Subsystem for Linux” and click “Ok”
  6. Reboot again. During this reboot a small/quick windows update will occur

I had to reinstall the Ubuntu distro but since then I have not had the hanging wsl issue.

Same here. Need to terminate the process from task manager. This issue started after updated WSL to the Store version.

Facing the same issue: It’s Windows, what were we expecting?

I can confirm that this issue also haunts me. This occurs whenever my laptop goes to sleep.
Suspending the WSL does not help. Only killing it with taskkill /f /im wslservice.exe helps until the next system wake-up. I’m using Docker, so I must restart a docker service.

Same issue here. Using WSL2… wsl --shutdown hangs as does any other wsl command. taskkill /f /im wslservice.exe results in ERROR: The process "wslservice.exe" not found. How to properly force kill/restart WSL in this situation without rebooting?

it’s so sad that such a small indie company like microsoft can not fix a bug with cpu overconsumption for 2 years

try running wsl --update 3 times in a row in a cmd.exe session after a clean reboot.

I find it also helps to pat the top of your head while rubbing your stomach and turning three times in place.

WSLg apps will randomly freeze, and CANNOT be killed. When this happens wsl --shutdown is no long effective, and requires a full restart.

It’s insanely frustrating, and wastes so much time every week.

I just posted this on a similar issue; hope it helps others.

function WslRestart { Get-Service LxssManager | Restart-Service }
function WslStop { Get-Service LxssManager | Stop-Service }

function WslStart { Get-Service LxssManager | Start-Service }

function WslServiceStatus {
	tasklist /svc /fi "imagename eq svchost.exe" | findstr LxssManager
	Get-Service | Where-Object { $_.name -like "*LxssManager*" }
	Get-CimInstance -ClassName Win32_Service -Filter "Name='LxssManager'"
}

function WslKill {
	Write-Host "Killing wsl.exe..."
	taskkill /F /FI "IMAGENAME eq wsl.exe"
	Write-Host "Killing wslhost.exe..."
	taskkill /F /FI "IMAGENAME eq wslhost.exe"
	Write-Host "Killing wslservice.exe..."
	taskkill /F /FI "IMAGENAME eq wslservice.exe"
}

WslForceRestart is the only thing that works for me. I have it in a powershell profile. Must be run as admin. WslStop and WslRestart are both useless functions. I’m including them here just to point out that they don’t work for me. And wsl --shutdown has been useless for … maybe the last year.

function WslForceRestart {
	WslKill
	WslStart
	WslServiceStatus
}

I found a combo of killing all the wsl services and then restarting LxssManager service managed to get it working.

In an admin powershell session:

taskkill /f /im wslservice.exe
taskkill /f /im wslhost.exe
taskkill /f /im wsl.exe
wsl --shutdown
Get-Service LxssManager | Restart-Service

Don’t know if it’ll work for everyone but it worked for me

Thanks, this quote was helpful for my case. The problem was that LxssManager service was hanging in stopping process. The attempt to kill LxssManager service in services.msc during stopping process didn’t work for me. So, I found the LxssManager service under Service Host: Local System in taskmanger and killed it. And then, I restarted LxssManager service in services.msc and wsl command came back to normal.

I gave up on this - the issue has caused problems with every developer within my company.

I’ve taken the decision to move everyone to cloud-based dev environments. Such a shame as WSL was so stable till earlier this year, we migrated from linux dev environments to windows + WSL + vscode - but it can’t be relied upon recently for critical work. Even personally I was having to force quit WSL every couple of days.

Also got this issue. CPU Usage of the Vmmem.exe process shoots up to 90% usage, seemingly at random.

taskkill /f /im wslservice.exe works, but it’s rather annoying to do this every time this issue occurs.

Hopefully there will be a fix one day soon, but I understand that identifying the source of this problem can be quite difficult and maybe this is an environment issue (Drivers, hardware, etc.).

Please reopen, this issue should not have been closed. This happens all the time, usually after waking the computer from sleep. Usually a simple wsl --shutdown worked after a ~30s wait, but today even this method failed as all wsl commands hang indefinitely. I need to go into task manager and shut down vmwp.exe, as otherwise the vmmem process persists even if I kill all wsl processes manually, and the wsl commands hang anyways.

This problem is really frustrating as it forces me to restart Docker and all containers, as well as my IDE, which with large projects can take some time.

What’s worse, if this happens and I forget to close my IDE before terminating WSL, when I reopen the project everything needs to be reindexed. While the entire restart process takes seconds to do and I could live with this inconvenience, indexing can take minutes, which is not inconvenient - it’s infuriating. It is simply unacceptable that this issue persists and I’m absolutely blown away that this seems to be ignored on purpose.

Unfortunately that doesn’t solve the problem. I am not really interested in improving the performance. When it works, it works fine, it just keeps crashing. ‘less frequent’ ≠ never, so this really doesn’t do much to fix the issue

Are you also using docker desktop?

It seemed to me that my problems started with docker desktop 4.42, searching on Docker issues someone talked about problems with the resource saver, disabling it yesterday WSL did not crash all day.

Today an even more specific issue was created (https://github.com/docker/for-win/issues/14827), try disabling the docker resource saver to see if WSL stops crashing.

Ciao

Still experiencing… Can’t even begin to explain how disruptive this is to my workflow lol.

@GhostDog98 I feel like we’re kindred spirits right now. I literally just found this issue an hour after your comment to complain as well.

Restarting my whole machine just to get WSL to work is super irritating, which is often what I have to do. I haven’t launched any VMs of any kind since my last machine restart and I have this issue. Maintainers, please make this a priority.

try this command with Powershell: taskkill /f /im wslservice.exe

Same here @ddonov, when docker desktop is running and notebook awakes from sleep. My workaround is to kill the wslservice.exe in a admin powershell: taskkill /f /im wslservice.exe

ERROR: The process “wslservice.exe” not found

did you start powershell as admin?

Same here; this just started happening in the last few days; Please re-open this MSFT!

Once you kill the task with taskkill /f /im wslservice.exe (run as admin), make sure to update WSL with wsl --update. After that you can open your WSL distro like normal. i would recommend restarting your host machine as well.

Never had this issue before because i’ve always updated WSL from Microsoft Store. Since the change to MS, i had only Winget to update my software (Docker included) but that repository does not manage WSL.

The updates will kick your ass if you don’t keep track of all of them. Make sure you are up to date.

Too bad this isn’t a solution for users who aren’t willing to install an untrusted kernel binary build, provided by a random user, on their system 😦 Btw. @mhofman, you didn’t report whether it also works with Docker.

@scscgit Hi, random user who set up the untrusted kernel binary builds here. 🙋‍♂️ FYI: I put a lot of effort into automating the build and release process in order to make it trustworthy for other users. All of the released binaries are created by the GitHub actions of that repository. You can verify that the binaries on the releases page are uploaded by github-actions and not by me:

Image

If you’re still uncertain, though, you are able to build the kernel yourself using the steps from the GitHub action. You can even [build the necessary Docker image yourself]. Everything you need is in that repo.

It’s incredible that after more than 2 years this problem is still there … and nobody seems to care or work to solve it. Microsoft please wake up.

If it is the same problem as in the issues #8696 and #6982 then I would like to shed some light - it is being collectively solved in this thread and talked with Microsoft already.

Meanwhile, you can make a test using custom WSL kernel to check if that solves this issue for you (and, of course, report to that thread also).

P.S. this issue is since late 2019 😃

Have you try to update wsl with wsl --update

WSL stuck because of lxssmanager lxssmanager stuck at stopping

So how to shut stuck lxssmanager? Answer here https://stackoverflow.com/a/70567544

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.

For me the CPU usage for vmmem is more like 90% when this occurs. Seems to be related to something like network changes or docking station connect/disconnect or laptop sleep.

Too bad this isn’t a solution for users who aren’t willing to install an untrusted kernel binary build, provided by a random user, on their system 😦 Btw. @mhofman, you didn’t report whether it also works with Docker.

@scscgit Hi, random user who set up the untrusted kernel binary builds here. 🙋‍♂️ FYI: I put a lot of effort into automating the build and release process in order to make it trustworthy for other users.

Thank you very much for your efforts!

However, I believe the sentiment is: Why hasn’t @microsoft et al pushed a fix vs. a non-Microsoft open-source contributor @carlfriedrich ? MS could easily verify your solution generally works to solve the issue (and hopefully give you credit…) but as of now, 2 and a half years after this issue opened, there’s been very little activity on pushing a solution to this problem.

updated to latest wsl prerelease. issue seems to be gone now.

I said that too early, issue still present.

I’ve been experiencing the same issue for a whle now. I keep checking different threads to see if there’s an actual fix and not just killing wslservice.exe.

What do we need to do to even get some acknowledgement?

I don’t think it’s as simple as a low memory thing as one user suggested - 16GB isn’t pushing limits but I wouldn’t say it’s low.

I’ve got 32GB of RAM, DDR4 and DDR5 laptops and I’m facing this issue, especially when waking from sleep.

This is a relatively recent issue (in the last year) as I was not experiencing this in 2021 and 2022 on Windows 10 and early releases of Windows 11.

Happening quite often recently after starting to use IntelliJ Remote Development with WSL

taskkill /f /im wslservice.exe

helped

Even if the process-killing workaround always worked, they require elevated rights, and this is a multiuser operating system which are promoted and sold to companies that buy is believing that normal daily work is possible without those elevated rights.

No, it’s possible, and MS doesn’t seem to care much, and those companies that are buyers also don’t seem to be interested. Let’s face the fact: decision maker don’t have clue these days.

Too bad this isn’t a solution for users who aren’t willing to install an untrusted kernel binary build, provided by a random user, on their system 😦 Btw. @mhofman, you didn’t report whether it also works with Docker.

People who still see this problem: is it the same as discussed in this comment: https://github.com/microsoft/WSL/issues/6982#issuecomment-2294892954? I applied the workaround mentioned there and earlier in this thread (https://github.com/microsoft/WSL/issues/8529#issuecomment-2229045217) and have not since seen the problem after 4 months. I am using Windows 10 (that problem is supposed to be fixed in Windows 11 22H2) and WSL2 without Docker (I don’t know if the workaround works with Docker).

The workaround involves installing a patched WSL2 kernel as described here. As you know, the WSL2 kernel is normally the same for all your distros, so it should work for all types (I use Alma9, and occasionally ancient versions CentOS7 and Ubuntu 20.04).

When was the last response by anyone at Microsoft in this thread?

I use WSL all day at work, it was the deciding factor in me requesting a Windows laptop over Mac. I am still running into this issue multiple times a week. I have a quick batch file

taskkill /f /im wslservice.exe
ubuntu config --default-user jared

(the 2nd line because the first seems to always reset the default user to root) that I run when it happens, which usually works. But this at the least forces me to quit everything I was working on and reopen all my terminals, and sometimes the wsl command still just hangs and does nothing afterwards.

In short, this is a constant timewaster for me (and it seems like many others) and it seems like we should at least be getting occasional updates from the developers or at least just an acknowledgement that they are aware it is still an issue and they are working on it.

Just posting to confirm, this is still an issue as of January 2024. Every time hibernate is used with WSL running, which is often due to having a Docker instance open.

Usually using

wsl --shutdown

will resolve the issue, after waiting a few minutes, but not always. Sometimes the command gets fully stuck and nothing happens even after half an hour.

These commands:

taskkill /f /im wslservice.exe
taskkill /f /im wslservice.exe
taskkill /f /im wslhost.exe
taskkill /f /im wsl.exe
wsl --shutdown
Get-Service LxssManager | Restart-Service

are not a panacea either. For many users, the issue is going to be with a WSL instance used by their Docker instance, which means, they will have Vmmem be stuck non-responsive and causing full CPU load. The taskkill commands will be ineffective then, at least we observe this on our machines. The wsl --shutdown, like mentioned, will sometimes not finish and become stuck and Get-Service LxssManager | Restart-Service will just keep repeating WARNING: Waiting for service 'LxssManager (LxssManager)' to stop....

The second most reliable way I observe is wsl --shutdown, the only absolutely reliable is restarting the machine. This is simply awful.

benhillis commented “officially” (?) earlier this year but it’s hard to notice that response in the huge number of replies (some of which are auto-collapsed): https://github.com/microsoft/WSL/issues/8529#issuecomment-1460463871

Annoyingly this happens for me pretty much anytime I hibernate without forgetting to shut down wsl first.

WSL version: 1.2.5.0 Kernel version: 5.15.90.1 WSLg version: 1.0.51 MSRDC version: 1.2.3770 Direct3D version: 1.608.2-61064218 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.19045.3570

Hi, happily reporting that I’ve not experienced this issue anymore for long over a month now on latest Windows 11 release. My current OS build is 22621.2283. Using WSL 2 for daily work, sleeping and hibernating in the end of working day and resuming back the other day. Always leaving my Windows Terminal with WSL session opened.

I’ve been experiencing the issue heavily for long time before while on Windows 10 and shortly even after I upgraded my laptop in-place to Windows 11. I always had to taskkill the wslservice.exe proccess due to post-resume terminal freezes before. After some of the updates received during summer period, the issue disappeared completely for me. This is pure luck, I have not registered any note from Microsoft about potential fix of this issue while applying the updates.

I found a combo of killing all the wsl services and then restarting LxssManager service managed to get it working. In an admin powershell session:

taskkill /f /im wslservice.exe
taskkill /f /im wslhost.exe
taskkill /f /im wsl.exe
wsl --shutdown
Get-Service LxssManager | Restart-Service

Don’t know if it’ll work for everyone but it worked for me

Thanks, this quote was helpful for my case. The problem was that LxssManager service was hanging in stopping process. The attempt to kill LxssManager service in services.msc during stopping process didn’t work for me. So, I found the LxssManager service under Service Host: Local System in taskmanger and killed it. And then, I restarted LxssManager service in services.msc and wsl command came back to normal.

Unfortunately workarounds like this doesn’t help with those of us who do not have local admin with company issued workstations, let alone suggesting to “upgrade” to Windows 11.

try running wsl --update 3 times in a row in a cmd.exe session after a clean reboot.

disabling wayland seems to help. Create a file named .wslconfig in your user’s directory with this content:

[wsl2]
guiApplications=false

THIS DOES NOT WORK, SORRY

I got myself a Surface Pro X with SQ2 and I set up a brand new WSL installation. This happens every time after hibernate and is 100% reproducible. Windows 11 Pro 22H2.

FWIW, wslservice.exe never seems to have been running for me but trying to start wsl several times resulted in various wsl.exe and wslhost.exe processes running. Killing those processes and then running wsl --shutdown is–tentatively–what seems to have worked for me:

taskkill /f /im wsl.exe
taskkill /f /im wslhost.exe
wsl --shutdown

in case it matters:

>_ Get-ComputerInfo | select OsName, OsBuildNumber | Format-List

OsName        : Microsoft Windows 11 Pro
OsBuildNumber : 22621

I hope the following helps Microsoft to permanently solve the issue.

I executed wsl.exe --system -e top and I left the window open until the issue occurs again.

This is now frozen but reveals some high cpu for these two:

    • /usr/bin/weston --backend=r+
    • /usr/bin/Xwayland :0 -r+

image

@tricodon workaround is the one I am still using. Big thanks to you @tricodon !!!

Same here @ddonov, when docker desktop is running and notebook awakes from sleep.

My workaround is to kill the wslservice.exe in a admin powershell: taskkill /f /im wslservice.exe

Facing same issues, Couldn’t end process (vmmem) from task manager, it says access denied, also powershell command to taskkill also says process not found.

Same here @ddonov, when docker desktop is running and notebook awakes from sleep.

My workaround is to kill the wslservice.exe in a admin powershell: taskkill /f /im wslservice.exe

This worked for me. Thanks a lot! Previously I would do a hard reset.

Hey, new to this thread (which looks like it’s been going on for a long time!). I was facing the same issue where wsl --shutdown will hang in powershell. I tried taskkill /f /im wslservice.exe as well which did stop the task, but didn’t resolve the issue. Finally, tried opening up a recent project I was working on WSL in VS Code, and it just connected to WSL! wsl --shutdown also worked instantly in powershell afterwards. Might be useful as a temporary fix if it works for you!

This workaround worked for me.

got same issue at the end of 2024

This issue is stills happens to me, updating to the latest version generally fixes it but it does keep coming back.

WSL version: 2.1.5.0
Kernel version: 5.15.146.1-2
WSLg version: 1.0.60
MSRDC version: 1.2.5105
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.4170

I managed to use wsl --shutdown a few times. However this time, it (vmmem) hangs completely. The command of @AbdElRahmanMostafa1 also does nothing. Everyday, after my laptop comes back from sleep or hibernate, I have to pray it doesn’t hang these processes and waste my time. edit: when trying to kill the “vmmem” process, I get “Access Denied”.

Did you run as administrator? If not search for powershell, press right click and run as adminstrator Then run this command: taskkill /f /im wsl.exe

Yes, I mostly use command line tools as admin, still got access denied when killing vmmem. I ended up killing all wsl processes in task manager; this action then killed vmmem.

You don’t need to kill vmmem but just wslservice.exe. Killing wslservice.exe terminate all wsl.exe and vmmem

Seems to happen to me some time after hibernation as well (not immediately, but after a few hours).

I create logs and found this: grafik It happens not only after hibernation, but after hibernation you get it 100%

I run into this often enough that I added a function to my PowerShell profile. So far, every time I’ve run this it has resolved the issue. I try to stop/exit Docker Desktop before running this.

# https://github.com/microsoft/WSL/issues/8529
function Stop-Wsl {
    param(
        [switch]$Force = $false
    )

    if (!$IsWindows) {
        Write-Warning 'WSL can only be stopped from Windows'
        return
    }

    if ($Force) {
        $currentPrincipal = [Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()
        if (-NOT $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
            throw 'Requires Administrator. To force WSL shutdown, need to run taskkill, which requires elevated permissions.'
        }

        taskkill /f /im wsl.exe
        taskkill /f /im wslhost.exe
        taskkill /f /im wslservice.exe
    }

    wsl --shutdown

    if ($Force) {
        taskkill /f /im wslservice.exe
    }
}

WSL2 Hanging Solution . Windows 10 Pro 22H2

  1. Settings (Home).

  2. Apps.

  3. Search for ‘SubSystem’.

  4. Click the Penguin head. Click 'Advanced Options’ hyperlink. A new page appears, Windows Subsystem For Linux. WSL2_Hang_solution

  5. Scroll down that page Click Terminate and the two Reset buttons, Repair and Reset. Note: Terminate goes dark grey during termination, then goes light grey when done. Repair and Reset have blue dots rotating around circle. WSL2_Hang_solution2

  6. Restart WSL2, directly, or from an app within the Ubuntu folder on the windows start menu.

Big guess but, I think it may be something to do with the windows sandbox feature? Make sure you install the latest Windows 10 optional updates . A fix might appear one day.

Same issue. Fixed by taskkill /f /im wslservice.exe


WSL version: 1.0.0.0 Kernel version: 5.15.74.2 WSLg version: 1.0.47 MSRDC version: 1.2.3575 Direct3D version: 1.606.4 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22621.900

Same here @ddonov, when docker desktop is running and notebook awakes from sleep. My workaround is to kill the wslservice.exe in a admin powershell: taskkill /f /im wslservice.exe

ERROR: The process “wslservice.exe” not found

This workaround doesn’t work for me either but wsl --shutdown does (taking a minute or so to complete)

Same here @ddonov, when docker desktop is running and notebook awakes from sleep. My workaround is to kill the wslservice.exe in a admin powershell: taskkill /f /im wslservice.exe

ERROR: The process “wslservice.exe” not found

did you start powershell as admin?

yes

Unfortunately that doesn’t solve the problem. I am not really interested in improving the performance. When it works, it works fine, it just keeps crashing. ‘less frequent’ ≠ never, so this really doesn’t do much to fix the issue

Are you also using docker desktop?

It seemed to me that my problems started with docker desktop 4.42, searching on Docker issues someone talked about problems with the resource saver, disabling it yesterday WSL did not crash all day.

Today an even more specific issue was created (docker/for-win#14827), try disabling the docker resource saver to see if WSL stops crashing.

Ciao

Thank you for sharing this. This was 100% my issue and turning off the Resource Saver fixed it for me. I wasn’t even running any containers yet the resource saver was making WSL crash/hang for me.

Docker works perfectly. I looked at how that binary was created, and it’s the CI system that generated it from the original commit of the kernel that my version of Windows was using, with a single commit reverted, so I didn’t bother recreating it.

People who still see this problem: is it the same as discussed in this comment: #6982 (comment)? I applied the workaround mentioned there and earlier in this thread (#8529 (comment)) and have not since seen the problem after 4 months. I am using Windows 10 (that problem is supposed to be fixed in Windows 11 22H2) and WSL2 without Docker (I don’t know if the workaround works with Docker).

The workaround involves installing a patched WSL2 kernel as described here. As you know, the WSL2 kernel is normally the same for all your distros, so it should work for all types (I use Alma9, and occasionally ancient versions CentOS7 and Ubuntu 20.04).

This should be quoted as solution / workaround in the original report! It absolutely works. I had been suffering from hangs when sleeping / hibernating and using the patched kernel solved it. Anyone still reporting experiencing this issue, find your matching kernel with the patch and configure wsl2 to use it. If you’re still having issues after that, it may be a separate problem.

So if I understand right, if you use this feature on MS’s multiuser operating system, then the only solution that avoids restarting the whole OS is to be an administrator on that multiuser operating system. In 2024. And they don’t handle it as prio 1. And they don’t say they’re just kidding while selling this product.

I am having a freeze in Powershell after running wsl --shutdown command. WslLogs-2024-08-13_21-21-25.zip

Oh interesting I have a junction point for my wsl home folder under my windows profile directory, which would effectively do the same damage as mounting it to a letter (maybe worse)

Please help! I can’t stand it anymore!!!

Otherwise I prefer buy a MacBook!!

Still happening image

WSL version: 2.1.5.0 same issue, happens when computer wakes up from sleep and VSCode immediately tries to connect to remote WSL distro.

Manually killing all instances of wsl.exe works as a workaround.

I had the latest release version (2.0.14) installed [*], which was giving the same trouble, so I tried upgrading with:

wsl --update --pre-release

That gave me 2.1.1. I haven’t run with this long enough to see if the problem reoccurs, so will report back later.

[*] PS. I assumed 2.0.14 is the latest release version because wsl --update doesn’t upgrade further, and it is listed as such on the GitHub releases page. Would using 2.0.15 be better than going all the way to 2.1.1?

I am also facing the same issue since many months.

I have also tried “wsl --update”. It updated to latest version but the problem is still there.

I could get it working again by…

net stop lxssmanager
REM damn, it doesn’t work, so let’s kill this manually
sc queryex lxssmanager
REM shows the PID, here 7800
wmic process where ProcessID=7800 delete
net start lxssmanager

Unfortunately, for the last step I had to manually open an admin cmd, the others worked from my normal one.

This is not a solution!

It also killed my perfectly working WSL1 session, which I had to restart by hand, losing all state.

No wonder this issue is more than a year old, was attempted to be closed without solving, and no one is still listening, it is Microsoft. I have been a mac user but had to shift to windows (that too without administrator user). Created Linux containers to work and now hitting this issue. Without Administrator access, rebooting the windows is the only option. Have tried everything but nothing works. Is there a way I can restart “Windows Subsystem for Linux Service” by a non-admin user? At least would save myself from rebooting my laptop.

wsl --version WSL version: 1.2.5.0 Kernel version: 5.15.90.1 WSLg version: 1.0.51 MSRDC version: 1.2.3770 Direct3D version: 1.608.2-61064218 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.19044.3324

Just adding, that this issue still needs addressing

This looks a common issue which is not yet fixed. Even if I open the wsl from windows terminal and it remains idle for some time , it just freezes. Same case if I open wsl directly. ( I am using wsl2 )

I found a combo of killing all the wsl services and then restarting LxssManager service managed to get it working.

In an admin powershell session:

taskkill /f /im wslservice.exe
taskkill /f /im wslhost.exe
taskkill /f /im wsl.exe
wsl --shutdown
Get-Service LxssManager | Restart-Service

Don’t know if it’ll work for everyone but it worked for me

Works when the service is start to hanging, but not after computer sleeps. But it’s better than nothing ¯\(ツ)/¯ Thanks!!

wsl hanging is the worst thing that could happen to me.

Every process that I use is tied with wsl. Everytime the wsl dies, I have to either restart it by wsl --shutdown or worse, restart my machine. After the restart, I’m required to restart kubernetes service, docker daemon, port-forwards, setup terminal processes (listeners to the port-forwards), setup proxies, etc. Not to mention, vscode refuses to re-connect after wsl is rebooted. Gotta close and open all the vscode projects too.

Speaking conservatively, I’ve been facing this issue 4-5 times a day. I won’t be lying if I say that I’ve faced this issue more than 12 times in a day too. Which is bizarre.

I was having this issue as well and the following worked for me.

  1. From cmd run optionalfeatures.exe
  2. This will open a window of optional windows features. Scroll down to “Windows Subsystem for Linux” and uncheck it and then click “Ok”.
  3. Reboot
  4. Open cmd again and run optionalfeatures.exe again
  5. Scroll down and re-check “Windows Subsystem for Linux” and click “Ok”
  6. Reboot again. During this reboot a small/quick windows update will occur

I had to reinstall the Ubuntu distro but since then I have not had the hanging wsl issue.

Thank you very much! I didn’t even have to reinstall the distro, it works fine! (but you do have to reboot twice).

Related: stackoverflow.com/q/70567543/100836

Thank you very much zakimirza88, this solved the issue for me, at least temporarily. What I noticed is that the LxssManagerUser_xxxxxx service was not running, and stopping it after fixing it seems to reproduce it. If you’re using Docker Desktop, do what the answer says and kill every docker process (including the service). Also run wsl --update to ensure you’re on the latest WSL version. I’ll reproduce the answer below by Renato Prado:

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.

The above worked for me

Having exactly this issue (WSL freezing, only Taskkill/Taskmanager + Lxss service restart helps) since getting new PC with Win 11 couple of months ago.

I found a workaround which works at least for me: if I keep both WSL1 and WSL2 shells open in terminal, this $#!@ does NOT happen. If I forget to do it, WSL hangs next time I leave my PC idle for couple of hours. (I use both WSL1 and 2).

Maybe this will help someone.

Similar issue, in my case this happens 100% of time when waking up the computer from sleep. This is happening since a Windows and/or WSL update 1-2 months back. The only solution which works (apart from restarting Windows) is: taskkill /f /im wslservice.exe . Docker Desktop then prompts me to restart it. It’s really annoying as I have to reopen all my console windows and VS Code.

WSL version: 1.0.3.0 Kernel version: 5.15.79.1 WSLg version: 1.0.47 MSRDC version: 1.2.3575 Direct3D version: 1.606.4 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22623.1037

Distributor ID: Ubuntu Description: Ubuntu 22.04.1 LTS Release: 22.04 Codename: jammy

If I go in to task manager and end it it fixes it. But as it stands now wsl is an 8nteresting toy but not actually useful for anything.

Stop closing this.

To all those affected here, as this is already closed.

I can’t reproduce on my work laptop, but can reproduce on both my weak, ‘personal’ laptops.

Work machine has 64GB Ram and personal laptops have 16GB (Yeah, I know).

Worse when multiple instances of vscode are running under WSL. If everyone here has low-ish memory, this could be the culprit.

I am having the issue regardless the availability of RAM, currently having this issue non-stop on a Lenovo T14s with 48GB of RAM and gen 12 i7-1280P CPU. I do not expect that being underpowered is the root of this issue…

+1 this issue occurs for me on a new SP9 SQ3 on 22H2 22621.755 in debian bullseye on WSL2 with the systemctl flag enabled in wslconfig.

WSL hangs when I stop a docker container. I then need to restart wsl but wsl --shutdown hangs.

only rebooting or taskkill /f /im wslservice.exe seems to fix it.

Issue should not be closed @craigloewen-msft hello friend can you help us? If there’s anything I can do to share more info on how to reproduce please let me know. Thanks and big shoutout to you folks working on WSL, it TOTALLY ROCKS ❤️

note that on that thread above there is now a new docker version that fixes the issue apparently:

The 4…43.0 dev version of Docker Desktop fixed it for me.

Grazie @bessone! This seems to have fixed my issue with WSL which was hanging after a few minutes. Seeing your comment, it seems to have been whenever the resource saver started (5 mins).

I am facing a similar issue but it is not related to my PC going to sleep.

WSL2 will simply crash at random times, even when I am connected to WSL in VSCode.

A wsl --shutdown will fix the issue (until it inevitably happens again!) and I do not appreciate having to restart WSL, close and reopen my editors and restart Docker multiple times every day.

wsl --update tells me that I am on the most recent version of WSL.

Is this something that is ever going to be investigated / fixed? It appears that this issue has been going on for almost 2 years now, with little to no support from Microsoft themselves.

U can try to optimize the performance of wsl -

  • Create a separate disk partition for the wsl image
  • Exclude the drive with wsl from windows security. It will make WSL 10X faster.
  • Use docker natively in wsl rather than using wsl as backend for docker-desktop

These thing have make my wsl bit faster and those issues start coming less frequent

Hey, new to this thread (which looks like it’s been going on for a long time!). I was facing the same issue where wsl --shutdown will hang in powershell. I tried taskkill /f /im wslservice.exe as well which did stop the task, but didn’t resolve the issue. Finally, tried opening up a recent project I was working on WSL in VS Code, and it just connected to WSL! wsl --shutdown also worked instantly in powershell afterwards. Might be useful as a temporary fix if it works for you!

Somewhat ironically… the only machine I am having this issue on… is a microsoft surface 🤦‍♀ M$FT can’t even make this work with sleep on their own devices lol.

wsl.exe dmesg

[    1.349572] clocksource: Switched to clocksource tsc
[    2.169143] misc dxg: dxgk: dxgkio_is_feature_enabled: Ioctl failed: -22
[    2.182711] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    2.183785] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    2.184162] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    2.184933] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -2
[    2.187688] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    2.188421] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    2.189034] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    2.189466] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    2.189816] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -2

WSLg apps will randomly freeze, and CANNOT be killed. When this happens wsl --shutdown is no long effective, and requires a full restart.

It’s insanely frustrating, and wastes so much time every week.

The taskkill command from further up in the thread has saved me all my restarts. When wsl freezes, I run that command, and open wsl again. No more reboots necessary.

I can’t believe this issue is still opening after 3 years. MS awesome

This process is eating up 16GB of memory without anyway of killing it, just awesome!

I want to use remote ssh service ,so I modified .wslconfig, and all wsl commands hang as described. Since I changed some options in .wslconfig and everything seems to be OK.

[wsl2]
#memory=24GB
networkingMode=mirrored
#dnsTunneling=true
#firewall=true
#autoProxy=false

[experimental]

#autoMemoryReclaim=gradual
hostAddressLoopback=true
#ignoredPorts=22
#sparseVhd=true

I think firewall=true is the problem.

baterja dixit:

It might be important: I hibernate my laptop and rarely restart.

Nah, happens to me on a device that’s always running (though a laptop, it’s placed in a switch room at the office, I only use it remotely).

Aaron Holmes dixit:

Do you map network drive in explorer? Delete it now!

Crazy - this seems to actually have “fixed” it for me. When it gets

Huh.

I did have an old share in the NET USE list, which was unavailable though. I deleted it, let’s see whether it will still show up.

No mounting or junction-pointing WSL; in fact, I use almost nothing of the Windows side of this machine (other than the occasional vsdevcmd and nmake in cmd) as it’s just to port and test software, my main access is ssh’ing into the WSL 1 (which is stable and hasn’t triggered the issue), from there cmd when needed, from there switch to WSL 2 with ‘wsl -d Debian’ (I’ve the stock Ubuntu as WSL 1 and a new Debian instancde as WSL 2). Or RDP when necessary, but I prefer to avoid that.

Do you map network drive in explorer? Delete it now!

Crazy - this seems to actually have “fixed” it for me. When it gets stuck, I can net use /delete ..., close all terminals (and VSCode), run wsl --shutdown, then open a new terminal and everything is back to normal.

Can you clarify what is meant by “map network drive in explorer”?

Mathieu Hofman dixit:

I have traced most of my CPU usage to[…]

This is totally unrelated to the hang of the wsl command, which happens by merely having used one WSL 2 session since booting.

I managed to use wsl --shutdown a few times. However this time, it (vmmem) hangs completely. The command of @AbdElRahmanMostafa1 also does nothing.

edit: when trying to kill the “vmmem” process, I get “Access Denied”.

I have this EXACT issue

I resolved this issue by running terminal as Admin (Windows + X). However, when the memory usage became too high, it would abruptly terminate my latest command (e.g. building Angular) with message “Killed”.

Since then, I followed these instructions to increase wsl2 memory allocation. Since implementing those changes, I haven’t encountered this problem again.

So, what I do:

  1. Increased wsl2 memory
  2. Always run terminal as Admin

I’m experiencing this issue too. The only solution works for me is restarting my laptop. It’s so frustating since I need to reopen every workspace in VS Code and other apps.

It’s silly and annoying, but I can usually recover from this state with this, which I run from a batch script file. Obviously not a real fix though. 😦

start "" taskkill /F /IM wsl.exe && start "" taskkill /F /IM wslservice.exe && start "" taskkill /F /IM wslhost.exe && start "" taskkill /F /IM wslrelay.exe
start "" taskkill /F /IM wsl.exe && start "" taskkill /F /IM wslservice.exe && start "" taskkill /F /IM wslhost.exe && start "" taskkill /F /IM wslrelay.exe
start "" taskkill /F /IM wsl.exe && start "" taskkill /F /IM wslservice.exe && start "" taskkill /F /IM wslhost.exe && start "" taskkill /F /IM wslrelay.exe
start "" taskkill /F /IM wsl.exe && start "" taskkill /F /IM wslservice.exe && start "" taskkill /F /IM wslhost.exe && start "" taskkill /F /IM wslrelay.exe
start "" taskkill /F /IM wsl.exe && start "" taskkill /F /IM wslservice.exe && start "" taskkill /F /IM wslhost.exe && start "" taskkill /F /IM wslrelay.exe

I managed to use wsl --shutdown a few times. However this time, it (vmmem) hangs completely. The command of @AbdElRahmanMostafa1 also does nothing. Everyday, after my laptop comes back from sleep or hibernate, I have to pray it doesn’t hang these processes and waste my time. edit: when trying to kill the “vmmem” process, I get “Access Denied”.

Did you run as administrator? If not search for powershell, press right click and run as adminstrator

Then run this command: taskkill /f /im wsl.exe

Yes, I mostly use command line tools as admin, still got access denied when killing vmmem. I ended up killing all wsl processes in task manager; this action then killed vmmem.

I managed to use wsl --shutdown a few times. However this time, it (vmmem) hangs completely. The command of @AbdElRahmanMostafa1 also does nothing. Everyday, after my laptop comes back from sleep or hibernate, I have to pray it doesn’t hang these processes and waste my time.

edit: when trying to kill the “vmmem” process, I get “Access Denied”.

Did you run as administrator? If not search for powershell, press right click and run as adminstrator

Then run this command: taskkill /f /im wsl.exe

I managed to use wsl --shutdown a few times. However this time, it (vmmem) hangs completely. The command of @AbdElRahmanMostafa1 also does nothing.

edit: when trying to kill the “vmmem” process, I get “Access Denied”.

Same here @ddonov, when docker desktop is running and notebook awakes from sleep. My workaround is to kill the wslservice.exe in a admin powershell: taskkill /f /im wslservice.exe

ERROR: The process “wslservice.exe” not found

Please run this instead: taskkill /f /im wsl.exe

Oh, this is wonderful.

I went quite a while without this issue… having used only my WSL1 system.

Now I wanted to upgrade my WSL2 system to the latest Debian point release, did so, exited the session, figured I forgot a config change I wanted to do, tried wsl -d Debian, and even wsl -l and… it hangs. This quickly.

What I do not have is the high CPU load, however, just the hanging command.

Yes +1 to the comments above, if you’re still seeing this please try upgrading to the latest WSL release version (2.0.15) and let us know if you’re still seeing the issue there. (Helps us debug!)

Is it applicable to 2.1, but I’ve got this issue yesterday with it:

$ wsl --version
WSL version: 2.1.1.0
Kernel version: 5.15.146.1-2
WSLg version: 1.0.60
MSRDC version: 1.2.5105
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.3996

Hi @craigloewen-msft,

I also wanted to add a thank you for all the users sharing their logs, work arounds, and pain points surrounding this problem.

Thanks for the investigations and news. If you are still trying to debug the issue and aren’t able to reproduce it yourself, and have some more ideas of logfiles or additional process monitoring that we could check when the system hangs up, do let us know. I’ll do my best to try to help.

Same here - this would be a killer feature of Windows for me if it were more reliable. I am anxious to get it working without having to reboot a couple of times each day.

Hi @craigloewen-msft,

I also wanted to add a thank you for all the users sharing their logs, work arounds, and pain points surrounding this problem.

Thanks for the investigations and news. If you are still trying to debug the issue and aren’t able to reproduce it yourself, and have some more ideas of logfiles or additional process monitoring that we could check when the system hangs up, do let us know. I’ll do my best to try to help.

Filip Persson dixit:

I have been following this thread for almost a year now. It has been frustrating to say the least.

Yeah.

At least it’s possible to only use WSL 1, which is better than WSL 2 anyway, to avoid this issue.

bye, //mirabilos

Infrastrukturexperte • Qvest Digital AG Am Dickobskreuz 10, D-53121 Bonn • https://www.qvest-digital.com/ Telephon +49 228 54881-393 • Fax: +49 228 54881-235 HRB AG Bonn 18196 • USt-ID (VAT): DE274355441 Vorstand: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg Vorsitzender Aufsichtsrat: Peter Nöthen

I have been following this thread for almost a year now. It has been frustrating to say the least. I updated WSL with the new beta patch which seems to have lowered the frequency of crashes somewhat, but then WSL never released any hard drive space back to the windows partition. I hopelessly tried solution to clean the virtual disk space. Eventually, I had no hard drive space left on my windows partition.

I suspect that the team that developed WSL is no longer at Microsoft and the project is bit-rotting away slowly. We have not heard anything here from Microsoft as far as I know…

Anyway, at my work we have now finally switched to apple computers. This ends WSL for my part, and I hope to never see it again.

Side note: Since the beginning, Microsoft has been developing rushed software, new frameworks to replace old ones, but never drops them. They pass the cost onto you instead (Fun fact: Bill Gates bought DOS for $70k, which was called qDOS - quick and Dirty OS. Very little has changed it seems.)

Also facing this issue. What is the process called that I need to kill in Windows Task Manager for WSL to shut down?

taskkill /f /im wslservice.exe

Says

ERROR: The process “wslservice.exe” not found.

[Edit]

Ah, I had to do:

taskkill /f /im wsl.exe

SUCCESS: The process “wsl.exe” with PID 17816 has been terminated.

Unfortunately, WSL would not come up afterwards again. So still a full reboot.

Unfortunately not yet, due to company policies i am still bound to win10

good lord, i know microsoft just trying their best, i am at this point i can choose between two things (as long as i have to use windows):

  1. everytime to shutdown wsl before suspend
  2. host a own virtual machine and to take care

Things you expect to do on a sophisticated OS, right?

Furthermore, even without using GUI applications, you might still hit relevant codepaths that that boolean value disables.

@bebbo Did you find it out by examining the ETW traces?

It is one of the tips I found during my search, e.g. here: https://www.minitool.com/news/vmmem-high-memory.html And until now I had no more hangs or vmmemwsl high cpu issues.

Since I’m using VcxSrv gui applications do still work.

THIS DOES NOT WORK, SORRY

Jakob dixit:

try running wsl --update 3 times in a row in a cmd.exe session after a clean reboot.

That sounds more like magic placebos and cargo-culting than a real solution… what should that bring, and where would that be documented…

Same issue is happening to me for last 12 months or more. I always shutdown Docker and WSL as a workaround. Then I tried to limit the allocated memory to wsl and it made some improvements but this hanging thing still occurs from time to time. Sometimes wsl doesn’t even respond to shutdown command and Docker fails to start when it happens.

Please provide a fix for this!

Isn’t anyone from Microsoft around? Who is responsible for this mess?

So I just ran into this problem again after about7 hours since I started working. None of the aforementioned security applications was doing anything. I was using Visual Studio Code via WSL. I saw that the background node.js was utilising the CPU heavily once I noticed my Windows Terminal shells becoming slow to respond to keys. I quit out of all Code windows. Node.js was gone from top and no heavy CPU load was showing within WSL2. However, this did cause Vmmem to behave again. At the moment of this writing it is stuck at 98% CPU.

First off, @andcha’s workaround did not work for me, none of the svchost entries was because of LxssManager.

At first my shells were sluggish in responding, now they do not respond at all anymore.

Trying to wsl --terminate Debian just hangs on the command prompt.

I did run the PowerShell collection script, hopefully it has some useful information. WslLogs-2023-07-27_15-38-22.zip

Also seeing this behavior. I find that it’s much more likely to hang with high disk usage. During the hang, if you open a terminal and try to use the filesystem, e.g. ls, the command will also hang indefinitely. WSL commands will not work in this state.

The issue is still apt, and still slows us down. When can this be fixed?

I was having this issue as well and the following worked for me.

  1. From cmd run optionalfeatures.exe
  2. This will open a window of optional windows features. Scroll down to “Windows Subsystem for Linux” and uncheck it and then click “Ok”.
  3. Reboot
  4. Open cmd again and run optionalfeatures.exe again
  5. Scroll down and re-check “Windows Subsystem for Linux” and click “Ok”
  6. Reboot again. During this reboot a small/quick windows update will occur

I had to reinstall the Ubuntu distro but since then I have not had the hanging wsl issue.

Had hopes this would work, but after a day or two I’m back at WSL hang issues.

Adding to the “me too”, coming from hibernate, two docker containers where producing more CPU than usual. docker-compose down removed all the containers, but the CPU load on vmmem remained, and wsl --shutdown hangs forever. In parallel. an Ubuntu Distro complete hung during apt install nodejs, cannot Ctrl-C it. Trying to open another Ubuntu Shell hangs the terminal window forever. wsl dmesg hangs forever (though I am already in the hanging wsl --shutdown). Was able to run collect-wsl-logs.ps1 but company policy forbids to upload here.

Related: https://stackoverflow.com/q/70567543/100836

Thank you very much zakimirza88, this solved the issue for me, at least temporarily. What I noticed is that the LxssManagerUser_xxxxxx service was not running, and stopping it after fixing it seems to reproduce it. If you’re using Docker Desktop, do what the answer says and kill every docker process (including the service). Also run wsl --update to ensure you’re on the latest WSL version. I’ll reproduce the answer below by Renato Prado:

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.

A permanent solution if you only care about Docker Desktop is switching to Windows Containers (Hyper-V); to switch from command line: & 'C:\Program Files\Docker\Docker\DockerCli.exe' -SwitchDaemon

In my environment, both taskkill /f /im wslservice.exe and restarting didn’t work for it. However, it’s been resolved after I updated Windows10 to latest release.

Facing same issues, Couldn’t end process (vmmem) from task manager, it says access denied, also powershell command to taskkill also says process not found.

Same problem. It’s running under a different user . Some kind of 036A94A8-1418-9295-A028AEFF305F So I can’t kill it even from Admin prompt / Admin Task Manager

taskkill /f /im wslservice.exe helped

$ wsl --version
WSL version: 1.0.3.0
Kernel version: 5.15.79.1
WSLg version: 1.0.47
MSRDC version: 1.2.3575
Direct3D version: 1.606.4
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.2604

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” `

It worked thank you!

Same issue here (after restoring from hibernate), all wsl commands including wsl --shutdown hangs (that helped previously, ~1-2 months ago), however taskkill /f /im wslservice.exe was working without reboot.

@robindegen Details please? We use vscode dev containers and having to reboot or even wsl --shutdown is killing us all slowly.

davidsr2r dixit:

I just updated Docker, might have been the issue

Not here, not using Docker.

You just need to do

wsl --shutdown

Would be nice, if that would work, tho It does not, however as was referenced by multiple people and I can confirm that as well. You are just stuck with a black shell.

The only thing that works if it happens was mentioned here: https://github.com/microsoft/WSL/issues/8529#issuecomment-1263463528

I still have the problem but I’ve realized Microsoft has no interest in actually making wsl usable. They just keep closing it.

I’ve just had some success after completely removing WSL & Linux distros, and then installing everything from the windows store (instead of using command line). Been working for 2 days now, including going to standby five times. Specifically installing ubuntu from the windows store instead of command line seems to be the main difference.

I’ve had the issue happen to me while on a machine that only ever had WSL installed through the windows store, so don’t get your hopes up too much.

@craigloewen-msft

What information can the community provide to assist in identifying the root cause?

@fayora @niekvb Hey. The team here is doing a wonderful job IMO adding updates and addressing issues in WSL. They’ve been kind enough to re-open this issue and I’m sure they’ll prioritize and get to this issue too when they have time. As developers ourselves I’m sure we can all relate!