You are not logged in.
So I am trying to switch from busybox based initial ramdisk to systemd based initial ramdisk.
But I have a confusion and need clarification.
The default mkinitcpio.conf has "sd-encrypt" before "block" HOOK but dm-crypt/System configuration Wiki mentions "sd-encrypt" after "block" HOOK. Which order is correct? Or it does not make any difference?
While I already tried both ways and it does not seem to make any difference in my case, but just wanted to be sure if order matters in certain specific cases?
Thank you.
Offline
"Technically" block beforehand is more correct, since you can't even read your encrypted container if the device containing it is not detected.
In practice it might not make much difference, because most of the common block drivers have been inlined and are built-ins that are going to be part of the kernel anyway.
Last edited by V1del (2025-07-22 12:55:43)
Offline
https://wiki.archlinux.org/title/Mkinit … mmon_hooks lists (sd-)encrypt - but it also gives for block:
Adds block device modules. If the autodetect hook runs before this hook, it will only add modules for block devices used on the system. Exceptions are the ahci, sd_mod, usb_storage, uas, mmc_block, nvme, virtio_scsi and virtio_blk modules which will always be added unconditionally.
so as v1del wrote: shouldn't matter because your storage is likely in on of the standard ones anyway
Offline
systemd-based initcpio does not have runtime hooks, so the hook order should not matter when booting.
For non-systemd initcpio the order matters a lot more, although even then it's still split up in early, late hooks and some just don't use any runtime hooks in the first place, so order does not matter for some hooks here as well.
Order still matters for both variants when the image is built, but that's a special property of the autodetect hook, not sure if any other hook cares about order at build time.
Even so, you should stick to whatever order the default config or wiki suggests. Implementations may be subject to change.
Offline
Even so, you should stick to whatever order the default config or wiki suggests. Implementations may be subject to change.
As I mentioned, default config (default mkinitcpio.conf commented line 51) for systemd shows sd-encrypt first and then block.
On the other hand Wiki shows block first and then sd-encrypt.
Hence I posted the query.
But I guess I will use block first.
Thank you to all you replied.
Last edited by amish (2025-07-22 15:26:06)
Offline