简体   繁体   中英

Unable to start service with nohup due to 'INFO spawnerr: unknown error making dispatchers for 'app_name': EACCES'

I'm trying to start a service with supervisor, but I get an error saying

INFO spawnerr: unknown error making dispatchers for 'app_name': EACCES

Here's my supervisord.conf file:

[supervisord]
logfile=/tmp/supervisord.log
logfile_maxbytes=50MB   ; change these depending on how many logs
logfile_backups=10      ; you want to keep
loglevel=info
pidfile=/tmp/supervisord.pid
nodaemon=true
minfds=1024
minprocs=200

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock  socket

[program:myscript]
command= python -u /home/ubuntu/appfolder/app_name.py
autostart=true
autorestart=unexpected 
redirect_stderr=true
stdout_logfile=/var/log/app_name.log

I had the same issue - the celery sub program logs were being written in the logs subfolder under my app folder and turns out I had set the owner to www-user while I was debugging an issue with Nginx. I changed the owner of the app folder back to ubuntu ( >> whoami )

sudo chown -R ubuntu:ubuntu /var/www/myapp/

to get it to work.

The problem is the permission for the log file With the user running supervisor you can create a "logs" folder in the same path of the supervisord.conf file and change:

logfile=/tmp/supervisord.log

to

logfile=logs/supervisord.log

I get this error when running supervisord in an unprivileged Docker container, when I attempt to have supervisord run as a non-root user, using the [supervisord] [user] directive.

This caused by docker #31243 where the container is started as root then another user is created/switched-to (as per supervisord changing to non-root) and the restrictive permissions on the container's stdin/stdout/stderr via it's TTY.

My workaround is to add the non-root user to the tty group eg useradd -G tty supervisord , making-sure that you run with a tty eg docker run ... -t or Docker Compose tty: true .

I had the same issue, I recommend doing the following

  1. Add user who runs the service. user=youruser

  2. moving your log to a supervisor dir

from:

logfile=/tmp/supervisord.log

to:

logfile=/var/log/supervisor/supervisord.log

The same goes to you pid file

pidfile=/tmp/supervisord.pid >> pidfile=/var/run/supervisor/supervisord.pid 

Make both dirs

mkdir /var/run/supervisor/

mkdir /var/log/supervisor/

then change the of the dir with

chown youuser:youuser -R /var/log/supervisor/

If this dosen't work double check who can write on you log files and pid files.

ls -l /var/log/supervisor/supervisord.log

If it still dosen't work try updating you supervisor

the error info indicate your app "app_name" may read or write a file which has no privileges.

has you started supervisord with root, then switched to a specific user? in this case, you may create file in your "app_name" with owner of root, but the specific user may not have the right privileges.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM