Systemd may be coming to Windows Subsystem for Linux • The Register

Canonical may be working on introducing systemd to Ubuntu on Windows Subsystem for Linux (WSL), according to a post by Ubuntu Desktop Team Technical Leader Didier Roche.

Roche’s remarks were posted on the Ubuntu Desktop Team Updates two days ago. “PoC of systemd on WSL at startup of an instance,” he said, raising hopes (or fears) that the component will be introduced in a future WSL 2 update. The remark was first spotted by Phoronix.

Systemd is an optional Linux init (start-up) component for managing services and other system components, and widely used by the most popular distributions, such as Debian, Ubuntu, Suse, and the Red Hat family of Linux distros. The original WSL did not support systemd for technical reasons, starting with the fact it had its own init process.

When WSL 2 was introduced, with a new container-based model for running Linux on Windows, supporting systemd seemed feasible (Linux distros running on Micrsoft’s Hyper-V hypervisor have no problem with it) but Microsoft continued with its own init presumably for reasons related to the integration between WSL and the rest of Windows.

WSL 2 users though have frequently requested systemd support. The reasons are many and varied, but the lack of systemd does introduce friction for users familiar with other distros that include it. Canonical’s Snap packaging system depends on systemd, and since Canonical regards Snap as the future of application deployment one can understand why the company is keen to have it supported in WSL, particularly now that GUI Linux applications are supported in Windows 11.

Another problem is that users do not always realise that commands they use like systemctl, for managing services, are actually part of systemd. As far as some are concerned, this is a bug in WSL 2, in this case because an attempt to start the SSH daemon gave the error “System has not been booted with systemd as init system (PID 1). Can’t operate. Failed to connect to bus: Host is down.”

There are a number of workarounds to enable systemd on WSL 2 but an official solution would still be welcome.

It is important that systemd does not only run, but runs as PID 1, the first process in the operating system. One user has come up with genie and another with Distrod “a systemd-based meta-distro for WSL2 that allows you to install Ubuntu, Arch Linux, Gentoo and many other distros with systemd in a minute, or make your current distro run systemd”, though note that such solutions are unofficial.

Both solutions work by introducing another container. Distrod for example “is a binary that creates a simple container that runs systemd as an init process, and starts your WSL sessions within that container.” According to the author, even WSLg, for GUI desktop application support, works with Distrod. Genie, so called because it creates a systemd “bottle”, also works with WSLg but the docs state that “Linux GUI apps started from the Windows Start Menu items created by WSLg will run outside the bottle.”

Canonical is not Microsoft of course, but has worked closely with the WSL team. There is little doubt that systemd in WSL 2 is a desirable feature for many users, at least as an option, so we will be watching progress with interest. ®

Source link