THIS WIKI IS DEPRECATED. It is no longer being maintained. Please visit for the official documentation. If you can't find the information you're seeking, please raise an issue at


From Void Linux Wiki
Jump to navigation Jump to search

runit is the default init system used by Void Linux. runit is a suite of tools which include a PID 1 init as well as a daemontools-compatible process supervision framework, along with utilities which streamline creation and maintenance of services.

runit employs a concept of a service directory, responsible for an individual service, which is a process to monitor, and an optional log service.

Basic usage

To start, stop or restart a service, run:

# sv up service_name
# sv down service_name
# sv restart service_name

To get the current status of a service, run:

# sv status service_name

To get the current status of all enabled services, run:

# sv status /var/service/*

Enabling new services

Void Linux provides service directories for most daemons in /etc/sv/. To enable a service, create a symlink to the service directory in /var/service:

# ln -s /etc/sv/service_name /var/service/

This will automatically start the service in your current runlevel. Once a service is linked it will always start on boot and restart if it stops, unless administratively downed.

To keep a enabled service from starting automatically at boot, create a file named down in the service directory.

# touch /etc/sv/service_name/down

Disabling services

To disable a service in the current runlevel, remove the symlink to its service directory from /var/service:

# rm /var/service/service_name

Editing services

To edit a service, first duplicate its service directory under a different name:

# cp -aR /etc/sv/service_name /etc/sv/service_name_edited

The contents of the duplicated directory can then be edited as needed, for example, by using vi(1):

# vi /etc/sv/service_name_edited

After editing, the old service should then be stopped, disabled and replaced with the new one:

# sv down service_name
# rm /var/service/service_name
# ln -s /etc/sv/service_name_edited /var/service/

Void runit directories

  • /var/service — always linked to the currently active runlevel - all entries in /var/service are considered 'active' services (and by default, are started upon linking)
  • /etc/sv — directory containing subdirectories of available service files usually placed by xbps
  • /etc/runit/runsvdir — directory containing all available runlevels

Service directory layout

A service directory requires only one file, an executable named run which is expected to exec a process in the foreground. If the service directory contains a directory named log, a pipe will be opened from the output of the run process in the service directory to the input of the run process in the log directory.

Example: /etc/sv/sshd(8) service

File: /etc/sv/sshd/run
ssh-keygen -A >/dev/null 2>&1 # Will generate host keys if they don't already exist
[ -r conf ] && . ./conf
exec /usr/sbin/sshd -De $OPTS 2>&1

Note that the process shouldn't background. When a new service is created, the log and supervise folders are automatically created on first run. Another script "finish" may also be present in the service dir, which runs on shutdown/process stop. Dependent services may be directly started as such:

sv start dep_1
sv start dep_2
exec thing -D

Linking /etc/sv/sshd/ to /var/service/sshd will run the sshd process in the foreground, making sure all output (stderr, stdout) is directed to stdout, which will be piped to the log below (/etc/sv/sshd/log/run):

[ -d /var/log/sshd ] || mkdir -p /var/log/sshd
exec chpst -u root:adm svlogd -t /var/log/sshd


The runit-void package currently supports two runlevels: single and default.

  • single: it just runs sulogin(8) and the necessary steps to rescue your system.
  • default: The default run level. default runs all services linked in /var/service/ (aka multi-user).

External links