ERROR : "System has not been booted with systemd as init system (PID 1). Can't operate."
Akshay
Posted on December 19, 2023
I encountered this error when I was setting up docker on my recently installed MXLinux machine.
This fix is likely to work on Debian-based distros.
The command was simply to check if docker service is up or not.
sudo systemctl status docker
It gave me the following error:
OR Is it really an error that needs fixing?
Try this command:
sudo service docker status
Temporary fix
I figured out a way to fix this temporarily by editing the grub command line arguments by adding the parameter
init=/lib/systemd/systemd
besides splash quite
. You can locate this on a line starting with the linux
keyword. However, this turns out to be a temporary fix. So at every reboot, I needed to repeat this procedure of adding this init parameter to the grub edit menu.
Permanent fix
A little bit of time into fixing this and I learnt that those parameters are actually referenced from the /etc/default/grub file. This file is essentially a key-value pair required to generate the desired configuration during the booting process.
From the /etc/default/grub file, the key(variable) of our attention is GRUB_CMDLINE_LINUX_DEFAULT
. This variable is passed to the kernel at boot-time. The famous quiet splash
attributes to disable the log messages and enabling the splash screen are values to this variable.
Now, we simply have to add the required library that will load the systemd process at every boot by default. Thus, we add a new attribute i.e. the path to the systemd file to the above mentioned variable as follows. Assuming quiet splash
already exist there
GRUB_CMDLINE_LINUX_DEFAULT="splash quiet init=/lib/systemd/systemd"
The final step is to reboot the system.
sudo reboot
Try the systemctl command again:
See, it works on my machine ;)
Posted on December 19, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
December 19, 2023