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
cron
is asystemd
service which you can still run in WSL. See this answer as a guide for how you might setup yourkubelet
application:To expand on this link, you can modify Windows startup to load WSL with the background services minimized:
Nowadays you can try:
sudo service docker start
when using WSL2, if you are running on windows version 2004 or higher (I assume).
To run systemd inside WSL2, clone the following repo:
Run the cloned script:
Restart Ubuntu shell then try running the command
systemctl
to make sure systemd is working.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.