Whether systemd in Linux is seen as good or bad depends on who you ask, but it’s undeniably important. Some members of the Windows Subsystem for Linux (WSL) community had even been implementing it themselves. Now, Microsoft, in partnership with Canonical, has officially integrated systemd into WSL.
Initially, systemd is not available to everyone by default, and you can disable it anytime after enabling it. Here’s what you need to know:
What is systemd?
Systemd is a suite of essential building blocks for a Linux system, providing a system and service manager that runs as PID 1 and starts the rest of the system. Many popular Linux distributions, like Ubuntu and Debian, use systemd by default.
Including systemd in WSL brings it closer to the experience of running Linux natively. It’s also required for certain tools that are now usable on WSL, such as snap, microk8s, and systemctl.
What You Need for systemd in WSL
If you’re using the in-Windows version of WSL (enabled through PowerShell and not downloaded from the Store), you won’t have systemd initially. Only users on an Insider build of Windows 11 or those using WSL from the Microsoft Store will have it, starting from version 0.67.6 and above.
Check your version by opening a PowerShell window and entering:
wsl --version
If it’s below 0.67.6, download WSL from the Microsoft Store or get the latest release from the WSL GitHub repo. All users will eventually receive systemd support. Check for updates with:
wsl --update
If you’re using Ubuntu Preview on WSL, systemd is added automatically.
How to Enable systemd
To enable systemd, you need to edit your wsl.conf
file, found within any WSL Linux distro:
- Open
wsl.conf
in a text editor (e.g., Nano):
sudo nano /etc/wsl.conf
- Add the following lines to enable systemd:
[boot]
systemd=true
- Save and exit the file (CTRL+O to save, CTRL+X to exit).
- Close your WSL session entirely:
wsl.exe --shutdown
- Re-open your Linux distro. The first boot may take a bit longer, but systemd will be running. Check its status with:
systemctl list-unit-files --type=service
Using Snap on Ubuntu on WSL
With systemd, snap now works properly on Ubuntu on WSL. This feature opens access to useful snap packages. For example, to install Nextcloud:
sudo snap install nextcloud
Find available snaps at snapcraft.io.