A UNIX or Linux operating system always has an init process which is the first process to start after the kernel loads. It is the direct or indirect parent of all processes in the system. Daemon processes often double fork, to make themselves direct child processes of the init process. Openrc-init is Open-RC's own init system, and is available since version 0.25. It can replace Gentoo's current default, sysvinit's init.
Because the init process is started by the linux kernel, the kernel will need to be told to start the alternative openrc-init process. This is done by passing
init=/sbin/openrc-init on the linux kernel command line at boot time. This description refers to GRUB; adapt as needed in case a different boot manager is used.
Update /etc/default/grub as follows:
mount /boot # if not mounted already
grub-mkconfig -o /boot/grub/grub.cfg
Start terminals as OpenRC services
Openrc-init does not use /etc/inittab, so the agetty processes for tty1 to tty6 will need to be started explicitly as services.
Create the links in /etc/init.d and add them to the default run level:
for n in `seq 1 6`; do ln -s agetty agetty.tty$n; rc-config add agetty.tty$n default; done
Optional: add custom terminals
In case the system has one or more terminals connected via a serial line, then it would necessary to a define custom agetty configuration, e.g. to specify the baudrate:
cp /etc/conf.d/agetty /etc/conf.d/agetty.ttyS0
# make agetty quiet
# Set the baud rate of the terminal line
# set the terminal type
# extra options to pass to agetty for this port
Consult /etc/init.d/agetty for the logic.
Create a symlink to /etc/init.d/agetty, add it to the default run level, and reboot:
ln -s /etc/init.d/agetty /etc/init.d/agetty.ttyS0
rc-update add agetty.ttyS0 default
Reboot into openrc-init
Once rebooted the system is running under openrc-init. Verify as follows:
ps -ef | grep openrc-init
root 1 0 0 Jul02 ? 00:00:01 /sbin/openrc-init
Process number one is now openrc-init. Commands like reboot, and shutdown are no longer working under openrc-init. Instead there is openrc-shutdown. Check its man page for its usage.
Optional: enable the sysv-utils USE flag
Enabling the sysv-utils USE flag for OpenRC will replace any "agetty links" in /etc/init.d with its own (see start terminals as OpenRC services section).
To use commands like reboot and shutdown instead of openrc-shutdown, can be re-emerged with the sysv-utils use flag enabled (it is fine if the deselect operation does not find any package):
echo "sys-apps/openrc sysv-utils" >> /etc/portage/package.use/openrc
emerge --deselect sys-apps/sysvinit
emerge --ask --oneshot --newuse --verbose sys-apps/openrc
Now the familiar commands halt, reboot and the like should work as per normal.
Optional: remove openrc-init, revert back to sysv-init
In case openrc-init is not working properly, or for any other reason it is desired to revert back to, then that is possible by executing the above steps in reverse order. Please do not forget to log a bug in case openrc-init didn't work.
If the sysv-utils USE flag is set, remove it and make sureis installed again:
echo "sys-apps/openrc -sysv-utils" >> /etc/portage/package.use/openrc
emerge -a1N sys-apps/openrc sys-apps/sysvinit
Remove init=/sbin/openrc-init kernel commandline, and reboot.
openrc-shutdown -r now