WSL2 distro dies when the PC is sleeping
Version
Microsoft Windows [Version 10.0.22621.382]
WSL Version
- [X] WSL 2
- [ ] WSL 1
Kernel Version
5.15.57.1
Distro Version
Ubuntu-20.04
Other Software
No response
Repro Steps
The bug is floating. Regularly, but not always, I found all WSL2 apps in the Ubuntu distro have been killed while the PC was asleep. Docker Desktop usually survives. Opened shell windows in the Ubuntu distro exit with an error status.
Expected Behavior
All apps are working when waking from sleep.
Actual Behavior
Sometimes apps are killed.
Diagnostic Logs
How to see logs right when the issue happened, without turning logs on permanently for days?
Unfortunately I don't have any more specific information to contribute either, but I've also noticed this issue in the last two weeks (have been using WSL2 for two years to date).
Sometimes on waking up Windows from sleep, all WSL tabs in Windows Terminal are still open, but WSL has stopped and all tabs are frozen. To get things going again, I have to run wsl --shutdown from PS, then wsl to start it up again. I'll keep a close eye on it to try to get some more details!
This is a separate issue from the linux clock going out of sync when Windows goes to sleep.
I am also seeing this daily on a Dell XPS15, running Windows 11 Business 21H2 (22000.1165) (Windows Feature Experience Pack 1000.22000.1165.0). For me, Windows Terminals with WSL stuff running in them hang (unresponsive to typing), VSCode using WSL "remote" environments all hang and try to reconnect to no avail. New WSL terminals fail to start (they just open a new terminal and hang).
I also see this process spinning in the Task Manager:

