Replacing sysv-rc by OpenRC on Debian

I won’t comment once again systemd, I think my mind set on the topic and future will tell if I was right or wrong. Still, dislike for the humongous scope self-assigned by systemd does not equate to consider that sysv-rc cannot be improved, it does not mean being stuck with sysv-rc for life.

Good thing is OpenRC is still being developed (latest release: 7 days ago) and, being portable over BSDs, is very unlikely to follow systemd path. Switching Debian 8.8 from sysv-rc over openrc (assuming you already got rid of systemd) is just a matter of installing it:

apt-get install openrc

for file in /etc/rc0.d/K*; do s=`basename $(readlink "$file")` ; /etc/init.d/$s stop; done

Then after reboot, removing sysv-rc:

apt-get --purge remove sysv-rc

rm -rf /etc/rc*.d /etc/rc.local

You might want then to edit /etc/rc.conf (for instance for LXC containers rc_sys=”lxc” option), check status with rc-status, check services according to runlevels in /etc/runlevels.

Update: also works with Debian 9.0 just released. But do not bother removing /etc/rc*.d, they now belong to package init-system-helpers, a package that “contains helper tools that are necessary for switching between the various init systems that Debian contains (e. g. sysvinit or systemd)”, essential on which other packages depends on (like cron). I actually asked for init-system-helpers not to force people to have in /etc directories that makes sense only for systemd or sysv-rc but, so far, got no real reply, but a WONTFIX closure – apparently the fact that update-rc.d would require /etc/rc*.d is the main issue, while update-rc.d handles perfectly the fact that /etc/runlevels may or may not exists.

For more details about OpenRC, I suggest to read Debian’s Debate initsystem openrc listing pros and cons.

 

Limit noise from hard disk using RAM (tmpfs) instead

I’m using a laptop, among other things, as alarm clock (included in my -utils general debian package). The hard disk of this laptop is not getting any younger and get noisy while there’s a decent amount of RAM available.

I toyed a bit in the past with ramdisk/tmpfs (the later having the benefit not to used a real fixed size but to adjust and unused memory free) and made tests to use tmpfs for /var/log. Since then, I did not use much this so-called transient log: it cannot be seriously used on a server where you want your logs not tampered with in any way – and especially there in case of failure; it does not make laptop or workstation very silent since there is still a large amount of file access that is in ~/.

In the case of my laptop part alarm clock, many ~/.directories and ~/.files are regularly read or wrote. So I finally changed the initial transient log init script into /etc/init.d/shush-toram that reads /etc/default/shush-toram to determines which directories to put into tmpfs, for instance /var/log and /home/alarmclockuser. bviously, you don’t want to put on tmpfs in directory that would use all or more of your actual RAM. There is also a /etc/cron.daily/shush-toram job that’ll daily update the data on the hard disk (just calling the init script with reload or restart).

Once the scripts in place, you just have to do:

invoke-rc.d shush-toram start      # start it
update-rc.d shush-toram defaults   # set autostart

Yeah, that’s sysv init scripts. It’s probably not necessary that I discuss the merits of systemd. I tried it and was happy to boot faster than usual. Then I found that making init scripts with it was annoying, counterproductive for me. Then I found that my /var/log directory contained a subdirectory journal of more than 800 Mo – that can be fixed by editing some conffile obviously, but it’s not working clean out of the box. It just does not suits me. It could, and will surely, improve. Still, it’s being made mandatory here and there while it’s still counterproductive and unpolished. I’ll continue to make script for sysv -that can actually be started outside of sysv- since I’m likely to try to avoid systemd as much as possible.

The shush-toram files are included in my -utils general debian package.