supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: adam@westernsemico.com
To: Laurent Bercot <ska-supervision@skarnet.org>,
	supervision <supervision@list.skarnet.org>
Subject: Re: s6 daemon restart feature enhancement suggestion
Date: Mon, 27 May 2024 22:36:38 -0700	[thread overview]
Message-ID: <171687459873.14083.13122148492532801514@localhost> (raw)
In-Reply-To: <em73b9b71f-50d0-4f8f-a2e2-5fd316aa57fb@6cbd56c6.com>

Quoting Laurent Bercot (2024-05-26 12:53:39)
> If you are building a distribution aimed at supporting several kinds
> of hardware, I suggest adding flexibility at the *source database*
> level, and building the compiled database at system configuration time

If at all possible, do this.

> (or, in extreme cases, at boot time, though I do not recommend that if
> you can avoid it, since you lose the static bootability guarantee).

I believe there is also a third approach which is sort of a middle-ground: all
oneshots and longruns are compiled statically, but the contents of bundles are
determined at boot time.  Think of it by analogy to the Linux kernel: distros
nowadays build every single module under the sun -- no matter how obscure -- but
only a few ever get loaded.

I believe that s6-rc-bundle is the tool used to edit the bundles:

  https://www.skarnet.org/software/s6-rc/s6-rc-bundle.html

I haven't actually tried this myself, but perhaps it might help.  Changing the
contents of bundles seems like a much less-violent action to take at boot time,
with fewer possible failure modes.

If you go this route, there is a fork in the road.  Assuming you're using
s6-linux-init,

- The easy route: in a perfect world you'd do this boot-time detection from
  within `rc.init`, before invoking `s6-rc start $DEFAULT_BUNDLE`.
  Unfortunately at that point you probably don't have anything mounted
  read-write (except /run), haven't started your hotplug daemon (e.g. mdevd),
  and haven't done a coldplug yet.  So the easy route might not work.

- The hard route: remember that s6-rc's locks are *not* reentrant!  You will
  have to think very carefully about what locks are held with s6-rc-bundle is
  called, and whether or not to use its `-b` flag.  Don't try to use s6-rc tools
  from within a oneshot.

  - a

      reply	other threads:[~2024-05-28  5:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1716661664.18967.ezmlm@list.skarnet.org>
     [not found] ` <JH0PR04MB7479C0B0A8D2DCD1CE7E22ADD1F72@JH0PR04MB7479.apcprd04.prod.outlook.com>
     [not found]   ` <JH0PR04MB74791432C577E33B1027F049D1F72@JH0PR04MB7479.apcprd04.prod.outlook.com>
2024-05-26 19:53     ` Laurent Bercot
2024-05-28  5:36       ` adam [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=171687459873.14083.13122148492532801514@localhost \
    --to=adam@westernsemico.com \
    --cc=ska-supervision@skarnet.org \
    --cc=supervision@list.skarnet.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).