Devuan: Migrate From Sysv to OpenRC Init
This is my sixth year with devuan and i had never tried any init systems other than Sysvinit. It gets the job done, so why i change it? However, i recently felt bored and started missing Gentoo. This nostalgia prompted me to try OpenRC on my Devuan Machine
OpenRC on Devuan
The installation is straightforward. First, download the OpenRC package.
$ sudo apt install openrc
There is a specific command-line prompt required for the initial setup that I unfortunately forgot. I will add it here once I recall or find it.
After installation, you must change the init path from /sbin/init to /sbin/openrc-init in
the GRUB Configuration. Add the following parameter parameter to /etc/default/grub.
$ sudo vim /etc/default/grub
---
GRUB_CMDLINE_LINUX_DEFAULT="init=/sbin/openrc-init quiet"
Don’t forget to update GRUB.
$ sudo update-grub
A critical step is adding the agetty services. Without this, you will not be able to log in via TTY. Credit to the Gentoo Wiki for this explanation:
root # cd /etc/init.d
root # for n in $(seq 1 6); do ln -s agetty agetty.tty$n; rc-update add agetty.tty$n default; done
If openrc-init runs as the primary init, the standard poweroff and reboot commands may fail. Fortunately, I have a workaround using dpkg-divert:
$ sudo dpkg-divert --add --rename --divert /sbin/poweroff.real /sbin/poweroff
$ sudo dpkg-divert --add --rename --divert /sbin/reboot.real /sbin/reboot
$ sudo cat <<EOF > /sbin/poweroff
exec /usr/bin/sudo /sbin/openrc-shutdown -p now
EOF
$ sudo cat <<EOF > /sbin/reboot
#!/bin/sh
exec /usr/bin/sudo /sbin/openrc-shutdown -r now
EOF
$ sudo chmod +x /sbin/poweroff /sbin/reboot