This change is only available in the Microsoft Store version of WSL version 0.67.6 and higher. You can check your version number by running
wsl --version. If that command fails then you are running the in-Windows version of WSL and need to upgrade to the Store version.
You will need to edit the wsl.conf file to ensure systemd starts up on boot.
Add these lines to the
/etc/wsl.conf (note you will need to run your editor with sudo privileges, e.g:
sudo nano /etc/wsl.conf):
And close out of the nano editor using
CTRL+S to save and
CTRL+X to exit.
With the above steps done, close your WSL distro Windows and run
wsl.exe --shutdown from PowerShell to restart your WSL instances. Upon launch you should have systemd running. You can check this with the command
systemctl list-unit-files --type=service which should show your services’ status.
Reference: Systemd support is now available in WSL!