28

I installed Supervisor (v3.1.2) to manage ElastAlert but when I run supervisorctl it sometimes throws this error:

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

and other times it throws this error:

unix:///tmp/supervisor.sock no such file

I'll note that it does bring me to the supervisor> prompt, but commands after that are the same errors as above. The /etc/supervisor/supervisor.conf file is configured to use /var/run, which seems at odds with the second error.

I created a link to /etc/supervisor.conf, as other help pages suggested this, but it didn't make a difference.

Two odd things, when I first installed Supervisor it worked fine, but it was after a reboot this problem started. And the other odd thing is that ElastAlert starts after a reboot, and continues to perform normally. So while it might be having errors it's doing its job. Not a show-stopper, but I would like for this to work properly.

Any ideas?

4
  • 1
    Sorry if this isn't exactly on-topic, but why not just use systemd for this?
    – fuero
    Commented Oct 12, 2016 at 23:23
  • Indeed, supervisord is pretty much obsolete. Commented Oct 13, 2016 at 2:21
  • Well I did attempt to create a service, but I felt it became overwhelming for such a simple script to run.
    – Canadian
    Commented Oct 13, 2016 at 17:03
  • That's odd, because systemd units are generally quite simple. Someone's probably already written one, in fact... Commented Jan 4, 2017 at 2:25

8 Answers 8

37

This happens to me when the physical machine reboots. My machines run Ubuntu, ranging from 12.04 to 16.04. I resolve it by restarting supervisor as a service.

sudo service supervisor stop
sudo service supervisor start 

(This somehow works a lot better than simply using 'restart')

Obviously this is not an ideal fix if you depend on Supervisor to start other programs for you without needing to be restarted after every reboot. I am currently looking into systemd like others suggested.

Edit: If you are on Ubuntu 16.04, this answer might fix all your problem as it did mine. You should 'enable' systemd to start supervisord. https://unix.stackexchange.com/a/291098

2
  • 1
    This worked for me on Ubuntu 20.04 on WSL2.
    – Nick
    Commented Mar 18, 2021 at 11:23
  • 1
    Watch out if supervisor is the CMD for your docker container! (A docker container only runs while its CMD is running, so in this case shutting down supervisor would shut down the container.) Commented Sep 7, 2023 at 16:34
7

Here is in my case. Let say the error is unix:///var/run/supervisord.sock no such file when typing this command sudo supervisorctl status

So my solution is:

  1. Open supervisor config file sudo nano /etc/supervisor/supervisord.conf
  2. Check the line where serverurl of supervisorctl path pointed.
[supervisorctl]
serverurl=unix:///var/run/supervisord.sock ; use a unix:// URL  for a unix socket
  1. Change path serverurl to unix:///var/run/supervisor.sock. See the difference of supervisord and supervisor
  2. Restart supervisor service supervisor restart
  3. Check status supervisor sudo service supervisor status
  4. Check again if error is still present sudo supervisorctl status if so, try delete your config in /etc/supervisor/conf.d/ ... or reinstall supervisor
1
  • Delete stale configuration file sovled.
    – Brutal_JL
    Commented May 12, 2021 at 3:37
5

The above solutions didnt work for me the issue was more related to wrong .conf files added to supervisor.

In my case the issue came as one of the supervior managed processes didn't have its log files created or had a valid path. The way I diagnosed the issue is by :

  1. Find the command mentioned in systemctl to run the supervisor process, which was:

    systemctl -l status supervisor.service

    here the command is mentioned in line with the key "Process". Which in my case for version 3.3.1 of the supervisor was /usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf

  2. Now run the above command in your terminal. You may need to append sudo . This will show the exact reason why supervisor is not working. In my case the output of the command looked like:

enter image description here

Above message clearly showed the log file causing the error.

You can create the log file or remove the .conf file and reload supervisor to fix the issue. Command to reload the supervisor is:

sudo systemctl restart supervisor.service
1
  • I had the same issue. The path specified in stdout_logfile did not exist. Commented Jan 7 at 8:35
1

I had this problem while hosting my django app. My machine is aws=>ec2=>ubuntu 18.x

I had wrong configuration of my gunicorn bash file. when i fixed the path issue in gunicorn file. supervisor started working back.

make sure you configured it well:

DJANGODIR=/home/ubuntu/<my-project>               # Django project directory
SOCKFILE=/home/ubuntu/<my-project>/run/gunicorn.sock  # we will communicte using this unix socket
0

So I was having the same issue and I was using supervisor using a non-root user.The key is that you have to make sure supervisord service is running.To do that first find and run the supervisord.Since I was using pyenv this is the command that I ran

$ ~/.pyenv/versions/3.8.9/bin/supervisord -c ~/etc/supervisor/supervisord.conf

The supervisord.conf was created by me and placed there.

Now running the supervisorctl works perfectly fine.

$ ~/.pyenv/versions/3.8.9/bin/supervisorctl -c ~/etc/supervisor/supervisord.conf
0

I had the same error, after a reboot:

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

Apparently, after the reboot I logged in with a different user than before. When I used the same user as before (in my case this was root) everything worked fine again.

Hope this helps somebody !

0

I got this error probably because I had too little CPU/RAM. After upgrading the server, the problem went away for me.

-1

run supervisord -c /path/to/supervisord.conf

then run supervisorctl -c /path/to/supervisord.conf

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .