Fix: System has not been booted with systemd as init system (PID 1). Can’t operate

Systemd and sysvinit are the two supported versions to manage the services on Linux.  Systemd controls the start-up processes using the services files, while sysvinit controls the start-up processes using the shell script. Usually, the error “System has not been booted with systemd” occurs while using the WSL on Windows. This post will provide the possible reasons and the solutions to the above-stated error with the following outcomes:

Reason: Systemd Not Supported

This problem mainly occurs in the WSL because it is not equipped with systemd utility, and thus the systemctl command doesn’t work in WSL, which can be seen in the below image:

So, this is the problem for WSL users, let’s move and find out the solutions for that problem.

Solution: Use Init Supported Commands

Let’s check in both WSL and Ubuntu (as a primary operating system or in a virtualization environment ). To check which system your operating system supports, use the appropriate command:

In WSL:

$ ps -p 1 -o comm=

In Linux:

$ ps -p 1 -o comm=


Hence, it is verified that the systemd has nothing to do with the WSL by default. 

The solution for the problem is pretty simple because there is only a command difference between WSL and other Linux. Instead of systemctl commands, use the “Sysv Init” supported commands. Let’s clear this concept using the table comparison.

PurposeSystemd Supported Commands (For Primary Linux)Sysv Init Supported Commands (For WSL)
To Start$ sudo systemctl start service_name$ sudo service service_name start
To Stop$ sudo systemctl stop service_name$ sudo service service_name stop
To Restart$ sudo systemctl restart service_name$ sudo service service_name restart
To Check Status$ sudo systemctl status service_name$ sudo service service_name status
To Enable$ sudo systemctl enable service_name 
To Disable$ sudo systemctl disable service_name 

That’s it from this guide.

Conclusion

To resolve the error “system has not booted with systemd” in linux, there are two possible solutions, either use the sysvinit commands or make the systemd available on WSL. The table of the sysvinit commands is provided here. This post has demonstrated all the possible solutions for the error “system has not been booted with systemd” in linux.