运行systemctl时报错:system has not been booted with systemd as init system
时间: 2023-09-22 18:11:49 浏览: 53
这个错误通常是因为系统不是使用systemd作为初始化系统启动的。尝试以下步骤:
1. 检查系统是否正在运行systemd:
```bash
ps -p 1 -o comm=
```
如果返回的是“systemd”,则系统正在运行systemd,否则尝试以下步骤。
2. 检查系统使用的初始化系统:
```bash
ls -l /sbin/init
```
如果返回的是“/sbin/init -> /lib/systemd/systemd”,则系统正在使用systemd,否则尝试以下步骤。
3. 重启系统并选择使用systemd作为初始化系统启动:
```bash
sudo reboot
```
在系统启动时,选择使用systemd作为初始化系统启动。
如果以上步骤都无法解决问题,可能需要进一步调查系统配置和日志以确定问题的原因。
相关问题
启动systemctl时报错:system has not been booted with systemd as init system
这个错误通常发生在使用旧版Linux发行版或操作系统时,因为它们不支持systemd作为init系统。
解决方法:
1. 升级操作系统或安装最新的Linux发行版。
2. 如果不能升级或更换操作系统,则可以使用旧版的init系统(如sysvinit或upstart)来代替systemd。要实现这一点,请编辑/boot/grub/grub.cfg文件,并在内核命令行中添加init=/sbin/sysvinit或init=/sbin/upstart。
3. 如果您不确定如何编辑grub.cfg文件,请使用以下命令来打开文件进行编辑:
sudo nano /boot/grub/grub.cfg
4. 在编辑器中,找到类似于以下内容的行:
linux /boot/vmlinuz-4.4.0-116-generic root=UUID=2d0e0c23-8f21-4b20-83d6-49f0c8c8b9fc ro quiet splash
5. 在该行的结尾处添加init=/sbin/sysvinit或init=/sbin/upstart,如下所示:
linux /boot/vmlinuz-4.4.0-116-generic root=UUID=2d0e0c23-8f21-4b20-83d6-49f0c8c8b9fc ro quiet splash init=/sbin/sysvinit
6. 保存并退出编辑器,然后重启系统。
7. 现在,当您启动systemctl时,它应该可以正常工作。
System has not been booted with systemd as init system
"System has not been booted with systemd as init system"是一个错误信息,意味着系统未使用systemd作为初始化系统。这个错误通常在WSL(适用于Linux的Windows子系统)下使用systemctl命令启动某些服务时出现。它表明在WSL环境中无法执行systemd相关的操作。
解决这个问题的一种方法是尝试使用以下命令启动服务:sudo service docker start。这将使用传统的服务启动方式来启动docker服务。
需要注意的是,WSL是一个在Windows操作系统上运行Linux环境的工具,并且与原生Linux系统有一些差异。因此,一些特定的Linux功能和命令可能在WSL中无法正常使用。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [System has not been booted with systemd as init system (PID 1). Can‘t operate.解决方法](https://blog.csdn.net/u012833399/article/details/128533933)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [基因芯片检测PTA石化废水生物分子毒性 ](https://download.csdn.net/download/weixin_38751014/12129178)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]