This Time Self-Hosted
dark mode light mode Search

Updating init scripts

Hah. I know what you’re thinking: Flameeyes has disappeared! Yeah, I probably wish I was spending vacations in London or somewhere along those lines, but that’s not the case. Alas I’m doing double shifts lately, which is why Gentoo is taking mostly second place. But I shouldn’t complain, in this economy, having too much work is pretty rare.

Beside still operating the tinderbox I’ve decided to spend some time to update the init scripts that come with my packages. The new OpenRC init system has a much more extensive runscript shell that is used to execute the init scripts; this means that new init scripts can be written in a declarative way, that makes them shorter and more fool proof.

Indeed, for some init scripts – such as the new netatalk ones – the script boils down to setting the dependencies and declare which command to start and with which option. This is very good and nice.

I have to thank Samuli for the idea, as he went to update acpid’s init script with the new style, and so pushed me to look at other init scripts — in one case, it was because the package (haveged) was not working on one of my vservers, it seems like it was simply a transient problem, the latest version worked fine… and now has a new init script as well!

In some cases these updates also come with slight changes in behaviour, mostly in the case of ekeyd that is no longer setting sysctls for you (that’s why you got a sysctl.conf after all!), and in the case of quagga I ended up finally collapsing the two init scripts in a single one (before it was one for zebra and one for the rest, now it’s a single one symlinked for each service).

What is this reminding me, though, is the problem with init scripts that I have found with LXC before: a number of init scripts can’t be used on the host if you plan on using the same init script within a container: vtun, ulogd, autoconfig, wmacpimon, nagios, amphetadesk, vdr, portsentry and gnunetd use killall; drqsd, drqmd, ttyd, upsd and irda use non-properly-bound pkill, ncsa, npcd, btpd, nrpe, gift, amuled and amuleweb use non-properly-bound pgrep (and in the case of ncsa, npcd and nrpe, all of which seem to involve nagios, what it’s trying to do is a simple pkill).

Luckily it seems like there aren’t any more scripts installed in /etc/init.d that don’t use runscript, although I’m sure there are a few more that need work, if they are provided by upstream, as the Netatalk case shows us.

Oh well, more work to do then.

Comments 4
  1. Hi,Lucky I found this post, I did not know there are changes in init.d scripts…Where does it documented? Announced?I must say I don’t like this idea, for example if you have to implement your own start() the cgroup does not work.It should have been like portage, you have base_start() and start() calls base_start() and does some default processing, if you override start() you can always call base_start().Also, during migration it was unwise to do the cgroup (for example) in start() as current services do not get this feature.

  2. Honestly, the cgroup thing is something I wasn’t aware of until I updated to the (now retracted) 0.9.6 version, and I have yet to understand why this is done at all; sure it allows better setting of limits, but it should have been applied by runscript indiscriminately in my opinion, not limited to those using the default function…

  3. Yes, this exactly what I wrote in more words.It should be enforced regardless of init.d script implementation.I like the cgroup idea… first it allows you to kill all processes within a group… It also provides a way to implement “/etc/init.d/server pause/resume” and of course resource allocation…

  4. We’ll see where it goes. Honestly I’ve been out of gentoo-dev for a couple of weeks as I’m having some hardware problems, and I wasn’t really aware at all about this feature entering, at all. As I noted, there are more irking issues with the @/run@ migration, so that is likely to be delayed as well…On the other hand it would be a good idea to start moving more init scripts to use the shorter, declarative variant.. it takes very little indeed.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.