How to Reboot WSL (Windows Subsystem for Linux)

To restart WSL simply, run wsl --shutdown to stop your WSL distros, then enter back into WSL distro as normal to start it back up again. This post contains a guide to help explain the process.

A WSL reboot might be needed if your WSL instance or app within Linux has thrown an error message, or you are changing the wslconfig file or memory limits, as described in MS Docs for WSL basic commands.

In my demo below, I’m showing 2 methods for restarting your installed WSL Linux distributions. The first and preferred option is using the wsl command, or we can restart LxssManager, or our computer.

Restart WSL

To restart WSL, run wsl --shutdown, which will stop all running distributions, and we can start it back up again by re-entering the WSL distro.

The example below shows us stopping the 2x running distros, using wsl -l -v to display what’s running:

# check wsl distros & status
wsl -l -v

# shutdown the running wsl host
wsl --shutdown

# check wsl distros & status
wsl -l -v
wsl --shutdown

The shut-down command above immediately terminates all running distributions. When we list our WSL distributions again for the second time, we see they are all ‘Stopped’.

To start up your WSL distribution, enter WSL as you would normally. That’ll be done by re-opening the Linux tab in Windows Terminal, or by running wsl to enter a new WSL session (as per your set default WSL distribution).

WSL Ubuntu

Restart LxssManager Service Using PowerShell

From what I understand, the wsl --shutdown command was released later, and this LxssManager service restart is the old method.

If you’re about to try restart this service, why not just reboot your computer, if you have random issues.

Anyhow, this is the LsxxManager service restart, running PowerShell as Admin:

# restart LxssManager service
Get-Service LxssManager | Restart-Service
WSL Restart LsxxManager

Displaying this all in one screenshot like I done above with the WSL shutdown command. The LsxxManager service restart has stopped the Ubuntu-20.04 distro.

More WSL Tips

Check out my other tips on the Windows Subsystem for Linux (WSL) by clicking the tag below!


Comments

3 responses to “How to Reboot WSL (Windows Subsystem for Linux)”

  1. Eric Avatar
    Eric

    Bookmarked, Thanks

  2. […] more useful tips on administering WSL, have a look at some of my other posts:# How to Reboot WSL (Windows Subsystem for Linux)# How to Upgrade WSL from Version 1 to Version 2# How to Change Default Linux Distro in WSL# How to […]

  3. […] your default WSL distribution. For more WSL Admin tips, check out some of my other WSL Blog posts:# How to Reboot WSL (Windows Subsystem for Linux)# How to Upgrade WSL from Version 1 to Version 2# How to Check WSL […]