Skip to content

Instantly share code, notes, and snippets.

@juhannc
Last active June 15, 2023 07:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juhannc/ec06569a403bbec946f1e86359cadb5b to your computer and use it in GitHub Desktop.
Save juhannc/ec06569a403bbec946f1e86359cadb5b to your computer and use it in GitHub Desktop.
Kill WSL on hangup

Especially after hibernation, WSL often hangs with 100 % CPU usage. The default command wsl --shutdown also doesn't work.

The most promiment issue is microsoft/WSL#8696. The temporary solution is a small script from microsoft/WSL#8696 (comment). Copy the script (below) and run it as an administrator in Powershell. To achieve this, press Win + X followed by A. Now navigate to the scripts location and run .\killWSL.ps1.

##@REM Run via PowerShell +Admin
echo "listing all wsl tasks"
tasklist /M wsl*
echo "sending kill to wslservice"
taskkill /IM wslservice.exe /F
echo "Done. Did your fans stop spinning?"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment