Supervisor error no such file

I am trying to setup a queue listener for laravel and cannot seem to get supervisor working correctly. I get the following error when I run supervisorctl reload: error: <class 'socket.error'&g...

I am trying to setup a queue listener for laravel and cannot seem to get supervisor working correctly. I get the following error when I run supervisorctl reload:

error: <class 'socket.error'>, [Errno 2] No such file or directory: file: /usr/lib/python2.7/socket.py line: 228

The file DOES exist. If try to run sudo supervisorctl I get this
unix:///var/run/supervisor.sock no such file.

I’ve tried reinstall supervisor and that did not work either. Not sure what to do here.

I’m running Laravel Homestead (Ubuntu 16.04).

Result of service supervisor status:
vagrant@homestead:~/Code$ sudo service supervisor status
● supervisor.service - Supervisor process control system for UNIX
Loaded: loaded (/lib/systemd/system/supervisor.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Thu 2016-12-22 11:06:21 EST; 41s ago
Docs: http://supervisord.org
Process: 23154 ExecStop=/usr/bin/supervisorctl $OPTIONS shutdown (code=exited, status=0/SUCCESS)
Process: 23149 ExecStart=/usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf (code=exited, status=2)
Main PID: 23149 (code=exited, status=2)

Martijn Pieters's user avatar

asked Dec 22, 2016 at 15:27

Michael's user avatar

3

You should run sudo service supervisor start when you are in the supervisor dir.

Worked for me.

answered May 2, 2019 at 11:59

Galdil's user avatar

GaldilGaldil

4695 silver badges11 bronze badges

1

2020 UPDATE

Try running sudo service supervisor start in your terminal before using the below solution. I found out that the issue sometimes occurs when supervisor is not running, nothing complicated.

I am using Ubuntu 18.04. I had the same problem and re-installing supervisor did not solve my problem.

I ended up completely removing the conf.d directory and recreating it with new configs. Make sure you back up your configurations before trying this:

  1. sudo rm -rf /etc/supervisor/conf.d/
  2. sudo mkdir /etc/supervisor/conf.d
  3. sudo nano /etc/supervisor/conf.d/my-file.conf
  4. Copy+Paste your configuration into your new file.

sudo supervisorctl reread started working again.

Community's user avatar

answered Jan 14, 2020 at 15:19

nwaweru's user avatar

nwawerunwaweru

1,5931 gold badge12 silver badges14 bronze badges

0

In Ubuntu 18.04 with distribution’s package

You probably did the same mistake as me an created the config file /etc/supervisord.conf while my service manager (systemd) was using the config file /etc/supervisor/supervisord.conf

Solutions

  • Remove the config file created

    sudo rm /etc/supervisord.conf
    
  • Move it to the correct location

    sudo mv /etc/supervisord.conf /etc/supervisor/supervisord.conf
    

Now you can run sudo supervisorctl


Why?

when you run supervisorctl it first searches for the config file located at /etc/supervisord.conf, if it’s not present, it will search for the package’s default file /etc/supervisor/supervisord.conf this is the one systemd actually runs.

Systemd always use the file /etc/supervisor/supervisord.conf regardless of the other file’s existence.

You can check which file is using systemd by running sudo systemctl status supervisor

enter image description here
You can see in the last line the command where the config file is hardcoded

answered Mar 12, 2019 at 23:03

Madacol's user avatar

MadacolMadacol

3,17833 silver badges32 bronze badges

1

I had a very similar problem (Ubuntu 18.04) and searched similar threads to no avail so answering here with some more comprehensive answers.

Lack of a sock file or socket error is only an indicator that supervisor is not running. If a simple restart doesn’t work its either 1. not installed, or 2. failing to start. In my case nothing was being logged to the supervisor.log file for me to know why it was failing until I ran the following command (-n to run in foreground) only to find out that there was a leftover configuration file for a project that had been deleted that I missed.

/usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf

Once I deleted the bad/leftover file in the conf.d folder and started it back up with sudo service supervisor start everything worked.

Here are some comprehensive steps you can take.

  1. Is supervisor installed? dpkg -l | grep supervisor If not reinstall sudo apt install supervisor
  2. Are all instances of supervisor stopped? systemctl stop supervisor Lingering supervisor processes can be found ps aux | grep supervisor then kill -9 PID.
  3. Is supervisor.conf in the right location /etc/supervisor/supervisor.conf and there are no syntax errors? Reinstall from package would correct this.
  4. Move your specific files in conf.d/ temporarily out of the folder to try and start with no additional config files. If it starts right up sudo service supervisor start the likelihood of an error in your project .conf file exists.
  5. Check status with sudo service supervisor status.
  6. Move your .conf files one by one back into conf.d/ and restart sudo service supervisor restart. Be sure to check with sudo service supervisor status between. If it fails you know which .conf file has an issue and can ask for specific help.
  7. check everything is running with supervisorctl status and if not start with supervisorctl start all.

answered Aug 14, 2020 at 20:27

Jason's user avatar

JasonJason

871 silver badge9 bronze badges

None of about answers helped me.
the problem was i didn’t follow supervisor documentation.
and a step i didn’t do was run echo_supervisord_conf command that makes the configuration file.

Steps i did for Ubuntu 18.04:

Installing supervisor (without pip):

  1. sudo apt-get install supervisor
  2. echo_supervisord_conf > /etc/supervisord.conf (with root access: first run sudo -i then echo_supervisord_conf > /etc/supervisord.conf)
  3. change python dependency to python2

(Depends: python-pkg-resources, init-system-helpers (>= 1.18~), python-meld3, python:any (<< 2.8), python:any (>= 2.7.5-5~)

in these files: /usr/bin/supervisord | /usr/bin/supervisorctl | /usr/bin/echo_supervisord_conf.
Just change the first line from #!/usr/bin/python to #!/usr/bin/python2

  1. run supervisord
  2. Finish

hope help !

answered Apr 3, 2021 at 13:28

Arash Younesi's user avatar

Arash YounesiArash Younesi

1,6011 gold badge13 silver badges22 bronze badges

Facing the python file not found an error, code=exited, status=2 once I try with the official document but still same.
I have tried so many solutions for my laravel application.

But at last, I have tried with my solution.

Here is an example for the code :

[program:dev-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html/example.com/artisan queue:work --sleep=3 --tries=3
autostart=true
autorestart=true
user=ubuntu
numprocs=8
redirect_stderr=true
stdout_logfile=/var/www/html/example.com/storage/logs/laravel.log
stopwaitsecs=3600

Ref: https://laravel.com/docs/7.x/queues#supervisor-configuration

answered Jan 19, 2021 at 12:10

Kiran Patel's user avatar

I ended up just removing supervisor entirely, reinstalling and rewriting my config files. I must have just done something wrong in the process and wasn’t able to catch it.

answered Dec 23, 2016 at 18:15

Michael's user avatar

MichaelMichael

8703 gold badges11 silver badges18 bronze badges

1

You can try by removing all of the related folder of supervisor & uninstall supervisor completely.

sudo rm -rf /var/log/supervisor/supervisord.log 
sudo rm -rf /etc/supervisor/conf.d/ 

After doing this, reinstall supervisor by

sudo apt install supervisor

Now, you can run correctly. Check with

sudo systemctl status supervisor

answered Aug 11, 2020 at 15:45

KaungThant's user avatar

If by running sudo service supervisor status you get the following:

ExecStart=/usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf (code=exited, status=2)

Try running /usr/bin/supervisord, it will give you clear message to tell you where the error is.

answered Feb 15, 2021 at 1:11

Mathiouss's user avatar

0

On Centos 7 I use the following…

supervisord -c /path/to/supervisord.conf

followed by…

supervisorctl -c /path/to/supervisord.conf

This gets rid of the «.sock file not found» error. Now you have to kill old processes using…

ps aux|grep gunicorn

Kill the offending processes using…

kill <pid>

Then again…

supervisorctl -c /path/to/supervisord.conf

Supervisor should now be running properly if your config is good.

answered May 17, 2022 at 23:50

Akonobi's user avatar

Check the supervisord.conf file.

Look for the following:

[unix_http_server]
file=/path/to/supervisor.sock/file   ; (the path to the socket file)   
chmod=0700                           ; sockef file mode(default 0700)

Go to the path mentioned above and check if the file is present.
If it is present then try re-installing supervisor.

If not then search for supervisor.sock file either using the command line or file explorer GUI.

Copy the file found in the above step to the location specified in the [unix_http_server] by using the cp command or GUI.

For me, the supervisor.sock was present in the /run folder.

Erik Kalkoken's user avatar

answered Jun 4, 2019 at 10:32

Somansh Reddy's user avatar

1

you can try

sudo touch /var/run/supervisor.sock
sudo chmod 777 /var/run/supervisor.sock

answered Jan 11, 2017 at 15:51

Fanley's user avatar

FanleyFanley

611 silver badge3 bronze badges

I ran into this issue because we were using supervisorctl to manage gunicorn. The root of my problem had nothing to do with supervisor (it was handling other processes just fine) or the python sock.py file (file was there, permissions were correct), but rather the gunicorn config file /etc/supervisor/conf.d/gunicorn.conf. This configuration file was managed by a source-controlled template with environment variables and when we updated the template on the server, the template variables were never replaced with the actual data. So for example something in the gunicorn.conf file read user={{ user }} instead of user=gunicorn. When supervisor tried to parse this config when running supervisorctl start gunicorn it would crash with this socket error. Repairing the gunicorn.conf file resolved the supervisor issue.

answered Jun 27, 2020 at 20:20

D. Erik Goodman's user avatar

Source of answer : http://supervisord.org/installing.html

  1. Run command : echo_supervisord_conf
  2. Once you see the file echoed to your terminal, reinvoke the command as echo_supervisord_conf > /etc/supervisord.conf. This won’t work if you do not have root access.
  3. If you don’t have root access, or you’d rather not put the supervisord.conf file in /etc/supervisord.conf, you can place it in the current directory (echo_supervisord_conf > supervisord.conf) and start supervisord with the -c flag in order to specify the configuration file location.

The error should’ve been resolved by now.

answered Dec 31, 2021 at 17:09

Mihir Bhatt's user avatar

Mihir BhattMihir Bhatt

2,8692 gold badges36 silver badges41 bronze badges

I did the following to solve the issue on CentOS Linux 7

sudo systemctl status supervisord.service

With the above command, I realise that the program was in active

sudo systemctl start supervisord.service

Now I use the command above to start the service and everything works well now

answered Apr 6, 2022 at 10:58

Fokwa Best's user avatar

Fokwa BestFokwa Best

3,1816 gold badges33 silver badges49 bronze badges

Kinda shocked about supervisor. I get this error

unix:///var/run/supervisor.sock no such file

What is so shocking is the file is there! I am running on ubuntu on ec2. I tired to chmod to 0777 as well.

[supervisord]
logfile=/var/log/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB       ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10          ; (num of main logfile rotation backups;default 10)
loglevel=debug               ; (log level;default info; others: debug,warn,trace)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false              ; (start in foreground if true;default false)
minfds=1024                 ; (min. avail startup file descriptors;default 1024)
minprocs=200                ; (min. avail process descriptors;default 200)

[supervisorctl]
serverurl=unix:///var/run/supervisor.sock

[include]
files = *.supervisor

asked Jan 22, 2013 at 1:23

Tampa's user avatar

TampaTampa

1901 gold badge1 silver badge5 bronze badges

2

I know this question is kinda old but for the sake of others who happen to land to this problem, starting the supervisor daemon works for me.

sudo service supervisor start

A more detailed explanation is that in general, when you encounter a «unix:///var/run/blabla.sock no such file» error, most likely the issue is that the daemon of the program in subject (supervisord in this case) wasn’t started and thus wasn’t able to generate the expected unix socket supervisor.sock file. This file is the communication endpoint for the supervisor foreground commands (such as supervisorctl) that acts as a tunnel/middleman responsible for relaying user-issued commands (ex. supervisorctl reread) to the supervisor service running in background.

You can refer to Unix Domain Socket and to this stackoverflow answer.

answered Jun 26, 2017 at 14:46

Aldee's user avatar

AldeeAldee

1312 bronze badges

this was my problem, not sure if it helps. Aparently «service supervisord start» doesn’t necessarily load your config file, or even a config file at all. In order to make mine work, I had to do a supervisord -c /path/to/my/config.conf (i.e. run the binary directly) this fixed everything.

Rui F Ribeiro's user avatar

Rui F Ribeiro

54.8k26 gold badges144 silver badges221 bronze badges

answered Mar 8, 2015 at 19:08

Ryan's user avatar

RyanRyan

1393 bronze badges

I ran into this problem recently and I fixed it by following the following processes

  • 1). Activate your your virtualenv
  • 2). Ensure supervisor is install in your virtual environment with pip
  • 3). start supervisor as a superuser: $ sudo su
  • 4). run: $ supervisord
    or $ supervisorctl start

    And that’s it.

  • answered Jun 26, 2019 at 10:23

    Eze Sunday Eze's user avatar

    Alright, after messing around some more I found what I did wrong.

    Turns out the lines for supervisorctl below, only tell supervisorctl where it can find the socket file.

    [supervisorctl]
    serverurl=unix:///var/run/supervisor.sock
    

    Further above in the file there are two other lines which define where the file is actually created:

    [unix_http_server]
    file=/tmp/supervisor.sock
    

    As you can see that created the socket file in /tmp/ while supervisorctl tried to read it from /var/run/. I changed the last line to file=/var/run/supervisor.sock and now it works beatifully.

    I hope this answer might help someone else dealing with the same trouble.

    Also, you can check out the link provided by @MariusMatutiae in the comments: https://stackoverflow.com/questions/10716159/nginx-and-supervisor-setup-in-ubuntu

    For users who have the same entry for both

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

    &

    [unix_http_server]
    file=/tmp/supervisor.sock
    

    follow below steps to fix the problem —

    1. Delete .sock file from /tmp
    2. Run ‘supervisord’ command. This will recreate the sock file.
    3. Run ‘supervisorctl -i’ to check the status of the services.

    Hope this helps you!

    After too much struggling with this issue, with everybody telling me to just enable or restart which was not working. I finally found out the solution for me:

    • First of all acknowledge that you have the main supervisor.conf file here: /etc/supervisor/supervisor.conf
    • If you are in my case, you also have a project specific .conf file in here: /etc/supervisor/conf.d/project.conf

    Somehow supervisorctl was working fine but the weird thing is that doing service supervisor restart breaks everything and you get the error of OP.

    The solution then is to:

    1. Rename project.conf to project.conf.tmp
    2. Then service supervisor restart (after what supervisorctl works again)
    3. You rename back your project conf file to project.conf
    4. supervisorctl reread, supervisorctl update, supervisorctl restart all

    Tags:

    Linux

    Ubuntu

    Daemon

    Supervisord

    Related

    Понравилась статья? Поделить с друзьями:
  • Submit canceled due to a script error please contact your system administrator перевод
  • Purchase completed error occurred blackhawk rescue mission 5
  • System error 1312 has occurred
  • Sublime text как изменить цвет фона
  • Puppeteer error timeout error