sv-user Nov. 20, 2025

sv-user toolkit: Supervised user services with runit

Poster

Poster: sv-user

https://codeberg.org/NaitLee/sv-user

Supervised services? What’s that?

runit is a daemontools-like init. runit process supervisors are runsvdir(8) and runsv(8).

As the poster suggests, they keep programs as child processes.

The supervisor directly monitors child processes, restarting or stopping them as required/requested with sv(8).

We say such kind of services are supervised.

Hint: use htop(1) and toggle Tree view with F5, with runit-like init, you can see a beautiful process tree.

I once heared about SysV init. Is runit different from it?

SysV init is kind of traditional Unix init. Most of the cases, it works by:

Demo in shell:

sleep 60 &
echo $! >/tmp/sleep.pid
kill $(cat /tmp/sleep.pid)

In contrast to supervised service management, this doesn’t form a process supervision tree. All service processes are stray “in the background.”

User services? Are they necessary?

Think about that, everytime you want to restart some services, you enter a sudo command and enter your password, to become root.

But the services, when starting, just switch user and become non-root.

Why the hassle to become root, to manage services that are not run as root?

Hint: You may consider using doas(1) (opendoas) with user services. Examples:

# /etc/doas.conf
permit persist user as root
permit nopass keepenv user as srv
#!/bin/sh
# /home/user/.config/sv/myserver/run
exec 2>&1
[ -r ./conf ] && . ./conf
exec doas -u srv $HOME/.local/bin/myserver
ssh myhost
sv-add myserver
sv-user restart myserver
exit

systemd and OpenRC also have user service support.

You can also install manually compiled runit programs along side them, and make use of sv-user with a few tricks.

Do you hate systemd?

No.

For real init diversity, saying what’s bad about systemd is not helpful at all.

And we should do more than just listing out various init systems.

Users need freedom and functionality, not only either of them.