DEV Community

Akshay
Akshay

Posted on • Edited on

4

ERROR : "System has not been booted with systemd as init system (PID 1). Can't operate."

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
Enter fullscreen mode Exit fullscreen mode

It gave me the following error:

Error message

OR Is it really an error that needs fixing?

Try this command:

sudo service docker status
Enter fullscreen mode Exit fullscreen mode

Explain this to me

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.

/etc/default/grub file before changes

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"

/etc/default/grub file after changes

The final step is to reboot the system.

sudo reboot
Enter fullscreen mode Exit fullscreen mode

Try the systemctl command again:

Post reboot it works

See, it works on my machine ;)

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

The Most Contextual AI Development Assistant

Pieces.app image

Our centralized storage agent works on-device, unifying various developer tools to proactively capture and enrich useful materials, streamline collaboration, and solve complex problems through a contextual understanding of your unique workflow.

👥 Ideal for solo developers, teams, and cross-company projects

Learn more