Skip to content

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

Closed

Description

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

Activity

  1. ghost
    self-assigned this
    on Jun 20, 2022
  2. mmichal3 commented on Jun 25, 2022

    @mmichal3

    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.

  3. benhillis commented on Jun 28, 2022

    @benhillis
    Member

    Looks like something is wrong with your trace, could you please collect a trace using these instructions?
    /logs

  4. benhillis commented on Jun 28, 2022

    @benhillis
    Member

    Could you also share the output of wsl.exe dmesg?

    Thanks!

  5. ghost closed this as completedon Jul 5, 2022
  6. berzi commented on Aug 25, 2022

    @berzi

    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

  7. CarlosRosuero commented on Sep 13, 2022

    @CarlosRosuero

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

  8. pontusvision commented on Sep 14, 2022

    @pontusvision

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

  9. georcon commented on Sep 17, 2022

    @georcon

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

  10. pernsdorff commented on Sep 20, 2022

    @pernsdorff

    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

  11. rstepinski commented on Sep 20, 2022

    @rstepinski

    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.

  12. JPStrydom commented on Sep 21, 2022

    @JPStrydom

    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.

    I was literally about to comment the same thing! This issues has been driving me CRAZY!!!

    My wsl version is:

    WSL version: 0.66.2.0
    Kernel version: 5.15.57.1
    WSLg version: 1.0.42
    MSRDC version: 1.2.3401
    Direct3D version: 1.606.4
    DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
    Windows version: 10.0.22000.978
    

    Please can we reopen and address this?

  13. 336 remaining items

  14. utillity commented on Jun 1, 2025

    @utillity

    In my case WSL stopped working because the drive the .vhdx files are on was full. I solved it with these steps:

    1. use a tool (ie. treesize free - run winget install --id JAMSoftware.TreeSize.Free) to find things to delete from the affected drive
    2. terminate all wsl* processes via task-manager
    3. run wsl --shutdown to inhibit WSL to start-up and lock the vhdx files
    4. find the affected vhdx files (if you did not move them, they are here by default: %USERPROFILE%\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu.....\LocalState\ext4.vhdx)
    5. compacting the VHDX files of the WSL instances to make additional space on the drive and make sure the files are not corrupt - run diskpart (in an administrative console), then execute these commands:
    select vdisk file="%USERPROFILE%\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu.....\LocalState\ext4.vhdx"
    attach vdisk readonly
    compact vdisk
    detach vdisk
    exit
    

    after that wsl --list worked again and I could access all my images

  15. surely-you-cannot-be-sirius commented on Jun 9, 2025

    @surely-you-cannot-be-sirius

    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.

  16. bessone commented on Jun 9, 2025

    @bessone

    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.

    Same as me. it happens to me every day for a week or so, without having made any major changes on my part.

  17. nik-55 commented on Jun 9, 2025

    @nik-55

    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

  18. surely-you-cannot-be-sirius commented on Jun 9, 2025

    @surely-you-cannot-be-sirius

    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

    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

  19. bessone commented on Jun 10, 2025

    @bessone

    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

  20. chrisclapham-eightcap commented on Jun 10, 2025

    @chrisclapham-eightcap

    Grazie Riccardo Bessone (@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).

  21. utillity commented on Jun 11, 2025

    @utillity

    Sounds like if WSL runs out of resources, it crashes. in that case you can give it more resources to see if it solves the issue:

    notepad %UserProfile%\.wslconfig

    Add the following lines to the .wslconfig file (adjusting the values based on your machine):

    [wsl2]
    # Limits VM memory to use no more than 4 GB, this can be set as whole numbers using GB or MB
    memory=32GB
    # Sets the VM to use two virtual processors
    processors=16
    # Sets amount of swap storage space to 8GB, default is 25% of available RAM
    swap=16GB
    # Sets swapfile path location, default is %USERPROFILE%\AppData\Local\Temp\swap.vhdx
    # swapfile=C:\\temp\\wsl-swap.vhdx
    
  22. WowSuchRicky commented on Jun 11, 2025

    @WowSuchRicky

    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.

  23. utillity commented on Jun 11, 2025

    @utillity

    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.

  24. bessone commented on Jun 19, 2025

    @bessone

    Just released Docker Desktop 4.42.1 (https://docs.docker.com/desktop/release-notes/)

    In the changelog:

    Disabled the Resource Saver mode in WSL 2 to prevent docker CLI commands hanging in WSL 2 distros. docker/for-win#14656

  25. markbaydoun commented on Jul 9, 2025

    @markbaydoun

    I still couldn't use WSL at all nor restart it, plus trying to stop the related tasks was denied. The only thing that actually worked is this: https://medium.com/nerd-for-tech/quick-notes-on-wsl2-stuck-a9b2c129443e

  26. microsoft-github-policy-service commented on Aug 13, 2026

    @microsoft-github-policy-service
    Contributor

    This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

    Thank you!

  27. Genda1ph commented on Aug 13, 2026

    @Genda1ph

    Duly noted. Micro$lop doesn't give two shits about WSL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions