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: dan@telent.net, supervision@list.skarnet.org
Subject: Re: restarting s6-svscan (as pid 1)
Date: Fri, 17 Nov 2023 14:38:40 -0800	[thread overview]
Message-ID: <170026072081.19597.14787833740071641925@localhost> (raw)
In-Reply-To: <871qco81jj.fsf@telent.net>

Quoting dan@telent.net (2023-11-17 14:20:32)
> I was thinking I could use the .svscan/finish script to check for the
> existence of the "maintenance mode" ramfs, remount it onto /
> and then `exec /bin/init` as its last action, though it seems a bit
> cheesy to have a file called `finish` that actually sometimes performs
> `single-user-mode` instead. Would that work?

I think your use case is *precisely* what .svscan/finish is for -- it's how you
get s6-svscan to exec() into some other process.  That other process can be an
instance of itself.

The fact that systemd has a special self-exec() mechanism always seemed weird
and bizzarre.  Just use the general mechanism.

> Perhaps a more general use case for re-execing pid 1 would be after OS
> upgrades as an alternative to rebooting

Sure, if you upgrade the libc or your compiler, and you want s6-svscan to use
those new libc/compiler, this is an easy way to do it.

> though other than wanting to preserve uptime for bragging rights I can't see
> any real advantage...

You can pass arbitrary large chunks of data to a re-exec()'ed pid1.  It's not
always easy to do that across a reboot, since you have to pass the data to the
bootloader and back.  Also "the data" could be open file descriptors.

  - a

  reply	other threads:[~2023-11-17 22:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17 22:20 dan
2023-11-17 22:38 ` adam [this message]
2023-11-17 22:45 ` Steve Litt
2023-11-18  0:58 ` Laurent Bercot
2023-11-19  0:31   ` Daniel Barlow
2023-11-19  1:46     ` Laurent Bercot

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=170026072081.19597.14787833740071641925@localhost \
    --to=adam@westernsemico.com \
    --cc=dan@telent.net \
    --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).