14

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
  • 21,923
iykctywub
  • 141
  • 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. – NotTheDr01ds Mar 29 '22 at 20:17
  • Also, it probably won't matter but is this Windows 10 or 11? Both have "21H2" releases. – NotTheDr01ds Mar 29 '22 at 20:20
  • I have exactly the same issue I'm using wsl2 with ubuntu and zsh/oh-my-zsh + starship prompt
    Edition Windows 11 Pro
    Version 21H2
    Installed on ‎8/‎23/‎2022
    OS build 22000.1098
    Serial number PF3ZL4QL
    Experience Windows Feature Experience Pack 1000.22000.1098.0
    
    – laertis Oct 15 '22 at 11:06
  • 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
    • https://www.how2shout.com/how-to/how-to-reboot-wsl-windows-subsystem-linux-in-windows-10.html
    • https://superuser.com/questions/1126721/rebooting-ubuntu-on-windows-without-rebooting-windows
    – laertis Oct 15 '22 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 Jan 01 '23 at 20:34
  • FWIW, instead of reboot you should be able to kill wslservice.exe – CervEd Mar 18 '23 at 11:15
  • 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). https://superuser.com/questions/1749690/what-is-this-weird-process-i-see-in-wsl-called-plan9 – goldfishalpha Apr 13 '23 at 09:42
  • I'm seeing this too (Win 11 22h2, WSL2), but when it freezes, I don't have to reboot as others have said, I can just launch another instance. It doesn't fix the frozen instance, but I can at least resume what I was doing without any serious interruption to my workflow. – Bryan Jul 25 '23 at 15:29
  • Plain vanilla Debian instance (both 11 and 12): same thing. Just hangs for a minute, and then comes back to life. It feels exactly like when the garbage collector was triggered in the C64 BASIC to tidy up strings... – Sz. Aug 03 '23 at 21:54
  • I get this with WSL2 on Windows 10. I usually notice because everything starts running slow, and it turns out the Vmmem process is using 100% CPU. I am unable to shutdown WSL with wsl --shutdown because nothing gets a response in the terminal. The only way I can end it is by ending WSL in Task Manager, but thereafter wsl commands still don't receive any response in the Windows terminal. Only a Windows restart works. – BadHorsie Sep 04 '23 at 15:47
  • 1
    same story, restart of Windows is the only option so far. – Govind Kailas Sep 12 '23 at 22:39

1 Answers1

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