16

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.

11
  • 1
    When it "freezes", I assume there's no error message, right? The next time it freezes, try opening PowerShell or CMD and then run wsl ~ a second time. Does it start? If so, add the output of ps n -efH to the question. That may give you some idea what's going on. You may be able to kill <pid> the offending processes from another WSL window and get the first one to start again. Commented Mar 29, 2022 at 20:17
  • 4
    Moreover. VScode Server for wsl also hangs and says "reload window" as being unresponsive which indicates that's a wsl problem. Sometimes, opening cmd in administrator mode and issueing wsl --shutdown works but not everytime There are resources to to restart wsl - how2shout.com/how-to/… - superuser.com/questions/1126721/…
    – laertis
    Commented Oct 15, 2022 at 11:08
  • 2
    I've experienced the same thing (W11, 22H2). Seems to be tied to my laptop or desktop resuming from some form of sleep. The restart of the VM doesn't seem to be possible (wsl command just hangs elevated prompt or not) - reboot is the only one I can recover.
    – Gordon
    Commented Jan 1, 2023 at 20:34
  • 1
    @NotTheDr01ds tried your suggestion, by killing a bash script that ran an ssh session (only), and got my original terminal back. Will continue observing to see if this happens when the terminal is just sitting idle. Can confirm that the plan9 file server is not the culprit (in my case). superuser.com/questions/1749690/… Commented Apr 13, 2023 at 9:42
  • 1
    same story, restart of Windows is the only option so far. Commented Sep 12, 2023 at 22:39

3 Answers 3

1

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.

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

-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. Sometime 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

1
  • This answer needs more information before it can be considered helpful. Looking at trace messages without any guidance isn’t helpful to anyone that has this problem and doesn’t already have the knowledge to know what to look for in these messages. You should edit your answer and include that detail information. I personally don’t need help so don’t direct any responses directly towards me.
    – Ramhound
    Commented Jun 16 at 14:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .