Hey everyone,
I am trying to improve my selfmade shutdown script a bit more.
After reading through the source of s6-linux-init again,
I realised that it can only work if s6-linux-init-hpr is on the root partition,
since all other partitions are umounted before its execution.
Although this is surely fine in most cases
(and my current implementation has the same limitation),
I was thinking about ways to avoid this limitation.
This seems be only possible by
remounting all partitions read-only during stage4.
(is there any downside to mounting read-only instead of umounting?)
Additionally, since my init/shutdown scripts are created for
s6-svscan only I have thought about simplifying the shutdown procedure by
avoiding the "SIGTERM, SIGKILL, umount all" dance alltogether,
with the following structure that should(?) allow this:
a) Assumption: everything is directly or indirectly started by s6-supervise.
b) Users are instructed to write umount (or remount read-only) down scripts for s6-rc,
here the script responsible for the partition housing the binaries required for shutdown
should remount read-ony instead of umount.
c) The shutdown script looks roughly as follows:
I Stop all s6-rc services orderly using s6-rc -Da.
If successful continue with II,
else stop the shutdown procedure and run into rescue,
since one of the failed transition could be a umount/remount.
II If I is successful stop all
s6-supervise (also non s6-rc) services with s6-svc -D.
III If II is successful or after timeout force kill
remaining services with s6-svc -K
IV Remount what is still mounted read-only (or umount)
(e.g. manually mounted usb sticks).
V Actual "hardware shutdown"
Would this be reliable or did I overlook anything?
I look forward to hearing your thoughts!
Paul Sopka
Received on Mon Dec 22 2025 - 18:20:54 CET