OpenRC/openrc-init

From Gentoo Wiki
< OpenRC
Jump to: navigation, search

OpenRC ships since version 0.25 with its own init system. It is called openrc-init, and can replace Gentoo's current default sysvinit's init. Since version 0.42, OpenRC has gained the sysv-utils USE which promotes openrc-init and openrc-shutdown to their sysvinit counterparts.

sysv-utils USE

Migration

To migrate to sysv-utils, it is recommended to boot with init=/sbin/openrc-init first, with the instructions below, before setting the flag and recompiling. This is due to the inability of the replaced shutdown command to properly communicate with sysvinit.

Kernel commandline

Replacing sysvinit with openrc-init requires passing init=/sbin/openrc-init on the linux kernel command line at boot time. This description refers to GRUB2; adapt as needed in case a different boot manager is used.

Update /etc/default/grub as follows:

FILE /etc/default/grub
#GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX_DEFAULT="init=/sbin/openrc-init"

Regenerate /boot/grub/grub.cfg:

root #mount /boot # if not mounted already
root #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:

root #cd /etc/init.d
root #for n in `seq 1 6`; do ln -s agetty agetty.tty$n; rc-config add agetty.tty$n default; done

Reboot

Reboot your system after completing the above steps:

root # reboot

Openrc-shutdown

Note
This section is no long relevant when the sysv-utils USE is enabled.

Be aware that commands like reboot, and shutdown are no longer working under openrc-init. Instead there is openrc-shutdown. Check its man page for its usage.

Defining aliases might help to keep using the same commands:

FILE /root/.profile
alias reboot="openrc-shutdown -r now"
alias halt="openrc-shutdown -H now"
alias shutdown="openrc-shutdown"