[Solved] “system has not been booted with systemd as init system”


In Linux, init is an initialization system on various Linux distributions initiated with the system startup. Various init systems, such as systemd, sysV, or Upstart, are used depending on your distribution and version.

Suppose you use a Linux distribution that relies on systemd as the init system, such as Ubuntu 18.04 or newer, Fedora, or Debian. In that case, you may encounter an error message that says, “system has not been booted with systemd as init system.” This error typically occurs when trying to run a service or command that requires systemd, but the system is not booted with systemd as the init system.

This article will outline several methods to fix this error with step-by-step commands. As a reference, we will use Ubuntu 22.04 to execute the commands. However, the commands are generic and applicable to any Linux distribution.

How to Fix “system has not been booted with systemd as init system”?

This error is usually faced on the WSL. The users try to initiate an init system incompatible with the WSL. By default, the WSL is configured on the sysV init system. For instance, we tried to start the SSH service using systemctl on a WSL system:

systemd

You can look at the error output stating that the “system has not been booted with systemd as the init system.”

To fix this, you must use the correct init system on SSL. For example, if you have to start the SSH server on the WSL, then use the following command:

$ sudo service ssh start

systemd

It is clear from the above command that using the service instead of the systemctl command has served the purpose in the WSL.

Reasons

What if the same error also occurs on Linux systems other than WSL? Here, we have listed the reasons for you:

Incorrect init System Configuration

During the installation or configuration of a Linux system, if the init system is not properly configured to use systemd as the default init system, it can result in this error. This can happen if the system is configured to use a different init system, such as SysV init or Upstart.

Bootloader is not Configured

If the bootloader, such as GRUB, is not configured correctly to boot with systemd as the init system, it can result in this error. This can happen if the bootloader configuration points to an incorrect init system or if there are conflicts between the bootloader and systemd configuration files.

Corrupted or Missing Systemd Files

If the systemd files or dependencies are corrupted, missing, or improperly installed, it can result in this error. This can happen due to hardware failures, file system issues, or other software corruption.
All these reasons refer to distinct solutions addressed in the upcoming solutions.

Solution: Switch the init System to systemd

This solution applies if you have incidentally selected the wrong init system on your Ubuntu system. First, you must display all the systemd services running on your system. Look for the “init.scope” unit, which represents the boot init system. If it is listed as “loaded” and “active,” then systemd is the current init system. However, if it shows a different init system, such as sysvinit or upstart, you must switch to systemd.

Let’s see how it can be done:

Step 1: List All Services

First, verify the current boot init system by running the following command in a terminal window:

$ systemctl list-units --type=service --all

system has not been booted

This will display a list of all the systemd services currently running on your system. Let’s say the init system is different (sysvinit or upstart); then perform the below steps to change it to systemd.

Step 2: Reboot the System

Since the init system is loaded during the boot, you must reboot your Linux system to apply the changes. Save any unsaved work and run the following command in the terminal to reboot your system:

$ sudo reboot

Step 3: Access the GRUB Menu

Press and hold the Shift key (or Esc key for some distributions) to access the GRUB menu during the boot process. If you use a UEFI-based system, you may need to press the Escape key repeatedly to display the GRUB menu.

Step 4: Replace the init System

Use the arrow keys to highlight the default boot entry and press the “e” key to edit the GRUB configuration for that entry.

system has not been booted

In the GRUB configuration, search for the line(s) that start with the “linux” or “linuxefi” keywords; and append the following parameter at the end of the line:

$ init=/lib/systemd/systemd

Now hit the Ctrl+X/F10 keys to boot with the new/updated GRUB settings.

Verify the init System

After the system boots, open a terminal window and run the following command to verify that systemd is now the init system in use:

$ systemctl list-units --type=service --all

system has not been booted

Make sure the “init.scope” unit shows as “loaded” and “active,” indicating that systemd is now the active init system.

Wrap-Up

The init system starts with the system startup and assists in managing the services on the system. Linux-based systems support various init systems, including the systemd, sysV, and Upstart. Each init system refers to a different platform on which the Linux system is being used. If your system depends on “systemd” and you are using some other init system, then your system will throw the error that you are not using the systemd as your init system.

In the end, you can now eliminate this init-based error on Linux. For more troubleshooting guides, keep visiting Linux-Genie.

Print Friendly, PDF & Email
Categories