Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /usr/share/doc/runit/html/ drwxr-xr-x | |
| Viewing file: Select action/file-type: runit runit - replacing initHow to replace sysvinit on GNU/Linux How to replace init on *BSD How to replace init on MacOSX How to replace init on Solaris Replacing sysvinit (GNU/Linux)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. Step 1: The three stagesrunit 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:# 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/ Step 2: The runit programsThe runit programs must reside on the root partition, copy them to /sbin:# cp -p /package/admin/runit/command/runit* /sbin/ Step 3: The gettiesAt 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:# 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. Step 4: Reboot into runit for testingBoot 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:
Step 5: Service migrationThe 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 # 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. Step 6: Replace /sbin/initNow it is time to replace the sysvinit /sbin/init binary:# mv /sbin/init /sbin/init.sysv # ln -s runit-init /sbin/init Step 7: Final rebootThe last step is to do the final reboot to boot the system with the new default Unix process no 1 runit.# init 6To 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 stagesrunit 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:# 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 Step 2: The runit programsThe runit programs must reside on the root partition, install them into /sbin:# install -m0500 /package/admin/runit/command/runit* /sbin/ Step 3: The gettiesAt 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:# 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. Step 4: Replace the /sbin/init binaryBefore 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: # 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@smarden.org Step 5: Service migrationThe 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 # 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. Replacing init on MacOSXReplacing init on MacOSX is not yet supported. Please refer to the instructions on how to use runit service supervision with the MacOSX init scheme.Replacing init on SolarisReplacing init on Solaris is not yet supported. Please refer to the instructions on how to use runit service supervision with the Solaris sysvinit scheme.Gerrit Pape <pape@smarden.org> |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0039 ]-- |