If you have installed the precompiled Debian package, start at step 3.
# mkdir -p /etc/runit # cp -p /package/admin/runit/etc/debian/[123] /etc/runit/Create also a getty service directory:
# mkdir -p /etc/sv/getty-5 # cp -p /package/admin/runit/etc/debian/getty-tty5/run /etc/sv/getty-5/ # cp -p /package/admin/runit/etc/debian/getty-tty5/finish /etc/sv/getty-5/If you want runit to handle the ctrl-alt-del keyboard request, do:
# cp -p /package/admin/runit/etc/debian/ctrlaltdel /etc/runit/
# cp -p /package/admin/runit/command/runit* /sbin/
# mkdir -p /service # ln -s /etc/sv/getty-5 /service/Start runit's stage 2 for testing:
# /etc/runit/2 &And check that the getty is running.
#!/bin/sh # one time tasks /etc/init.d/kerneld start /etc/init.d/rmnologin touch /etc/runit/stopit chmod 0 /etc/runit/stopitIt is possible to just add /etc/init.d/rc 2 for having all services from the former runlevel 2 started as one time tasks, but keep the goal above in mind, supervising services has great advantages.
To migrate a service, create a service directory, disable the service if it is running, disable the service in /etc/rc.conf or remove the service startup from the /etc/rc.* scripts and tell runsvdir about the new service.
Repeat step 4 and 5, using /sbin/runit-init 6 to reboot the system, until you are satisfied with your services startup. If anything goes wrong, reboot the system into the default sysvinit /sbin/init and repair the runit stages, then start again at step 4.
# mv /sbin/init /sbin/init.sysv # ln -s runit-init /sbin/init
# init 6To report success:
# ( uname -a ; cat /etc/runit/[123] ) |mail pape-runit-2.1.2@xxiv.smarden.org
# mkdir -p /etc/runit OpenBSD 2.9: # cp -p /package/admin/runit/etc/openbsd/[123] /etc/runit/ FreeBSD 4.4: # cp -p /package/admin/runit/etc/freebsd/[123] /etc/runit/Remove the svscanboot startup from /etc/rc.local by deleting the line csh -cf '/command/svscanboot &' (this normally is the last one); runit will start runsvdir in stage 2 after running rc.local in stage 1.
# vi /etc/rc.local
# install -m0500 /package/admin/runit/command/runit* /sbin/
# mkdir -p /etc/sv/getty-5 OpenBSD 2.9: # cp -p /package/admin/runit/etc/openbsd/getty-ttyC4/run /etc/sv/getty-5/ # cp -p /package/admin/runit/etc/openbsd/getty-ttyC4/finish /etc/sv/getty-5/ FreeBSD 4.4: # cp -p /package/admin/runit/etc/freebsd/getty-ttyv4/run /etc/sv/getty-5/ # cp -p /package/admin/runit/etc/freebsd/getty-ttyv4/finish /etc/sv/getty-5/and tell runsvdir about the getty-5 service:
# mkdir -p /service # ln -s /etc/sv/getty-5 /service/Start runit's stage 2 for testing:
# /etc/runit/2 &And check that the getty is running.
Make a backup copy of the current /sbin/init program and replace it with /sbin/runit-init:
# cp -p /sbin/init /sbin/init.bsd # install /sbin/runit-init /sbin/initBoot your system with runit for the first time:
# rebootWatch the console output while runit boots up the system. Switch to the virtual console 5 (CTRL-ALT-F5) when stage 2 is reached, a getty should run there, you are able to login.
Use init 6 to reboot and init 0 to halt a system that runs runit. This will cause runit to enter stage 3 which runs /sbin/reboot or /sbin/halt as last command.
To report success:
# ( uname -a ; cat /etc/runit/[123] ) |mail pape-runit-2.1.2@xxiv.smarden.org
#!/bin/sh # system one time tasks /bin/sh /etc/rc autoboot touch /etc/runit/stopit chmod 0 /etc/runit/stopitTo migrate a service, create a service directory, disable the service if it is running, disable the service in /etc/rc.conf or remove the service startup from the /etc/rc.* scripts and tell runsvdir about the new service.