restarting s6-svscan (as pid 1)

From: <dan_at_telent.net>
Date: Fri, 17 Nov 2023 22:20:32 +0000

This may be a weird question, maybe: is there any way to persuade
s6-svscan (as pid 1) to restart _without_ doing a full hardware reboot?
The use case I have in mind is: starting from a regular running system,
I want to create a small "recovery" system in a ramdisk and switch to it
with pivot_root so that the real root filesystem can be unmounted and
manipulated. (This is instead of "just" doing a full reboot into an
initramfs: the device has limited storage space and keeping a couple
of MB around permanently just for "maintenance mode" doesn't seem like a
great use of it)

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?

Perhaps a more general use case for re-execing pid 1 would be after OS
upgrades as an alternative to rebooting - though other than wanting to
preserve uptime for bragging rights I can't see any real advantage...

Any thoughts?


Daniel
Received on Fri Nov 17 2023 - 23:20:32 CET

This archive was generated by hypermail 2.4.0 : Fri Nov 17 2023 - 23:21:18 CET