[arch-projects] [PATCH 1/2 mkinitcpio] shutdown: add a shutdown hook
Enabling the shutdown hook and using systemd v31
(which is yet to be released), means that on shutdown the root
will be pivoted to /run/initramfs, from where the rootfs and
all its submonuts (such as /usr) are unmounted cleanly.
The same functionality will be supported in a future release of
initscript.
A natural next step is to add an "/usr"-hook, which mounts the /usr
partition (if it exists) in the initramfs, so initscripts (and systemd)
can always rely on it being mounted, and we no longer need to move some
binaries/libraries to /bin, /sbin and /lib (as this does not work well
at the moment).
One might argue that this functionality does not beling in mkinitrd.
The reason I propose it for inclusion here is:
- it is independent of initscripts, so does not really belong there either.
- in the future one might imagine extending this to integrate more tightly
with the rest of the initramfs (e.g. store state/logs in /run/initramfs
to ease debugging, or add shutdown-hooks, to go with the boot-hooks, to
gracefully tear down things such as dm or nfs mounts at shutdown).
- by behaving like dracut, integrating with systemd became trivial, and IMHO
there is no point in systemd/initscripts/dracut/mkinitrd differing at the
interface level.
Signed-off-by: Tom Gundersen
This follows the same protocol as between dracut and systemd.
With this patch allows us to do some basic profiling of our
initrd:
% systemd-analyze
Startup finished in 710ms (kernel) + 2445ms (initrd) + 21214ms (userspace) = 24370ms
To get the timestamp as accurate as possible, a few things are shuffled
around to do the measurement as early in init as we can.
A patch to systemd is also required, which I will submit if this is accepted.
Signed-off-by: Tom Gundersen
participants (1)
-
Tom Gundersen