G. Pape
runit - minimal replacement for sysvinit
How to install runit
How to replace init
How to use dietlibc
A collection of run scripts
Dependencies and runlevels
The runit program
The runit-init program
The svwaitdown program
The svwaitup program
runit cooperates with the
daemontools package to create
a replacement for
sysvinit.
runit runs on Debian GNU/Linux sid/woody,
OpenBSD 2.9, FreeBSD 4.4. runit reportedly runs on
FreeBSD 4.3, and can easily be adapted to other unix operating
systems. If runit runs for you on any other operating system or
linux distribution, please let me know.
Warning: Replacing sysvinit or init can cause the
system's boot to fail. Make sure you are able to recover and repair your
system, for example if you run a boot loader, it should be able to pass
init=/bin/sh to the kernel.
The command runit is intended to run as Unix
process no 1, it is automatically started by the
runit-init /sbin/init-replacement
if this is started by the kernel.
runit performs the system's booting,
running and shutting down in three stages:
- Stage 1:
runit starts /etc/runit/1 and waits for it to
terminate. The system's one time initialization tasks are done here.
/etc/runit/1 has full control of /dev/console to be
able to start an emergency shell if the one time initialization tasks
fail.
- Stage 2:
runit starts /etc/runit/2 which should not return
until the system is going to halt or reboot, if it crashes, it will be
restarted. Normally, /etc/runit/2 runs
svscanboot.
In Stage 2 runit optionally handles an INT signal
(ctrl-alt-del keyboard request on Linux/i386).
- Stage 3:
If runit is told to halt or reboot the system, or the Stage 2
returns without errors, it terminates Stage 2 if it is running and runs
/etc/runit/3. The systems tasks to shutdown and halt or
reboot are done here.
These are working examples for debian woody:
/etc/runit/1,
/etc/runit/2,
/etc/runit/3.
The command runit-init is intended to
replace /sbin/init. sysvinit's command shutdown will
keep working. On *BSD systems use init 0 for system halt
and init 6 for reboot. Runlevels are not implemented in
this Unix process no 1, such can easily be done in other programs, see
Dependencies and runlevels
for an example, the amount of code in process no 1 should be minimal.
See How to install runit for installing
runit and How to replace init for
smoothly escaping from sysvinit.
If runit on linux is compiled and linked with
dietlibc it yields in a statically
linked runit binary of 14k size and this ps axuw output
on my system:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 24 20 ? S Nov22 0:01 runit
I recommend doing this; for instructions, see
How to use dietlibc.
See http://smarden.org/runit/
for recent informations.
Related links:
Gerrit Pape <pape@smarden.org>
$Id: index.html,v 1.9 2002/01/29 18:56:36 pape Exp $