-
Notifications
You must be signed in to change notification settings - Fork 11
Replacing Init
Follow these steps to migrate from sysvinit to runit on Debian GNU/Linux (woody). The /sbin/init binary is not replaced until step 6, runit is the default Unix process no 1 after step 7.
If you have installed the precompiled Debian package, start at step 3.
runit looks for the three stages implementing the system's booting, running and shutdown in /etc/runit/1, /etc/runit/2 and /etc/runit/3, create the files now:
Create also a getty service directory:
If you want runit to handle the ctrl-alt-del keyboard request, do:
The runit programs must reside on the root partition, copy them to /sbin:
At least one getty must run in stage 2 so that you are able to login. Choose a free tty, say tty5, where sysvinit is not running any getty (edit /etc/inittab and kill -HUP 1 if needed), and tell runsvdir about the getty-5 service:
Start runit's stage 2 for testing:
And check that the getty is running. Step 4: Reboot into runit for testing Boot your system with runit for the first time. This does not change the default boot behavior of your system, lilo will be told to use runit just once: reboot the system enter the following on the lilo prompt: init=/sbin/runit-init watch the console output while runit boots up the system switch to tty5 when stage 2 is reached, a getty should run there, you are able to login. If you are not using lilo as boot loader, refer to the documentation of your boot loader on how to pass init=/sbin/runit-init to the kernel. Step 5: Service migration The goal is to migrate all services from sysvinit scheme to the runit service supervision design; take a look at these run scripts for popular services. The migration can be done smoothly. For those services that are not migrated to use run scripts yet, add the corresponding init-script startup to /etc/runit/1, e.g.: #!/bin/sh
/etc/init.d/kerneld start /etc/init.d/rmnologin
touch /etc/runit/stopit chmod 0 /etc/runit/stopit It 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.
Step 6: Replace /sbin/init Now it is time to replace the sysvinit /sbin/init binary:
Step 7: Final reboot The last step is to do the final reboot to boot the system with the new default Unix process no 1 runit.
To report success:
( uname -a ; cat /etc/runit/[123] ) |mail pape-runit-2.1.2@smarden.org
Replacing init (*BSD) Follow these steps to migrate from init to runit on OpenBSD 2.9 or FreeBSD 4.4. The /sbin/init binary is not replaced until step 4. Step 1: The three stages runit looks for the three stages implementing the system's booting, running and shutdown in /etc/runit/1, /etc/runit/2 and /etc/runit/3 respectively. Create the scripts now:
OpenBSD 2.9:
FreeBSD 4.4:
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.
Step 2: The runit programs The runit programs must reside on the root partition, install them into /sbin:
Step 3: The getties At least one getty must run in stage 2 so that you are able to login. To have it run on the virtual console no 5, create the getty-5 service directory:
OpenBSD 2.9:
FreeBSD 4.4:
and tell runsvdir about the getty-5 service:
Start runit's stage 2 for testing:
And check that the getty is running. Step 4: Replace the /sbin/init binary Before replacing the init binary, make sure that you are able to boot your system alternatively, e.g. with a boot floppy, to restore the former /sbin/init if anything goes wrong. Make a backup copy of the current /sbin/init program and replace it with /sbin/runit-init:
Boot your system with runit for the first time:
Watch 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@smarden.org
Step 5: Service migration The goal is to migrate all services from /etc/rc.* scheme to the runit service supervision design; take a look at these run scripts for popular services. The migration can be done smoothly. By default runit runs the /etc/rc scripts in stage 1 as a one time task, so the services are started automatically: #!/bin/sh
/bin/sh /etc/rc autoboot
touch /etc/runit/stopit chmod 0 /etc/runit/stopit 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.
About runit:
Benefits
Frequently Asked Questions (FAQ)
Building runit:
Setting up runit:
Replacing Init
Running WITH Init
Runlevels
Service Dependencies
Execution Modifiers
Using runit commands:
runit
runit-init
sv
runsvdir
runsvchdir
runsv
svlogd
chpst
utmpset