[arch-general] [Bulk] Re: RFC: OpenRC as init system for Arch

Patrick Lauer patrick at gentoo.org
Sun Apr 29 00:51:11 EDT 2012


On 04/29/12 11:10, C Anthony Risinger wrote:
> On Sat, Apr 28, 2012 at 7:16 PM, Kevin Chadwick <ma1l1ists at yahoo.co.uk> wrote:
>> On Sat, 28 Apr 2012 16:05:54 -0500
>> C Anthony Risinger wrote:
>>
>>> "bloat" is not measured by LOC, but rather by degrees of uselessness.
>> I disagree here. If many don't use/need those features aside from an
>> init system initialising things then it is bloat and will have bugs
>> that will even affect simple firewall systems. Of course I'd use
>> OpenBSD for a firewall but I know some build a highly stripped down
>> Linux (kernel).
> perhaps it is a matter of taste, but i don't think the init system's
> purpose is to simply "initialize" things.  it is a state manager, esp.
> considering it has abilities no other process has.  i wish i could
> find the link now, but i read an excerpt regarding the original design
> philosophy of the init program ... and while it wasn't 100% straight
> forward, the original goals heavily alluded that init was a
> intelligent supervisor, and not nearly as dumb as we now know it.
well, the sysvinit /sbin/init is very good at being PID 1 ... the state
manager gets started and/or kept alive by it - and there's so little
code involved that there are no surprises.
The sysvinit code is so "boring" that there are still typos in the
comments because not enough people even look at it to notice ...

>
> for LXC systems, i previously wrote an "init" in bash, that could
> parse inittab, and respond to SIGPWR and SIGINT (powerfail and
> crtlaltdelete in inittab), i probably 100 LOC of bash.  basic
> functionality was implemented in far less ... what's the point?  now i
> have to write everything in shell scripts for stuff that could
> perfectly well be handled by the supervisor.
acpid for SIGPWR, ca:12345:ctrlaltdel:/sbin/shutdown -r now for SIGINT,
oh wait, my defaults already do that

And I didn't have to write any code for that ...
>
> i write a lot of shell code, and have literally read the bash man page
> enough times to be able to jump to any point for reference ... shell
> code is anything but secure and rather fragile.  it's just not meant
> to do as much as we make it.  you are probably right about the
> firewall case, maybe it wouldn't be needed.  but my guess is that you
> could actually make the firewall much more fault tolerant and
> intelligent by using such a powerful supervisor as systemd.  for the
> most part though, most systems *do* require intricate and complex
> relationships between services, and systemd fills that need
> splendidly, *because* it does more that "fire and forget" [initialize]
> processes.
Worse than OpenRC, especially as it has insane nuggets like "WantedBy"
(hello threaded Intercal!)

In my opinion,  if I have to start hacking random C to add or adapt
features (which happens as soon as the builtins do the wrong things -
that's about twice a year for me) it'll be a lot more crashy than a
simple shell script where I add one line of code.


[snip]
> Rather than some conspiracy I'd hope/expect it's simply that having
> many many coders bring wanted features but also unstoppable misdirected
> trains as there aren't enough top notch respected eyes to notice before
> it's too late. Elephantitis.
> i think systemd offers a nice way to not only start your processes,
> but also maintian their relationship to the rest of the system.
So the only weak argument in favour of systemd is dependency handling,
which has been around for a decade. Oh, and if you have stateful init
scripts (yeah, radical, I know) you can just check if all services you
wanted to start are started and still alive. (running "rc-status" and
"rc" with openrc does exactly that)

No need for systemd at all :)

> traditional init systems work fine ... so long as everything works
> correctly on first try.  if you want to have any kind of faul
> tolerance, or even recovering from minor outages/hiccups, you suddenly
> need all this extra infrastructure to watch pid files, watch
> directories, watch watch watch ...
that's why I offered OpenRC as an alternative - it does all those things
while still being boring and manageable.

>  while meanwhile, your init system
> is standing in the corner picking it's nose, because it "did it's job
> already" and all it needed to do was "start some stuff in the first 5
> seconds".
So fix your init system :)
>
>>> i have custom units managing daemons like this, timers syncing
>>> archlinux mirrors, units modifying /sys/ tunables (there is no
>>> `sysctl` for sysfs!), some that run/reboot XBMC on my HTPC ...
>>>
>>> ... and on servers especially, i even have units bound to ethernet
>>> devices, automatically managing the interface, and/or starting dhcp!
>> Could you be explicit in what you've gained. Maybe I'm ignorrant of the
>> details but I see perhaps this functionality being more universal and
>> that's it?
> i just want things to happen at the right moments without worry, reuse
> as much as possible, and not need to introduce additional requirements
> ... in the end i'm quite sure we have the same goals :-)
>
> i know this isn't the final way i'll do it, but i currently use this
> unit file on ~3 servers:
[snip]
> ... with just what you see above, and no modifications between
> systems, i can run a dhcp service on any interface, whether it exists
> or not, by only making a single symlink for each interface needed.
> when a particular interface comes into being, dhcp will be started.
> when the interface disappears, dhcp will be killed and the unit
> "shutdown".  if dhcp dies but the interface still exists, it will be
> restarted.  this unit activates the network.target, but guarantees
> that all units depending on the network will wait until it's finished
> before being started themselves.
ln -s /etc/init.d/net.lo /etc/init.d/net.eth3; /etc/init.d/net.eth3
start <-- there's eth3 running with dhcp

And for the dynamic case where you don't know the device name ahead of
time I'd suggest using NetworkManager - it's built to handle all that
jazz. Oh, and if you have a sane init system it'll know in what state NM
is and thus be able to delay starting services that rely on a network
connection.

Or, if you are really kinky, write udev rules to do such things. It's
less code than the unit file ... and udev *is* the event handler for
such things.
>
> ... doing to same with an init script requires a much more work, a lot
> more boilerplate code, and probably another process or two+.
>
You could do it like that, yes ... but isn't that a bit overengineered?

Oh well. It's great that you're discovering features, but systemd isn't
without alternative.  Most of the features you mention have been in
OpenRC since the beginning (and that's just a rewrite of the old
baselayout scripts that are about a decade old).

Take care,

Patrick


More information about the arch-general mailing list