Systemd support is now available in WSL

wsl windows

Windows Subsystem for Linux is a compatibility layer developed by Microsoft to run Linux executables natively on Windows 10.

It was recently announced that WSL now supports Systemd . This new WSL update unlocks many quality-of-life features for process and service management. This includes support for snapd, allowing users to take advantage of all the tools and applications available on snapcraft.io.

The new support added to WSL from Systemd is mentioned to be especially useful for web developers who want to configure and develop service applications within WSL before deploying them to the cloud.

This means that applications that rely on Systemd for use or just easy administration can now run seamlessly in this WSL environment on Windows 10 and Windows 11.

It's worth noting that this update is specific to WSL2 , the second generation of WSL. WSL2 runs a full Linux kernel in a dedicated virtual machine , using a subset of the functionality of the Hyper-V hypervisor built into Windows. The original version of WSL was a very different tool, which did not contain a full Linux kernel.

In a blog post, Canonical provided some technical details and explained how to enable Systemd on Ubuntu in WSL. Microsoft's corresponding announcement isn't as technical, but it outlines some of the significant changes made to achieve this feature, including changes to how WSL2 works.

Systemd support required changes to the WSL architecture. Because Systemd requires PID 1, the WSL startup process initiated by the Linux distribution becomes a child process of Systemd. Furthermore, since the WSL initialization process is responsible for providing the communication infrastructure between the Linux and Windows components, changing this hierarchy required rethinking some of the assumptions made with the WSL initialization process . Additional changes also had to be made to ensure a clean shutdown and guarantee compatibility with WSLg.

It is also important to note that with these changes, Systemd services will not keep your WSL instance up. Your WSL instance will remain alive just like before. Microsoft added that this feature will not update automatically so as not to cause problems for existing users. “Since this changes the behavior of WSL on startup, we wanted to be careful when applying this change to users' existing WSL distributions. For now, you should choose to enable Systemd for a specific WSL distribution,” he said.

This change means that using WSL will be even more like using your favorite Linux distributions on a basic machine and will allow you to use software that depends on Systemd support. Here are some examples of Linux applications that depend on Systemd:

snap : a useful binary that allows you to install and manage software on Ubuntu;
microk8s – Get Kubernetes running locally on your system quickly;
systemctl : A tool that is part of Systemd and interacts with services on your Linux machine.

It could be said that support for Systemd by the Windows Subsystem for Linux was helped by the arrival of Lennart Poettering, the creator of Systemd, to the Redmond giant a few months ago (you can check the note about it at the following link ).

It is worth mentioning that Microsoft has hired several Linux developers and other prominent open source developers in recent years. Microsoft currently employs Python inventor Guido van Rossum, GNOME inventor Miguel de Icaza was employed by Microsoft in 2016 when it acquired Xamarin, Nat Friedman served as CEO of GitHub, Daniel Robbins, founder of Gentoo Linux, was employed by Microsoft Steve French works for Microsoft as a Linux CIFS/SMB2/SMB3 maintainer and a member of the Samba team. Additionally, Linux is widely deployed on Azure, Microsoft's cloud computing service.

Finally, if you are interested in learning more about this , you can consult the details of the article at the following link.


Add as preferred source in Google