WSL (Windows Subsystem for Linux) has finally received support for Systemd, this comes in a few months after its creator joined Microsoft.
And this has been made possible with a partnership between Microsoft and Canonical.
In case you're curious:
systemd is a suite of basic building blocks for a Linux system. It provides a system and service manager that runs as PID 1 and starts the rest of the system.
It acts as an init system that starts up and keeps user space services in running order.
Let's see how it has been introduced to WSL.
Systemd Enhancing the WSL Experience
The main focus of introducing systemd to WSL is to improve the Linux workflow on Windows machines.
The likes of Debian, Ubuntu, Fedora, and more run systemd by default. So, this integration will now make it even more straightforward for users of those distros to conveniently do more with WSL.
Even though we have systemd-free distros available, it is not meant for everyone. So, the support for systemd on WSL makes sense.
A lot of critical Linux applications also rely on systemd to be functional. For instance, 'snap', 'microk8s' and 'LXD' are dependent on it.
The presence of systemd also makes it possible to use more tools to test and run from within Windows, resulting in a better WSL experience.
Suggested Read 📖
Here's How It Was Made Possible
The team behind WSL had to make changes to the architecture, they made the WSL init process start within the Linux distro as a child process under systemd.
Doing so enabled the WSL init process to provide the necessary foundation for communication between the Windows and Linux sub-systems, as explained in their official announcement.
They also did additional modifications to ensure a clean system shutdown by preventing systemd from keeping the WSL instance active.
You can also visit their official documentation website for more information.
Get Started With Systemd on WSL
First and foremost, you have to ensure that your system is running WSL: Version 0.67.6 or above.
You can check your WSL version by running the following command
If you are running the older version, you can update it via the Microsoft Store or by running this command.
Furthermore, if you are not a part of Windows Insiders, you can go to the WSL release page and download it to test it out.
For systemd to work on your system, you will have to edit the 'wsl.conf' file to ensure that systemd starts up on boot.
Add the following lines to make WSL run systemd on boot.
Finally, restart your WSL instance to see the changes.
Microsoft has taken a big step forward in the development of WSL with the implementation of systemd, this should result in more users being attracted to WSL.
💬 Excited to run WSL with systemd? Or do you prefer systemd-free distros?