So you are following some tutorial on the internet and you used a systemd command like sudo systemctl start.
To your surprise, the command produces the following error:
System has not been booted with systemd as init system (PID 1). Can't operate.
Reason: your Linux system is not using systemd
The reason is that you are trying to use the systemd command to manage services on Linux, but your system is not using systemd and (most likely) is using the classic SysV init system (sysvinit).
But how is this possible? You are using Ubuntu and the guide is also for the same Ubuntu version. Why doesn’t it work for you?
If you are running Ubuntu inside Windows using WSL, you will have SysV instead of systemd and your system will complain when you run the systemctl command (designed for Linux systems with systemd init).
How do you know which init system you are using? You can use this command to find out the name of the process associated with PID 1 (the first process running on your system):
ps -p 1 -o comm=
It should display systemd or sysv (or something like that) in the output.
How do I fix the “System has not been booted with systemd” error?
The simple answer is not to use the systemctl command. Use the equivalent sysvinit command instead.
It’s not overly complicated and both commands have somewhat similar syntax.
This table should help you.
|systemctl start service_name||service service_name start|
|systemctl stop service_name||service service_name stop|
|systemctl restart service_name||service service_name restart|
|systemctl status service_name||service service_name status|
|systemctl enable service_name||chkconfig service_name on|
|systemctl disable service_name||chkconfig service_name off|
Whichever article you use, try using equivalent commands and you will no longer see the error “System has not been booted with systemd as init system (PID 1). Can’t operate “.