1. 首页
  2. 工具软件

Ubuntu下开机自启

Ubuntu安装Supervisor

#Ubuntu安装Supervisor
apt install -y supervisor
#supervisor开机自启:
systemctl enable supervisor
# 开始运行
systemctl start supervisor

 

修复 “System has not been booted with systemd as init system “的错误。

 

如果你按照网上的一些教程,使用systemd命令,如sudo systemctl start。
令你惊讶的是,该命令的结果是这样的错误。
System has not been booted with systemd as init system (PID 1). Can’t operate.
原因:您的Linux系统没有使用systemd。
原因是你想用systemd命令来管理Linux上的服务,但你的系统并没有使用systemd,(很可能)使用的是经典的SysV init(sysvinit)系统。
但这怎么可能呢?你使用的是Ubuntu,教程也是针对同一版本的Ubuntu。为什么你不能用呢?
如果你在Windows里面用WSL使用Ubuntu,那么你的系统就会有SysV而不是systemd,当你运行systemctl命令时,你的系统就会抱怨(针对Linux系统的systemd init系统)。
如何知道你使用的是哪个init系统?你可以使用这个命令来知道与PID 1(系统上运行的第一个进程)相关联的进程名称。
ps -p 1 -o comm=
它应该在输出中显示systemd或sysv(或类似的东西)。
如何解决’System has not been booted with systemd’错误?
答案很简单,就是不要使用systemctl命令,而是使用等同的sysvinit命令。相反,可以使用对应的sysvinit命令。
这并不复杂,而且这两个命令的语法有些相似。
这张表应该可以帮助你。

1234034-20200930083230253-965519395

 

Ubuntu新版没有chkconfig命令,且安装sysv-rc-conf会报以下错误:

E: Unable to locate package sysv-rc-conf

经排查,发现是因为我配置了阿里云的源,该源没有集成sysv-rc-conf的安装包。

解决方法:

先登录root账号,然后编辑source.list文件

su
vim /etc/apt/sources.list

在末尾加入一行:

deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse

保存后,更新源的信息:

apt update

然后就可以安装了

apt install sysv-rc-conf

 

附:添加chkconfig命令

cp /usr/sbin/sysv-rc-conf /usr/sbin/chkconfig
chmod 755 /usr/sbin/chkconfig

 

参考

[Ubuntu下Supervisor的配置教程_omaidb的技术博客_51CTO博客](https://blog.51cto.com/omaidb/4118726)

[(43条消息) Linux 云服务器 sudo apt-get update Cannot initiate the connection to archive.ubuntu.com:80_柴华松的博客-CSDN博客](https://blog.csdn.net/chaihuasong/article/details/104961141)

 

发表评论

邮箱地址不会被公开。