WSL Ubuntu hangs, how to restart?
Occasionally WSL hangs on Windows 10. Opening "Ubuntu" bash just hangs. Any way to restart WSL without rebooting Windows ?
I believe the most effective way today for WSL2, in Cmd Prompt / PowerShell:
wsl --shutdown
To expand on kev's answer, you need to restart the LxssManager
service. This can be done by opening Task Manager with CTRL
SHIFT
ESC
, going to the Services
tab, finding the LxssManager
service, right-clicking and selecting Restart
.
You can shut down Ubuntu by using wslconfig
(in Windows Command Prompt or PowerShell):
wslconfig /t Ubuntu
and it will start automatically next time you open a shell.
Open powershell
with admin privileges and type the below command to restart the lxxsManger
:
Get-Service LxssManager | Restart-Service
shutdown windows-service Lxss-Manager