WSL now includes support for running systemd
inside your WSL distros. Here's how to set it up:
To set this up, you need to be running WSL version 0.67.6
or higher. You can check your WSL version by running this command under PowerShell or Command Prompt:
wsl --version
If that command fails, then you are running the in-Windows version of WSL and need to upgrade to the Store version.
This version of WSL is currently available to all users who are registered for the Windows Insiders build for starters, and then after a few weeks to ensure quality it will be made available to all users. To check for updates, run wsl --update
. If you are not a Windows Insider and want to use this immediately, you can download the latest release from the WSL Release page.
You will need to edit your wsl.conf file to ensure systemd starts on boot.
Add these lines to the /etc/wsl.conf
file of each distro where you want to enable systemd.
(requries sudo privileges eg: sudo pico /etc/wsl.conf
):
[boot]
systemd=true
And it's really just that easy!
Once this is done, close any open terminal windows and run wsl.exe --shutdown
from PowerShell to restart your WSL instances. When WSL reboots, you should have systemd
running! You can check this by using the command in your WSL terminal:
systemctl list-unit-files --type=service