Also, wsl --shutdown and wsl --terminate "Ubuntu" just hang forever. A reboot (which takes ages presumably since Windows is waiting then eventually force-killing things) is the only solution for me. HELP! What is going on here? Why is it so unstable?
I have also used WSL2 for years and never seen this... Is it a Win11 thing?
While this usually happens when I wake up my laptop in the morning, I have also seen the hang happen mid-way through the day, too.
As a non-guaranteed workaround, I've disabled automatic Microsoft Store updates. I suppose they were a reason at least for some of the dies. Since that, I've updated Windows to the latest cumulative update and for a couple of weeks, I don't face this issue.
@argo-wayneb dies during the daytime work can be related to https://github.com/microsoft/wslg/issues/678
I updated Windows (11 Pro) to Version 10.0.22621 (i.e. version 22H2) (Build 22621) a few days ago and it seems to have fixed the problem for me. Interested to hear if it works for others.
I have been having this problem since I updated to "2022-11 Cumulative Update for Windows 11 Version 22H2 for x64-based Systems (KB5020044)" 3 days ago. WSL (and all applications using WSL) crash after my computer wakes from sleep and requires a full reboot.
I face this issue almost every morning with my laptop running the latest stable Windows 11. On my desktop (latest insiders builds) I do not have this issue however...
This command (elevated PS prompt) fixes it for me: taskkill /f /im wslservice.exe. Usually I have to restart apps using WSL as well (Docker, JetBrains IDEs ...).
I've been facing this issue, too, more frequently after upgrading to W11,
It requires restarting the whole pc as it does not work trying to kill the service or the process, WSL just freezes.
When trying to stop the service, it returned 1053 the service did not respond to the start or control request in a timely fashion
This also happens overnight or whenever the PC sleeps for more than 30 minutes or so.
I've just downgraded to WSL 1 in hopes it removes the issue, I will let you know if it does.
This started happening to me too last few days and now seems to happen after every night (or longer time away from the laptop). Running on a Dell XPS 17 with Win 11 21H2 22000.1696, WSL2 Ubuntu 22.04.2.
I am using Windows Terminal, have a few tabs open and everything is fine. I leave my laptop so that it sleeps or hibernate it and when logging back in the Terminal window has closed. VSCode has also lost all connection to QSL and "hangs".
If I open it it just hangs and no prompt comes up. Any wsl command in PS just hangs, the only solution is to restart the laptop (which is extremally annoying as I have a few databases and Docker containers to spin up again before I can resume work...)
Same as @thecharlesjenkins, I have two 2022-11 Cumulative Update for Windows 11 (KB5023698 and KB5022836) and the timing is about right for when this started...
EDIT: I wonder if it has some connection to Docker... If I don't have Docker running it seems as if it is not happening, and I also got a "crash" when starting a few new containers and I got [process exited with code 1 (0x00000001)] in all open tabs as the containers started up...
You can add me to the list of people with this same problem. It started a few weeks ago. While building a Linux application via WSL/Visual Studio, it will randomly hang and I have to reboot, as any powershell wsl commands just hang forever. Back in February (or maybe earlier) it was working just fine.
This will happen to me multiple times per day.
This has gotten completely out of hand!
It now terminates WSL2 several times a day, also killing Docker desktop and VSCode. Trying to restart things completely freezes the processes and only a restart will sort it.
Previously this happened after sleep or hibernate, but now it happens in the middle of working with the laptop.
I've been facing this issue, too, more frequently after upgrading to W11, It requires restarting the whole pc as it does not work trying to kill the service or the process, WSL just freezes. When trying to stop the service, it returned
1053 the service did not respond to the start or control request in a timely fashionThis also happens overnight or whenever the PC sleeps for more than 30 minutes or so.
I've just downgraded to WSL 1 in hopes it removes the issue, I will let you know if it does.
After downgrading to WSL 1, at least it shows the prompt when logging back. I might need to restart the service, but it does not hang.
I have been facing a similar issue for a couple of weeks now. Most likely linked to a windows patch as i didn't change wsl version for w while:
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.19045.3086
I usually have two instances of ubuntu 22.04 running, one using wsl1, the other wsl2. After resuming from sleep wsl2 hangs, with vmmem process using all available CPU, wsl shutdown or teminate hangs. wsl1 instance is still ok, but have to reboot to get rid of vmmem process.
seems to be a duplicate of https://github.com/microsoft/WSL/issues/6982
In my case, all the GUI applications running under WSLg die. However, the initial terminal from which they have been launch still runs. It might not be related with this issue and I should probably open a new issue.
Still, only a few weeks ago, GUI applications survived Sleep mode.
$ wsl.exe --version
WSL version: 2.0.9.0
Kernel version: 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
Can confirm same problem here. When the laptop goes to sleep wsl wont start again, this is especially annoying when docker and kubernetes build because you lose your work with building images that is stored in the WSLmem.
I have the same issue on Windows 10 pro with running wsl2. After waking the computer from sleep, wsl tends to not function properly (frozen inside terminal).
I am experiencing this problem several times a day, when and only when PC sleeps.
- Windows owned by programs like chromium, xclock never reappear after wakeup.
- new X11 programs hang, never display a window.
- emacs window disappears, and a few minutes after wakeup emacs crashes with message.
Connection lost to X server ':0'
Fatal error 6: Aborted
X11 server gets restarted automatically once it's crashed; after that X11 programs seem to start normally.
I don't know if it's relevant, but chromium makes complaints about egl during startup like:
ERR: Display.cpp:1023 (initialize): ANGLE Display::initialize error 12289: glXQueryExtensionsString returned NULL
(although seems otherwise to work for my purposes)
WSL version 2.1.5.0 Kernel 5.15.146.1-2 WSLg version 1.0.60
Same issue here with WSL 2.3.12.0
Still is happening, and a major issue.
If I start WSL and Docker is installed, then put the computer to sleep and bring it back up, the CPU usage will climb to 100% and stay stuck there. And I cannot terminate wsl as it seems to be frozen.
More than 2 years after the first report, this problem is still there. If the computer is suspended or hibernates with WSL and Docker Desktop running, WSL hangs. I can't even execute a wsl --shutdown and a reboot is needed.
@wcruz-br : if it helps, you can try rudely killing vmmem.exe in Task Manager (Details tab for processes), if the proper wsl --shutdown is stuck for too long.
I solved it uninstalling Docker for Windows. 🤷 Now I'm using "plain" Docker (CLI) and Portainer.
I solved it uninstalling Docker for Windows. 🤷 Now I'm using "plain" Docker (CLI) and Portainer.
I didn't suffer from the crashes after a few WSL2 updates, but my Docker Desktop was often causing issues instead. I installed Docker in WSL2 (Ubuntu) instead and it runs much better and uses much fewer resources now! I can easily run 10 containers at a time, while with Docker Desktop the limit was three or four...
Unfortunately Portainer is not a free product so I do everything in CLI for Docker... 😅
Unfortunately Portainer is not a free product so I do everything in CLI for Docker... 😅
You can use the community edition for free, installing it in a local container. That's what I do here. 😉
My earlier comment stands corrected - today I could not kill vmmem.exe in Task Manager (Access Denied) nor in other tools.
Killing related wsl*.exe processes was successful, except for wslservice and wslrelay that implement Windows service(s), but did not help kill vmmem. Stopping and quitting Docker Desktop (after the fact that it noticed the "Distro" going AWOL) also did not help. FWIW, in my case the distro is used not only for docker, but also for occasional Linux development.
Needless to say, wsl --shutdown hangs indefinitely (not always the case, sometimes it just takes a few minutes to stop - but took more than 10min today and my patience timer expired). When I attempt to stop/restart the "WSL Service" (in services.msc), it also tries and aborts.
Googling around, I found #8529 referenced from https://superuser.com/questions/1645056/how-can-i-stop-vmmem-process with this gem for a force-kill:
taskkill /f /im wslservice.exe
...which worked for me and instantly killed the stragglers like vmmem.exe as well as the service implementation wsl*.exe processes.
Docker and WSL terminal do start afterwards, with "0 min" uptime in the Linux environment :)
Note that other posts in that SU discussion offer more processes to try killing, or services to recycle, depending on how the Docker Desktop VM is backed (e.g. Hyper-V) which may be in scope for those who come to research this problem but may be out of scope for WSL issue/ticket.
I've never had this problem before. I've been using wsl2 for a long time. This problem started recently and the only solution that really worked for me was to create a PowerShell to run a "Keep Alive".
wsl -d $InstanceName -e bash -c "echo alive $(date)"
I put it in the Task Scheduler, running it every 4 minutes and I've never had this problem again.
It's 2025 and I'm still experiencing this issue. I had it on my x86 PC occasionally, when coming out of sleep, but now it seems worse on my new ARM PC. Pretty much every morning I have to kill WSL with taskkill /f /im wslservice.exe (nothing else works).
WSL version: 2.5.7.0
Kernel version: 6.6.87.1-1
WSLg version: 1.0.66
MSRDC version: 1.2.6074
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.26100.4652
Are there any updates on this?
I removed docker desktop and it worked as well, I'm guessing that I may be losing some features like auto port forwarding, but I think that I can configure it manually later if I need it.
I experience the same after leaving the laptop running during the night: An open terminal window was still responsive, but VSCode said it "lost connection" and new terminal sessions just showed:
Catastrophic failure
Error code: Wsl/Service/E_UNEXPECTED
Press any key to continue...
I got it working again with wsl --shutdown
Edit: I don't use Docker or Docker desktop.
I wish there was any guidance as to which logs we should be capturing to find the root cause.