Δύο μεγάλες εταιρείες, η Microsoft και η Canonical, συνεργάστηκαν για να προσθέσουν το systemd στο Windows Subsystem for Linux, επιτρέποντας την εγκατάσταση μεγαλύτερου αριθμού συμβατών εφαρμογών.
systemd is a Linux software application that acts as a system and service manager to initialize daemons/services at operating system startup. Systemd also supports tools that allow Linux administrators to easily manage and control these services after they are started.
As systemd is responsible for starting all other services, it runs as the first process (PID 1) created by the Linux kernel at startup. All other initial boot services are then started and managed by systemd, as shown by the process tree below from Ubuntu.
On the other side of operating systems, the WSL (Windows Subsystem for Linux) currently uses init as a system and service manager, and thus Linux applications that require systemd, such as Snap, microk8s (Kubernetes), and systemctl, do not work properly.
WSL now supports systemd
Yesterday, Microsoft and Canonical they announced that the latest version of WSL (Windows Subsystem for Linux) in Windows 11 Insider builds now supports systemd, allowing you to install applications that require this service management.
If you are running a Windows 11 Insider build, you can upgrade to WSL preview 0.67.6 or later using the command
wsl --update. Once the update is complete, you can check the installed version using the corresponding command
You should then enable systemd by booting the desired WSL Linux distribution and adding the following lines to /etc/wsl.conf:
As the /etc folder is owned by root, you must use sudo for the console editor to edit the file. For example, sudo vi /etc/wsl.conf.
It should be noted that this process must be done for each distribution you want to enable systemd.
Finally, close the WSL window and from the Windows 11 command line (Command Prompt or PowerShell), close the WSL distributions with the command
wsl.exe --shutdown and restart your Linux distribution and you will see systemd running as PID 1.
For more information on how systemd works in WSL and how it will allow you to run more applications in WSL, you can watch this video by Microsoft's Craig Loewen and Canonical's Oliver Smith.