> 文章列表 > System has not been booted with systemd as init system (PID 1). Can‘t operate.

System has not been booted with systemd as init system (PID 1). Can‘t operate.

System has not been booted with systemd as init system (PID 1). Can‘t operate.

今天想查看防火墙的状态,但是对防火墙的操作还不熟悉,网上搜到的命令是这样的systemctl status firewalld
结果输入之后出现了这样的错误
System has not been booted with systemd as init system (PID 1). Can’t operate.
然后接着去网上搜索解决错误的原因:
有博客上是systemctl没用安装,但是我尝试sudo apt install systemctl安装之后又报出了新的错误:
E: Unable to locate package systemctl
该错误的解决方法可参照:
E: Unable to locate package systemctl的解决
但是折腾了半天还是没能解决,说明可能不是没有安装systemctl的缘故。
最后,我了解到如果在Windows里面用WSL使用Ubuntu,那么系统就会有SysV而不是systemd,当运行systemctl命令时,你的系统就会出现上述的提示。
因此我们对于防火墙的操作不用systemctl。
正确的查看防火墙状态的命令可以是

service firewall status

同理,打开为

service firewall start

重启为

service firewall restart

关闭为

service firewall stop

System has not been booted with systemd as init system (PID 1). Can‘t operate.
成功