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.

Recently news broke that WSL is now compatible with Systemd, this new WSL update unlocks many quality of life features for process and service management. This includes support for snapd, which allows users to take advantage of all the tools and apps 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 is worth mentioning that this update is specific to WSL2, the second generation of WSL. WSL2 run a full linux kernel on 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 is less technical, but it does describe some of the significant changes made to achieve this feature, including changing how WSL2 works.

Systemd support required changes to the WSL architecture. Because Systemd requires PID 1, the WSL startup process started on the Linux distribution becomes a child process of Systemd. Also, since the WSL initialization process is responsible for providing the communication infrastructure between 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 to ensure 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.

Arguably, support for Systemd by Windows Subsystem for Linux was aided by the arrival of Lennart Poettering, the creator of Systemd, to the Redmond giant a few months ago (you can consult the note about it In 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 knowing more about it, you can check the details of the note in the following link


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.