On Sat, 2022-12-24 at 14:16 +0000, Gervase wrote: > Awhile back, I did have a look around the fix. From what I > remembered, > intrigeri's solution used a systemd shutdown 'script' to check for > devmaps or whatever of LVMs, ZFS partitions, etc... and runs specific > commands to umount the partitions.
Apparently, I got confused. What I saw is the script called 'shutdown' from the mkinitcpio package used in Arch Linux (see https://gitlab.archlinux.org/archlinux/mkinitcpio/mkinitcpio/-/blob/master/shutdown ). What it does is (1) recursively umount the devices, (2) detaches loop back devices and then (3) disassembles stacked devices (i.e. encrypted devices, lvm and raid). In contrast, what intrigeri's solution SEEMS to do (I haven't done any experimentation using the solution) is provide a way for Debian's initrd process to "pivot" back to a systemd shutdown procedure within an initramfs environment, as opposed to running the Arch Linux shutdown script. This shutdown procedure differs from Arch Linux's because its initramfs infrastructure differs from Debian's, I assume? As intrigeri wrote in his instructions, the relevant scripts would need to be written for dismantling devices ('virtual' or physical) and placed in /usr/share/initramfs-tools/hooks/* (if I understood things correctly). So, if ZFS was installed as root, there would need to be a script for that and/or if LUKS was installed as root, there would need to be a script for that, etc... The way that intrigeri's solution sets up the shutdown executable by just copying it to initramfs seems very clunky to me. Shouldn't it be in the initramfs image file already even before the system is switched on/booted up!? Anyway, the above is my understanding of the situation. It may be completely wrong because I barely understand the initrd process! Thanks, Gervase.