Error when adding supervisord to run via systemd

9,179

Solution 1

Your service file is specifying the wrong locations for the binaries.

In the file, change

/usr/local/bin/supervisord

To

/usr/bin/supervisord

And

/usr/local/bin/supervisorctl 

To

/usr/bin/supervisorctl 

Next, run the command systemctl daemon-reload and then systemctl start supervisord.

Solution 2

You didn't actually follow that tutorial and install the supervisor package via easy_install; it's installed from Ubuntu packages. The package already contains a systemd unit supervisor.service which you can just start. You don't need to create your own unit.

That tutorial is also pretty bad for not explaining why they have made the strange decisions they have made. I would just throw away that tutorial and use the existing supervisor unit that you already have.

Of course, I'd also just throw away supervisord because it's redundant; virtually everything it does is covered (and better) by systemd. I would also throw away whatever tutorial led you to try installing supervisord.

Share:
9,179

Related videos on Youtube

Newskooler
Author by

Newskooler

I love to ski and snowmobile. When off the mountain, I enjoy spending time surfing and bjj. All questions, answers, comments and code are from me personally, and in no way represent the opinions of my employer.

Updated on September 18, 2022

Comments

  • Newskooler
    Newskooler over 1 year

    I am trying to run supervisor from systemd and I am following this tutorial here.

    Upon creating this file /etc/systemd/system/supervisord.service with the following contents:

    [Unit]
    Description=Supervisor daemon
    Documentation=http://supervisord.org
    After=network.target
    
    [Service]
    ExecStart=/usr/local/bin/supervisord -n -c /etc/supervisor/supervisord.conf
    ExecStop=/usr/local/bin/supervisorctl $OPTIONS shutdown
    ExecReload=/usr/local/bin/supervisorctl $OPTIONS reload
    KillMode=process
    Restart=on-failure
    RestartSec=42s
    
    [Install]
    WantedBy=multi-user.target
    Alias=supervisord.service
    

    When I run it I get the following error:

    Mar 17 01:18:22 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: Started Supervisor daemon.
    Mar 17 01:18:22 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[8772]: supervisord.service: Failed to execute command: No such file or directory
    Mar 17 01:18:22 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[8772]: supervisord.service: Failed at step EXEC spawning /usr/local/bin/supervisord: No such file or directory
    Mar 17 01:18:22 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: supervisord.service: Main process exited, code=exited, status=203/EXEC
    Mar 17 01:18:22 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: supervisord.service: Failed with result 'exit-code'.
    Mar 17 01:19:04 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: supervisord.service: Service hold-off time over, scheduling restart.
    Mar 17 01:19:04 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: supervisord.service: Scheduled restart job, restart counter is at 1.
    Mar 17 01:19:04 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: Stopped Supervisor daemon.
    

    Clearly it says that there is no such directory, but is creating one actually the correct way to solve the problem?

    The reason why I am unsure is because when looking at other (I guess) similar issues (example: here), they seem to fix it differently. Also in the tutorial, it does not mention this path (the one that does not exist) anywhere else besides in the contents of supervisord.service, so I am quite confused what is happening here.

    Can anyone please explain to me or point me to something specific to read in order to solve my problem in the correct way?

    Thanks!

    UPDATE

    locate supervisord yields:

    /etc/supervisor/supervisord.conf
    /etc/systemd/system/supervisord.service
    /usr/bin/echo_supervisord_conf
    /usr/bin/supervisord
    /usr/lib/python2.7/dist-packages/supervisor/supervisord.py
    /usr/lib/python2.7/dist-packages/supervisor/supervisord.pyc
    /usr/lib/python2.7/dist-packages/supervisor/tests/test_supervisord.py
    /usr/lib/python2.7/dist-packages/supervisor/tests/test_supervisord.pyc
    /usr/share/man/man1/echo_supervisord_conf.1.gz
    /usr/share/man/man1/supervisord.1.gz
    /var/log/supervisor/supervisord.log
    

    locate supervisorctl yields:

    /usr/bin/supervisorctl
    /usr/lib/python2.7/dist-packages/supervisor/supervisorctl.py
    /usr/lib/python2.7/dist-packages/supervisor/supervisorctl.pyc
    /usr/lib/python2.7/dist-packages/supervisor/tests/test_supervisorctl.py
    /usr/lib/python2.7/dist-packages/supervisor/tests/test_supervisorctl.pyc
    /usr/share/man/man1/supervisorctl.1.gz
    
    • Nasir Riley
      Nasir Riley about 5 years
      First, run the command updatedb. Afterwards, add the output of locate supervisord and locate supervisorctl to your question.
    • Newskooler
      Newskooler about 5 years
      @NasirRiley I just added this.
    • Nasir Riley
      Nasir Riley about 5 years
      Here is documentation for supervisord: supervisord.org. Here it is for systemd: freedesktop.org/wiki/Software/systemd. You can find a lot more by Googling. The answer that I gave explains why it wasn't starting but you really don't need it for the reasons already given by Michael.
  • Newskooler
    Newskooler about 5 years
    Okay, so the ExecStart is executing supervisor from the place where it is installed. Is it a problem to be installed in /usr/bin vs /usr/local/bin?
  • Nasir Riley
    Nasir Riley about 5 years
    @Newskooler No. It doesn't matter as long as the path in the service file is the location where it is actually located and the location allows executables.
  • Newskooler
    Newskooler about 5 years
    Thank you very much for the input. I am lost myself between deciding if I should use supervisord or systemd. Could you please show me where I can read more about the two. I am considering throwing out supervisord as it seems to add more complexity for no clear reason, but I just want to find out more about it. Thanks!
  • Michael Hampton
    Michael Hampton about 5 years
    Their respective web sites might be a good start? But your sense is correct. Supervisor was written to control processes at a time when the init system was pretty primitive; it hadn't changed significantly since the 1970s! Systemd changed all that and pretty much made supervisord obsolete.
  • Nasir Riley
    Nasir Riley about 5 years
    @Newskooler Then you should have stated that and added the errors to your question so that they could have been addressed. It looks like you've decided not to use it anyway so it doesn't matter.
  • Newskooler
    Newskooler about 5 years
    You are correct and make a fair point.