Enable systemd on Debian 11 in WSL 2


Enable systemd on Debian 11 in WSL 2 to run as default Init-System. This guide will show how to enable systemd using services like mariadb and apache2 or docker and many others to work during a WSL session. This was tested on Windows 11 Build 22621, running Debian GNU/Linux 11 (bullseye) in WSL 2.

What is systemd?

systemd is a collection of programs, daemons, and libraries for Linux operating systems. Its central part is the systemd init process, which serves as the first process for starting, monitoring and terminating other processes.

Enable systemd on Debian in WSL 2

$ sudo vi /etc/wsl.conf

quote you can of course choose your favorite editor, for example instead of vi maybe nano is your editor of choice.

Edit the content below in the wsl.conf file.


Next reboot the Debian in WSL session.

$ sudo reboot

you can also run the following command to terminate the Debian in the windows command prompt or in the powsershell.

C:\> wsl -t debian

where debian is the name of the wsl instance, replace it with your name.

to launch the debian use systemd in WSL ran the following command.

C:\> wsl.exe ~ -d Debian

the current status of wsl can be checked as follows.

C:\> wsl -l -v

the meaning of the parapeters are:
-l = Lists distributions
-v = Displays detailed information about all distributions

Now let’s see the status with show runtime status of units.

$ sudo systemctl status


In this guide, I’ll show you how to easily enable systemd on Debian to run as the default Init-System on WSL 2. This allows services like docker and apache2 or mariadb and many others to run during a WSL session. This was tested on Windows 11 Build 22621 running Debian GNU/Linux 11 (Bullseye) in WSL 2.

quote I found out that when Ubuntu is deployed in WSL 2, systemd is automatically enabled as the default init system. This allows like mariadb or docker and others services running in the Ubuntu WSL session.

a few more thoughts on systemd

The main criticism of systemd is its versatility. It violates the Unix philosophy of doing only one task, but doing it as well as possible. Systemd is also overly complex and error-prone. It is also criticized for having Google’s DNS and NTP server hard-coded as a fallback.

Debian systemd in WSL

The first processes start when booting, and Systemd already has a finger in the pie here in several ways. On the one hand, by controlling and organizing the entire boot process, on the other hand, by providing information later on how the started processes are doing.

systemd or System-V-Init

You have to decide for yourself whether you want to use systemd or the previous System-V-Init-Systems, but it’s useful to be able to choose one or the other and change it again at any time.

quote You might also be interested in these related post here.

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Leave a Reply

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