Rebooting Ubuntu on Windows without rebooting Windows?
Shutdown everything: Build 18917+
wsl.exe --shutdown
Terminate specific distro: Windows 1903+
wsl.exe -t <DistroName>
Older versions
# PowerShell (admin)
Restart-Service LxssManager
# or CMD (admin)
net stop LxssManager
net start LxssManager
At an administrative PowerShell prompt: Restart-Service LxssManager
Since Windows 10 version 1803, closing all WSL terminal windows won't kill background processes by default, unless the file /var/run/reboot-required
is present. This file will be automatically created by apt on Ubuntu when an update requires a reboot, but if you want to manually reboot the subsystem, you can create the file yourself:
sudo touch /var/run/reboot-required
I haven't tested this on other distributions available in the Microsoft Store. An alternative solution is to kill all processes yourself:
sudo killall -r '.*'