13

None of the systemd commands are working inside WSL( Ubuntu Bash 18.04). When I ran sudo systemctl is-active kubelet, error is output: System has not been booted with systemd as init system (PID 1). Can't operate. : running command: sudo systemctl is-active kubelet

How to enable systemd feature in WSL? Whats the way to get rid of System has not been booted with systemd

Santosh Hegde
  • 313
  • 2
  • 4
  • 8

4 Answers4

5

cron is a systemd service which you can still run in WSL. See this answer as a guide for how you might setup your kubelet application:

To expand on this link, you can modify Windows startup to load WSL with the background services minimized:

3

Nowadays you can try:

sudo service docker start

when using WSL2, if you are running on windows version 2004 or higher (I assume).

1

To run systemd inside WSL2, clone the following repo:

git clone https://github.com/DamionGans/ubuntu-wsl2-systemd-script.git

Run the cloned script:

cd ubuntu-wsl2-systemd-script
bash ubuntu-wsl2-systemd-script.sh

Restart Ubuntu shell then try running the command systemctl to make sure systemd is working.

WMRamadan
  • 111
  • 9
-1

There is a cool workaround to enable systemd in WSL. Worked for me. Please refer here

Also, for Docker, make sure you have the latest version of it installed and WSL2 is running at least on Windows version 2004. Also make sure to enable WSL2 support in Docker settings.