1/ I had not noticed the output of /etc/rc.tini was redirected to "uncaught-logs" so I could not properly check it was executed or not.

 Ah, yes, I should document that.


2/ I tried to unmount all filesystems during the shutdown of s6-rc, which fails because the root cannot be unmounted at time, causing the shutdown to fail.

 Unmounting filesystems is a tricky point.
 Ideally, you'd want to do that at in the "down" scripts of the oneshot
services where you mount them, for symmetry. But it's not really possible,
because boot and shutdown are not exactly symmetric.

 When you're booting, you know exactly what processes are running on the
machine. When you're shutting down, you don't: users may have left
background processes all over the place, legitimately; those processes will
not die when you bring services down. If they have open files on a
filesystem when your shutdown procedure gets to the unmount point, the
unmounting will fail.

That is why I recommend unmounting the filesystem not in the "down" script
of the "mount" service, but all at the same time, in /etc/rc.shutdown,
*after* killing all processes with kill -9 -1. It's the only time when
you know precisely again what processes are running on the machine; and
you know there's nothing left to prevent you from unmounting the
filesystems.

ISTR you could "unmount" the rootfs and the kernel would simply remount it in read-only mode (which is exactly what you want to do before rebooting -
even if you booted with a read-only rootfs, it may have changed during
the system's lifetime). Has this changed?

--
 Laurent

Reply via email to