Quoting [email protected] (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
