DEV Community

Cover image for You Probably Don't Need systemd on WSL (Windows Subsystem for Linux)

You Probably Don't Need systemd on WSL (Windows Subsystem for Linux)

Jonathan Bowman on September 10, 2020

Most popular Linux distributions use systemd as the init system. It is like a Swiss-army knife that controls startup, shutdown, service monitoring,...
Collapse
 
pavelsosin320 profile image
PavelSosin-320

Actually, there is the solution for Debian based distro: systemd-genie. It works perfectly and enables Podman that need systemd to manage cgroups. Indeed, there are many benefits like performance!!! there are no problems except the slightly old Podman version for Ubuntu Groovy.
But it is not good for Fedora that is not Debian derived. Podman doesn't work on Fedora 33 distro without genie at all !

Collapse
 
bowmanjd profile image
Jonathan Bowman

Can you elaborate more about your comment "Podman doesn't work on Fedora 33"? That has not been my experience, as noted here.

Collapse
 
pavelsosin320 profile image
PavelSosin-320

Sorry, Podman2 can work on Fedora33. But Podman 3 works much better on Fedora 33 and 34 distro and the most important the ability to support cgroup V2 and work rootless without systemd. Is it possible? The problem of genie for Fedora has been solved and PR's for genie for many other distros have been submitted. Nobody refuses to support genie on any non-Debian distros. So, what is the problem? It works.
From my experience, the WSL networking without a full Linux networking toolset is almost impossible: Network Manager, ResolveCtl, etc, HostnameCtl are much more comfortable tools than various patch scripts invented to make WSL usable.
The last hit is the decision to support systemd-based OCI containers.

Thread Thread
 
bowmanjd profile image
Jonathan Bowman

Good arguments for systemd (especially systemd-based containers), and for genie.

Are you saying that Podman 3 does not work on your systems without systemd?

Thread Thread
 
pavelsosin320 profile image
PavelSosin-320

Podman 3 supports cgroup2 that closely tayed with systemd and utilized by CRun used in Podman 3 instead of RunC. Thisis the long story. This also scenario that I'm testing (more precisely 3.01). It must enable to use Podman by rootless users. All root scenario work OK. Rootless scenario wors too except one bug in systemd 248 for Fedora 34 that still waiting for correction.
Shortly, I'm very satisfied with genie, all *CLI's, native and well documented Linux configurations and without any scripts that I need to run manually.

Thread Thread
 
bowmanjd profile image
Jonathan Bowman

OK. It sounds like your experience with Podman 3 and cgroup2 support is very different than my own. For me, Podman 3 works flawlessly without systemd.

But it sounds like you have systemd and Podman 3 working for you, so that is good and you are satisfied. If you want to get Podman 3 working without systemd, though, feel free to ask more questions, or consult my article on the subject. Happy to help!

Collapse
 
pavelsosin320 profile image
PavelSosin-320

I still need systemd in WSL: indeed my vanilla Docker CE on CentOS7 distro can be started by simple dockerd and uses fd: Host. But systemd is not only service units. I need logs, service dependencys, etc. which are lost for me.
I aucceeded to run Podman on CentOS8 but Podman networking is far to be sutable for WSL because assumes a "normal" Linux network. Podman also lacks the basic Docker feature - plugin-management to disable network plugins.
Docker desktop simply ignores WSL networking limitations.

Collapse
 
bowmanjd profile image
Jonathan Bowman

Really good points. Thanks for thinking through this! So, users maybe don't need systemd...

Collapse
 
adimohan profile image
Aditya Mohan

Well, for those who still want systemd in WSL2, please refer to this -> github.com/DamionGans/ubuntu-wsl2-...

Collapse
 
kudostoy0u profile image
Kudos Beluga • Edited

Doesn't work anymore for recent versions of systemd, thus it is archived :(
Try github.com/arkane-systems/genie instead.

Collapse
 
krrishdhaneja profile image
Krrish Dhaneja

can you please tell me how do I install Sysvinit in Fedora(WSL)!

Collapse
 
mihalycsaba profile image
mihalycsaba
Collapse
 
xpusostomos profile image
John

I don't get it I'm afraid, your big argument that we don't need systemd, is that you can manually launch your server processes? What sort of an argument is that?

Collapse
 
bowmanjd profile image
Jonathan Bowman

Quite generous of you to call a how-to article a "big argument" -- can't say it works very well as an argument, given that WSL does now support systemd anyway. The article was originally written when systemd wasn't available in WSL distros, and still serves as a tutorial, not a rhetorical essay, for when systemd is unavailable.

Maybe I should change the title to "Systemd is not essential on WSL" now...