23

I've installed WSL Ubuntu 20.04 LTS using wsl --install -d ubuntu.

But sometimes it stops responding and freezes when I've been in Linux for a long time.

Windows Version: 21H2. CPU virtualization, Linux subsystem, and virtual machine platform are enabled.

NotTheDr01ds
  • 28,025
iykctywub
  • 231

4 Answers4

7

Try to kill wslservice.exe (run this as administrator):

taskkill /f /im wslservice.exe

After that you can go and start wsl: wsl ~

I found this workaround here at GitHub as comment to the issue #10378.

~~

If you have to deal with this problem as often as I do, you can create a shortcut for yourself. So you can just click on the windows ("super") key and type "kill wsl" and press enter.

enter image description here

rakso
  • 171
0

Try enabling Hyper-V (if disabled) And install WSL app from Microsoft Store may help And also execute

$ sudo apt autoremove -y

Will delete unused packages that will help free disk space and also make WSL faster

And if it hanged you can execute from PowerShell

PS C:\Users\user> wsl --shutdown

To completely close it and then open taskbar search to open Ubuntu and WSL will completely restart

0

My workaround to restart WSL without rebooting Windows is to:

  1. Get the Process ID for LxssManager service (using sc queryex LxssManager)
  2. kill it using tskill.
  3. Restart WSL.

To do this run in windows cmd:

sc queryex LxssManager  |findstr "PID"

tskill <PID from previous command>

wsl

I'm on Microsoft Windows 10 Pro Version 10.0.19045.5131. I cant run any wsl commands because it freezes. I cant kill wslservice.exe. I cant stop or kill the LxssManager service (using both taskmanager and taskkill /F).

eureka
  • 143
-1

You can look to the dmesg traces when wsl will unstuck. It happend to me too and I saw there was some lock with the keystroke in bash

Edit: It happened to me recently again. I'm using wsl2 (debian) via the console of vscode and, sometimes, when I type a new command (make) everything get stuck for few seconds (and sometimes forever).

Each time it happens I see the same trace in the system logs of linux. To get this, you can write dmesg -T in the console (when it unstuck). The trace is

pts pts11: sig=22, tty->pgrp == NULL!

I still didn't find any solution to this.

Maybe you can use the same `dmesg -T command to get a hint on what happend to you

Erwan
  • 89