[3 Fixes] System Has Not Been Booted With Systemd as Init System [Partition Manager]

[3 Fixes] System Has Not Been Booted With Systemd as Init System [Partition Manager]

Many people report that they have received error “System has not been booted with systemd as init system (PID 1). Can’t operate.” This error usually occurs when they run a systemd command under Linux systems.

在这里插入图片描述

The reason why this error occurs is that the Linux system is not using systemd as the init system. As we all know, the boot process of the Linux system is as follows:

Then, what is an init system? The Init system can define, manage and control the behavior of the init process. And it is responsible for organizing and running many independent or related initialization tasks, so that the computer system can enter a certain user-subscribed operating mode smoothly.

Linux systems have many init systems, such as System III, System V, Upstart, etc. But since 2015, most Linux distributions have adopted the systemd to replace those traditional init systems. In addition, the systemd is backward compatible with System V.

However, in the following two cases, systemd will not be enabled by default:

  1. You are using Linux systems in WSL (Windows Subsystem for Linux).
  2. You have skipped the init process (/sbin/init).

在这里插入图片描述

How to Solve This Issue

To solve the “System has not been booted with systemd as init system” error, I gathered 3 ways. If you are facing the same issue, you can try them one by one.

Way 1. Use Equivalent Sysvinit Command

If you run Linux systems via WSL, the Linux system will use System V init system, instead of systemd. In this case, you can’t run systemd commands, but you can run equivalent Sysvinit commands.

Tip: Command “ps -p 1 -o comm=” will help you know what init system you are using.

This table may help you.

Systemd commandSysvinit command
systemctl start service_nameservice service_name start
systemctl stop service_nameservice service_name stop
systemctl restart service_nameservice service_name restart
systemctl status service_nameservice service_name status
systemctl enable service_namechkconfig service_name on
systemctl disable service_namechkconfig service_name off

Way 2. Add /sbin/init in the Command

Modern Linux systems allow users to skip the init process. For example, if you execute command “init=/bin/bash” in bootloader How to Solve This Issue

To solve the “System has not been booted with systemd as init system” error, I gathered 3 ways. If you are facing the same issue, you can try them one by one.

Way 1. Use Equivalent Sysvinit Command

If you run Linux systems via WSL, the Linux system will use System V init system, instead of systemd. In this case, you can’t run systemd commands, but you can run equivalent Sysvinit commands.

Tip: Command “ps -p 1 -o comm=” will help you know what init system you are using.

This table may help you.

Systemd commandSysvinit command
systemctl start service_nameservice service_name start
systemctl stop service_nameservice service_name stop
systemctl restart service_nameservice service_name restart
systemctl status service_nameservice service_name status
systemctl enable service_namechkconfig service_name on
systemctl disable service_namechkconfig service_name off

Way 2. Add /sbin/init in the Command

Modern Linux systems allow users to skip the init process. For example, if you execute command “init=/bin/bash” in bootloader environment, the system will start a single-user root shell environment and no user password is required.

In this environment, all commands are executed with the default path /bin/bash. In this case, you should use /sbin/init to replace /bin/bash.

Way 3. Enable SystemD Using Scripts

To always enable systemd on WSL2, you can apply the scripts from diddledani. Click the link and it will show you how to complete that job step by step. Some people report that it works for them.environment, the system will start a single-user root shell environment and no user password is required.

In this environment, all commands are executed with the default path /bin/bash. In this case, you should use /sbin/init to replace /bin/bash.

Way 3. Enable SystemD Using Scripts

To always enable systemd on WSL2, you can apply the scripts from diddledani. Click the link and it will show you how to complete that job step by step. Some people report that it works for them.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值