Mkinitcpio with systemd-hooks

Hi,
I wanted to change the entries of the mkinitcpio.conf from


HOOKS=(base udev autodetect modconf block encrypt lvm2 resume filesystems btrfs keyboard fsck)

to
HOOKS=(base systemd autodetect modconf block sd-encrypt sd-lvm2 filesystems keyboard fsck)

Reason: mostly just for fun, but I also believed it might be better to use systemd whenever possible to not mix too many different approaches.
Unfortunately (after re-generating grub and mkinitcpio of course) system became unbootable. I had to chroot and remove the changes to get bootable system again.
Anyone has any idea what I made wrong?
I followed this list: https://wiki.archlinux.org/index.php/Mkinitcpio#Common_hooks

Do I need systemdboot for this?

What error did you get?

No, you shouldn’t.

Also, what filesystems and disk layout are you using?

The error was that “loading initial ramdisk” couldn’t be executed. I mean it showed up long time (a couple of min), after that some message came which I unfortnaetely don’t remember.


lsblk -f
NAME                    FSTYPE      FSVER    LABEL UUID                                   FSAVAIL FSUSE% MOUNTPOINT
nvme0n1                                                                                                  
├─nvme0n1p1             vfat        FAT32          99A2-3CCA                                             
├─nvme0n1p2             btrfs                      cc69a291-7fe3-4096-80a1-ad51e9edf072    105.1M    51% /boot
└─nvme0n1p3             crypto_LUKS 2              f528ec71-348e-448c-8f69-93ba1092736d                  
  └─volgroup0           LVM2_member LVM2 001       gX1Djy-ng9a-2Knt-ZSCv-IF3w-gdda-LnH1R7                
    ├─volgroup0-lv_root btrfs                      1f3a3e06-061e-4e6a-a9e6-8207be2bb48f     10.3G    65% /
    └─volgroup0-lv_home btrfs                      292f164c-2a7e-4e27-919f-2412ba2354e1    162.8G    46% /home

When switching to systemd hooks I used those instructions.

I din’t have
sd-vconsole
is it mandatory? Arch-wiki says

Loads the specified keymap(s) from /etc/vconsole.conf during early userspace.

But I don’t have /etc/vconsole.conf.

Moreover “keyboard” is at different position. Does the sequence matter? I couldn’t find this information.

Most probably this was my (only?) problem:

Configuring the boot loader

If using the sd-encrypt hook or dracut, the following need to be set instead:

rd.luks.name= device-UUID =cryptlvm root=/dev/MyVolGroup/root

@ csteinforth
May I ask what was your reason to switch to systemd-hooks?

You removed the btrfs hook, is it not needed?

Acc. to https://wiki.archlinux.org/index.php/Mkinitcpio#Common_hooks it is not needed (or available?) form my understanding.
How do you understand the table in the archwiki?

Just to try it out :wink:

Sequence does matter, sd-vconsole must be set before encrypt. But I guess you do not need sd-vconsole if US keyboard is ok.

Yes, I have US keyboard.

I guess that you need this in addition when switching to systemd.

btrfs is not needed when using systemd.

Also my understanding and I missed the first. Will try soon.
Btw: I have 2 kernels, linux and linux-zen. If I do the changes to grub and mkinitcpio and then only do
mkinitcpio -p linux
(and not for linux-zen) as well as
grub-mkconfig -o /boot/grub/grub.cfg
(Question again: is sequence important to do mkinitcpio command first?)
Should I then still be able to boot with linux-zen kernel?

To my knowledge sequence does not matter here.

I don’t have experience in this, sorry.