Menu & Search

How to Reboot WSL (Windows Subsystem for Linux)

How to Reboot WSL (Windows Subsystem for Linux)

To reboot WSL, run wsl --shutdown to stop WSL distros then enter back into WSL as you normally would to start it back up again.

This post is a guide to help explain the process of how to reboot a Windows Subsystem for Linux (WSL) distribution on your local machine.

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/memory limits as described in MS Docs – Advanced settings configuration in WSL

In my demo below, I’m showing 2 methods for restarting installed WSL Linux distributions. The first option, running WSL commands is the most up-to-date method for restarting WSL distros:
# Restart with WSL –Shutdown Command (Preferred approach)
# Restart LxssManager Service via PowerShell

Restart WSL with WSL –Shutdown

We need to run a basic WSL command to shut down the Linux distro. First, I will list installed WSL distributions followed by the wsl --shutdown command. This will stop WSL distros running which we can verify with another list command run.

# 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

We need to Run PowerShell as Administrator (or Windows Terminal as Admin) for this.

From what I believe, the wsl --shutdown command was released later, and this LxssManager service restart is the old method. Either way, you’re probably getting what you need in the end, a disruptive stop of your WSL distros.

Run the following command in PowerShell as Admin to restart your local LxssManager service:-

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

The LsxxManager service restart has stopped the Ubuntu-20.04 distro I opened above in this post.

Other notes: We are unable to reboot from within WSL due to the lack of systemd. There are some open-source projects in the works to enable systemd or even add a GUI to manage local WSL distributions. I hope to explore it at some point in the future.

That’s all for this one. Feel free to check out my WSL Tagged blog posts for more random tips on administering WSL, or have a look at the following posts to help get more familiar with WSL:
# How to Install Windows Subsystem for Linux (WSL)
# How to Upgrade WSL from Version 1 to Version 2
# How to Change Default Linux Distro in WSL
# How to Check WSL Versions