[adelie-devel] Re: s6-rc, netifrc, etc

From: Laurent Bercot <ska-adelie_at_skarnet.org>
Date: Thu, 23 May 2019 20:13:27 +0000

>I was looking at porting the init scripts for
>some common daemons that I run (openssh, etc.)
>to s6, and I immediately ran into the obvious
>issue that many of these services have non-trivial
>ordering dependencies ('net' and 'dns' targets, etc.)

Oh man, you're looking at a huge amount of work. ^^'

It's definitely something we are interested in (at least, I am!)
but it's a long-term effort. And in order for it to be usable and
friendly to non-power-users, it's likely that I'll write s6-frontend
(the future UI to the s6 ecosystem) first, and convert all the OpenRC
boot sequence to the user-friendly format, rather than convert the
boot sequence to an s6-rc database. But s6-frontend won't be released
for a couple more years, so in the meantime, any solution that works
for you is good.
On the #s6 channel on Freenode, there are people who have dabbled
in that already, not on Adélie but on other distributions (including
Gentoo, which runs OpenRC); their experience may be useful to you.
Some of those people (aranea and multiplexd) also hang out on #Adelie
on Interlinked so you may find them there too.

>The simplest transitional configuration would be
>to have OpenRC still manage service/networking
>dependencies as it does today, and just replace
>the 'start-stop-daemon' invocations in the scripts
>with the appropriate s6 equivalent. But ultimately
>I'm interested in seeing if I can get everything on
>my system running under s6-rc.

Adélie has its daemon packages cleanly divided between mechanism
and policy: foobar (the binaries) and foobar-openrc (the OpenRC
scripts that start the foobar daemon), precisely in order to be
able to support other service managers in the future - typically
s6-rc. So the architecture is there; what remains to be done
is writing the foobar-s6rc scripts. And that's serious work.

I'm inclined to discourage the "replace start-stop-daemon with
scripts that add or remove servicedirs to/from the supervision
tree" approach: I've tried that for a bit and is not satisfying
because it still ties your boot sequence to the OpenRC way of
doing things, and most of the time it feels like putting a square
peg into a round hole. You'll notice that very fast when trying to
decide *how* you should add service directories and remove them.
(If you want an example, look at what I did with the netqmail
package. It's driven by openrc but all the qmail daemons use the
s6 supervision tree - and those OpenRC scripts are *ugly*.)

  But of course, making s6-rc manage everything is a lot of conversion
work. You can probably do what is recommended in the s6-rc FAQ, i.e.
make a quick and dirty switch to an s6-rc driver for your boot
sequence that just calls openrc oneshots underneath it, and then
incrementally port services to use s6-rc idioms, take advantage of
the supervision tree, and improve the database. That's definitely how
I would do it. But it's probably still more work than hacking around
an openrc driver.

>Consequently, I'm looking at writing some tooling
>to generate s6-rc service definition directories
>and bundles for the 'net' prerequisite. In practice
>I think this looks like a tool to read the system
>networking configuration from a file and generating
>execline scripts that do the appropriate iproute2 voodoo,
>launch a supervised dhcpcd, etc.
>(I haven't thought too seriously about wireless/hotplug
>yet, since I'd likely have to open the udev can of worms.)

You are spot-on, as in, you are quickly identifying the hard
problems here. Network configuration is *hard* - at least, I think
it is, because a good mechanism for network config doesn't seem
obvious to me. netifrc, as well as other mechanisms used by other
distros, does the job, but it's not satisfying, as in, it doesn't
strike me as being "done right". But I can't tell off the top of my
head what "done right" would be, and it's precisely something I plan
to spend a serious amount of time on when working on s6-frontend,
because it's a domain where I think a lot of improvements can be
made and I really want to think long and hard at the problem space
and come up with the correct modelization and a good approach.

So if you're willing to tackle network configuration, whether to
correctly solve the problem space in a Unixish and s6-ish way, or
simply to reuse existing netifrc files to create configuration
scripts that work under s6-rc, that will be *awesome*.

>If anyone is aware of a similar effort already in
>progress, let me know.

A similar effort, from me, is clearly *planned*, but it will likely
start in 2020 when I can finally take a year off to work on
s6-frontend full time and complete the "s6 init world".
Attempts by various people with various tools have been made, and
you should be able to get info on them on #s6 if not on #Adelie.
But that's all I'm aware of, and AFAICT if you're starting this
June you'd be the first one to try and work on that seriously.

>I'll probably start looking at this seriously towards
>the end of next week, but I'm interested to gather some
>initial feedback on the concept before I head down that path.

  I should be able to finish the s6-linux-init integration into Adélie
this week-end or early next week. After that, I'll be available for
most of the week in #Adelie; unfortunately, I'll be starting a new
contract (paid work! yay!) in June, so I'll be a lot less available
afterwards. I'll still try to drop by though - and the #s6 people,
including the ones also on #Adelie, are generally nice and helpful
and should be able to give you a lot of feedback and tips. :)

Received on Thu May 23 2019 - 20:23:38 UTC

This archive was generated by hypermail 2.4.0 : Sat May 08 2021 - 22:54:40 UTC