runit, this time on my
I had been thinking about this, since I saw this bit in the gentoo wiki article on openrc:
It does not function as a replacement for the /sbin/init
I keep wanting to trim everything down, and have been integrating busybox to replace userspace utilities. The gentoo wiki says:
Busybox can be used to replace most of the userspace utilities needed by OpenRC (init, shell, awk and other POSIX tools), by using a complete Busybox as shell for OpenRC all the calls that normally would cause a fork/exec would be spared, improving the overall speed. This process is not yet streamlined. Please note that there are currently many Busybox applets that are incompatible with OpenRC.
It was that last bit which concerned me, and I didn't want to risk hacking it too much.
But I could hack
sys-apps/sysvinit. I do like runit, and decided to install
The install was pretty simple:
# emerge --ask sys-process/runit
I was very surprised when my regular clean up routine gave me a prompt to
# emerge --depclean --ask ... ... >>> Calculating removal order... >>> These are the packages that would be unmerged: sys-apps/sysvinit selected: 2.88-r9 protected: none omitted: none All selected packages: =sys-apps/sysvinit-2.88-r9 >>> 'Selected' packages are slated for removal. >>> 'Protected' and 'omitted' packages will not be removed. Would you like to unmerge these packages? [Yes/No] n
Was it not needed anymore?
Wanting to see what gentoo does out of the box, I rebooted and appended
init=/sbin/runit-initto the kernel cmdline.
My system booted up cleanly, and I could login and startx.
However, I realised that I had no network. But I could manually start my network, and all was fine.
# /etc/init.d/net.wlp3s0 start
Subsequently, I realised that none of my other services had started. I narrowed them all down to the
It seems that all the services in
bootrunlevels had started, but the
defaultrunlevel had not been triggered.
So this was the only thing to do, in order to have
sysviniton gentoo out of the box. Impressive!
I had a look at
$ cat /etc/runit/1 #!/bin/sh # system one time tasks PATH=/sbin:/usr/sbin:/bin:/usr/bin RUNLEVEL=S /sbin/rc sysinit RUNLEVEL=S /sbin/rc boot touch /etc/runit/stopit chmod 0 /etc/runit/stopit
It looks like
1is triggering the
defaultis not listed there. So I just added it in there.
$ cat /etc/runit/1 #!/bin/sh # system one time tasks PATH=/sbin:/usr/sbin:/bin:/usr/bin RUNLEVEL=S /sbin/rc sysinit RUNLEVEL=S /sbin/rc boot RUNLEVEL=S /sbin/rc default touch /etc/runit/stopit chmod 0 /etc/runit/stopit
I rebooted again to test. All my services were working, and I had no errors or warnings.
I decided to go for broke, and remove sysvinit with a bit of trepidation, but knowing that I could put it back as it was.
# emerge --ask --depclean sys-apps/sysvinit
With a clean slate, I rebooted again and was pleasantly surprised. Everything seems to be well on my system.. Well, almost!
sysvinit disappeared along with shutdown reboot halt poweroff etc commands. So I had to create them.
# vi /usr/local/sbin/runit-shutdown #!/bin/sh case "$(basename $0)" in reboot) /sbin/runit-init 6 ;; shutdown|poweroff|halt) /sbin/runit-init 0 ;; esac
# cd /sbin # ln -s /usr/local/runit-shutdown shutdown # ln -s /usr/local/runit-shutdown poweroff # ln -s /usr/local/runit-shutdown halt # ln -s /usr/local/runit-shutdown reboot
And all was well again. Powerbutton was working, as were my other i3 keybindings.
As the runit article on gentoo wiki says:
It can be used in conjunction with OpenRC as an alternative to sysvinit or even replacing OpenRC as service manager.
Runit can also replace OpenRC as the service manager.which means runit can do everything on it's own. I have seen it being very dependable & stable in voidlinux.
Now why didn't the linux lords consider lean, clean & simple
runit, when deciding about
I am usually very critical of systemd. But some kudos I do have for systemd removing much accumulated garbage and cruft like *bus *kit etc.
For now, I will keep openrc as service manager, and runit as system init. Too much hacking at the gentoo core might take me too far away from gentoo stable.
$ pidof runit 1
And all is well :)