ubuntu 记一种supervisor启动失败的原因

2022-11-23  乐帮网

ubuntu supervisor

迁移服务器时遇到错误:CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.
表现为supervisor启动后并没有把子进程启动起来。通过以下命令行来排查:

root@ip-172-31-35-46:/var/log/nginx# systemctl status supervisor
● supervisor.service - Supervisor process control system for UNIX
     Loaded: loaded (/lib/systemd/system/supervisor.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2022-11-21 13:20:12 UTC; 2h 13min ago
       Docs: http://supervisord.org
   Main PID: 1399 (supervisord)
      Tasks: 1 (limit: 1143)
     Memory: 14.7M
     CGroup: /system.slice/supervisor.service
             └─1399 /usr/bin/python3 /usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf

Nov 21 13:20:12 ip-172-31-35-46 systemd[1]: Started Supervisor process control system for UNIX.
Nov 21 13:20:12 ip-172-31-35-46 supervisord[1399]: 2022-11-21 13:20:12,830 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specifie>
Nov 21 13:20:12 ip-172-31-35-46 supervisord[1399]: 2022-11-21 13:20:12,835 WARN No file matches via include "/etc/supervisor/conf.d/*.conf"
Nov 21 13:20:12 ip-172-31-35-46 supervisord[1399]: 2022-11-21 13:20:12,839 INFO RPC interface 'supervisor' initialized
Nov 21 13:20:12 ip-172-31-35-46 supervisord[1399]: 2022-11-21 13:20:12,839 CRIT Server 'unix_http_server' running without any HTTP authentication checking
Nov 21 13:20:12 ip-172-31-35-46 supervisord[1399]: 2022-11-21 13:20:12,843 INFO supervisord started with pid 1399
lines 1-16/16 (END)

可以查看到关键词:CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.

依希找到原因了,首先查看配置文件:
root@ip-172-31-35-46:/var/log/nginx# vi /etc/supervisor/supervisord.conf
从里面可以找到配置目录:/etc/supervisor/conf.d/ 然后进入目录

root@ip-172-31-35-46:/var/log/nginx# cd /etc/supervisor/conf.d/
root@ip-172-31-35-46:/etc/supervisor/conf.d# ls
dotnet_vkt.cms.web.conf

看到这个配置文件了么,是我迁移服务器从另一个地方复制过来,首先呢出于安全考虑root是不可能直接远程登录的,所以上传的时候这个配置文件所有权是另一个用户的,而我们启动supervisor时却设置的是root用户,问题产生,supervisor认为它不是一个安全的文件,因为所有权不一致。解决办法也简单如下:

chown root /etc/supervisor/conf.d/dotnet_vkt.cms.web.conf

我把这个文件所有权改成root,然后再启动就解决了。

公众号二维码

关注我的微信公众号
在公众号里留言交流
投稿邮箱:1052839972@qq.com

庭院深深深几许?杨柳堆烟,帘幕无重数。
玉勒雕鞍游冶处,楼高不见章台路。
雨横风狂三月暮。门掩黄昏,无计留春住。
泪眼问花花不语,乱红飞过秋千去。

欧阳修

付款二维码

如果感觉对您有帮助
欢迎向作者提供捐赠
这将是创作的最大动力