runit is a POSIX-compliant init system, which was designed as a replacement for SysVinit. It is the standard init system of Void Linux, and is also used by Artix Linux (besides OpenRC). The runit system is optimized for speed and code size.
runit works in three stages: Stage 1 (boot process), Stage 2 (while using the system) and Stage 3 (shutdown/reboot of the system).
- Stage 1:
At this stage runit starts
/etc/runit/1. In this script the initialization of the system is performed. There is full access to/dev/consoleto start a rescue console in case of emergency. - Stage 2:
The
/etc/runit/2script should not return a value before shutting down or rebooting the system. System services are started and controlled here. To do this, runit accesses the individual services via runsvdir. - Stage 3:
When runit is instructed to shut down the system, or the Stage 2 script exits without error, it calls
/etc/runit/3, which will terminate all Stage 2 processes still running and shut down the system.
The program runit-init is intended to replace /sbin/init. Runlevels are handled through the runsvdir and runsvchdir programs. Service dependencies are resolved automatically.