10

I'm trying to figure out why runit will not boot or give me the status for the managed applications. Running on Ubuntu 12.04.

I created /service, /etc/sv/myapp (with a run script, a config file, a log folder and a run script inside of it). I create a symlink from /service/ to /etc/sv/myapp

When I run

sudo sv s /service/*

I get the following error message:

warning: /service/myapp: unable to open supervice/ok: file does not exist

Some of my Googling revealed that supposedly rebooting the svscan service might fix this, but killing it and running svscanboot didn't make a difference.

Any suggestions? Am I missing a step here somewhere?

Alexandr Kurilin
  • 546
  • 1
  • 8
  • 20
  • Had exactly this on Debian 10. The answer below to install `runit-systemd` fixed it for me—`runit` has no **systemd** unit file. – Dave Everitt Mar 13 '21 at 22:22

5 Answers5

4

In my case I deleted the lock and pid from the service configuration after stopping the service:

# stops the service 
sv down serviceName

# deletes the 'pid' and 'lock' files
find -L /etc/service/serviceName -type f \( -name "pid" -o -name "lock" \) -delete

# starts the service
sv up serviceName

# verify service status
sv s serviceName

It took me a while to find the solution, so I hope it helps somebody else.

alfredocambera
  • 446
  • 2
  • 12
  • 2
    Thanks for the answer. I've also learned that we can't add the log service after the service is installed to /etc/service. No amount of restarting works. Therefore, we can also stop the service, remove the symlink from /etc/service, and re-symlink it. – Tanin Dec 31 '16 at 18:56
  • Didn't know that – alfredocambera Jan 02 '17 at 18:23
3

The problem was that, at least on Ubuntu 12.04, runit services symlinks should be placed under /etc/service, not /service as per the Arch guide on Runit

Alexandr Kurilin
  • 546
  • 1
  • 8
  • 20
3

If you are running ubuntu 18.04 or higher and getting the following error

unable to open supervise/ok: file does not exist

or if the runsvdir is not showing up in "grep" output then please runit-systemd package by running the following command

sudo apt install runit-systemd

For ubuntu 18.04 all the above specified answers did not worked for me. I have then found this solution from another askubuntu question

I hope this helps

Kumaran
  • 151
  • 2
1
sudo runsv /service/run/ &

Then

sudo sv  start /service/run/

or

sudo sv  up /service/run/
chicks
  • 3,639
  • 10
  • 26
  • 36
ibroheem
  • 11
  • 1
0

Runit also has trouble starting when a service is symlinked to a directory that is mounted on a different filesystem via LVM. For example,

$ readlink -f /etc/service/my-service
/opt/my-service

$ mount
...
/dev/mapper/lvm--local-opt on /opt type ext4 (...)

$ sv once my-service
warning: my-service: unable to open supervise/ok: file does not exist

Possible solutions:

  • Unmount the filesystem from LVM
    umount /opt; lvremove /dev/mapper/lvm--local-opt
  • Move the runit service to a better location
    update-service --remove /opt/my-service; mv /opt/my-service /etc/sv; update-service --add /etc/sv/my-service