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.

Kernel commandline

Replacing sysvinit with openrc-init requires passing init=/sbin/openrc-init on the linux kernel commandline 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

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"