This guide will help you install systemd
to run as normal under WSL2 Debian. This will allow services like microk8s
, docker
, cockpit
and many more to just work
during a WSL session. Note: this was tested on Windows 10 Build 21H2, running Debian 11 in WSL2.
-
To enable
systemd
under WSL we require a tool calledsystemd-genie
-
Download
install-sg.sh
to a temporary location/tmp
:
cd /tmp
sudo apt-get update && sudo apt-get install wget ca-certificates
wget --content-disposition \
"https://gist.githubusercontent.com/bnhf/ec85f1f91e3096f1499f995dd60b2097/raw/53a4f8e03b8c0073f4ddf17352cd157e4bba1b60/install-sg.sh"
- Make it executable:
sudo chmod +x install-sg.sh
- Run the script:
./install-sg.sh
- Exit the WSL terminal and shutdown the WSL env:
wsl --shutdown
- To open a new WSL terminal with
systemd
enabled, run:
wsl genie -s
- Prove that it works
sudo systemctl status time-sync.target