You are not logged in.

#1 2024-04-27 05:33:37

hyperbolicblue
Member
Registered: 2020-12-01
Posts: 9

[SOLVED] Booting encrypted system with systemd hooks: boot hangs

Following the Installation Guide and the guide on encrypting an entire system with LVM on LUKS, I managed to configure systemd-boot.

I am struggling to configure mkinitcpio and the boot loader such that the sd-encrypt hook is used. From the very helpful guides I cannot seem to figure out what I am doing wrong.

Everything works if I use the default busybox-based initramfs by setting the suggested hooks in mkinitcpio.conf

HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block encrypt lvm2 filesystems fsck)

and configure the bootloader with this arch.conf

title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options cryptdevice=UUID=<UUID>:myvolgroup root=/dev/myvolgroup/root rw init=/usr/lib/systemd/systemd

Then, I can boot from the device, I get asked the password and I can login as expected.

It does not work, however, if I use the sd-encrypt hook

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

and configure the bootloader with this arch.conf

title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
rd.luks.name=<UUID>=myvolgroup root=/dev/myvolgroup/root

Now, the boot process hangs with

A start job is running for /dev/myvolgroup/root

Since I'd like to use sytemd-boot, it seems natural to me to use the systemd hooks, too. Although I am happy that I can boot with udev and systemd, I'd like to know how to correctly configure booting with systemd.

Edit: Marked solved. The solution: Prepend rd.luks.name=... with options .

Last edited by hyperbolicblue (2024-04-27 17:54:56)

Offline

#2 2024-04-27 08:47:05

impossibleveins23
Member
From: Israel
Registered: 2022-06-18
Posts: 148

Re: [SOLVED] Booting encrypted system with systemd hooks: boot hangs

I assume you executed: mkinitcpio -p linux between changing the hooks.
Do you see the VG formed either in the log or when dropping to maint shell?
Can you pass the full boot log?


* Good formatted problem description will cause good and quick solution smile
* Please don't forget to mark as [SOLVED].

Offline

#3 2024-04-27 13:25:00

hyperbolicblue
Member
Registered: 2020-12-01
Posts: 9

Re: [SOLVED] Booting encrypted system with systemd hooks: boot hangs

Yes, I executed mkinitcpio -P after changing hooks.

Either I missed something, or my journalctl records only boots with successful logins (booted via udev). My interpretation is that booting with systemd gets stuck before journalctl can record anything.

Booting with systemd, this is what my screen reports:

[ OK ] Started Dispatch Password Requests to Console Directory Watch.
[ OK ] Reached target Path Utils.
[ OK ] Reached target Slice Units.
[ OK ] Reached target Swaps.
[ OK ] Reached target Timer Units.
[ OK ] Listening on Journal Socket (/dev/log).
[ OK ] Listening on Journal Socket.
[ OK ] Listening on udev Control Socket.
[ OK ] Listening on udev Kernel Socket.
[ OK ] Reached target Socket Units.
       Starting Create List of Static Device Nodes ...
       Starting Check battery level during early boot ...
       Starting Journal Service ...
       Starting Load Kernel Modules ...
[ OK ] Reached target Local Encrypted Volumes.
       Starting Create Static Device Nodes in /dev ...
       Starting Coldplug All udev Devices ...
[ OK ] Finished Create List of Static Device Nodes.
[ OK ] Finished Check battery level during early boot.
[ OK ] Started Displays emergency message in full screen ..
[ OK ] Finished Load Kernel Modules.
[ OK ] Finished Create Static Device Nodes in /dev.
[ OK ] Reached target Preparation for Local File Systems.
[ OK ] Reached target Local File Systems.
       Starting Rule-based Manager for Device Events and Files ...
[ OK ] Started Rule-based Manager for Device Events and Files.
[ OK ] Started Journal Service.
[ OK ] Finished Coldplug All udev Devices.
[ OK ] Reached target System Initialization.
[ OK ] Reached target Basic System.
       Starting Virtual Console Setup ...
[ OK ] Finished Virtual Console Setup.
--- new screen ---
[ OK ] Finished Create Static Device Nodes in /dev.
[ OK ] Reached target Preparation for Local File Systems.
[ OK ] Reached target Local File Systems.
       Starting Rule-based Manager for Device Events and Files ...
[ OK ] Started Rule-based Manager for Device Events and Files.
[ OK ] Started Journal Service.
[ OK ] Finished Coldplug All udev Devices.
[ OK ] Reached target System Initialization.
[ OK ] Reached target Basic System.
       Starting Virtual Console Setup ...
[ OK ] Finished Virtual Console Setup.


[ *   ] A start job is running for /dev/vg/root (2s / 1min 30s)

This seems to contradict what I said earlier, since the entries mention udev and Journal Service.

Maybe I missed something when changing the hooks and arch.conf files. Should I have done more that running mkinitcpio -P?

Last edited by hyperbolicblue (2024-04-27 16:44:16)

Offline

#4 2024-04-27 13:26:48

cmm11
Member
Registered: 2018-02-18
Posts: 50

Re: [SOLVED] Booting encrypted system with systemd hooks: boot hangs

From your new reply it sounds like your hooks and systemd-boot entry are fine since you can obviously decrypt and boot to a certain point.
Did you remember to install the lvm2 package ? I don't think it gets pulled in during a basic install.

Last edited by cmm11 (2024-04-27 13:29:09)


$20 Free Credit Hetzner - https://hetzner.cloud/?ref=fuVilhv403fA

Offline

#5 2024-04-27 16:34:55

hyperbolicblue
Member
Registered: 2020-12-01
Posts: 9

Re: [SOLVED] Booting encrypted system with systemd hooks: boot hangs

Good to know that the hooks and systemd-boot entries appear to be fine. Yes, I had lvm2 installed; I believe it's required for the process with both systemd and udev.

Offline

#6 2024-04-27 16:43:30

impossibleveins23
Member
From: Israel
Registered: 2022-06-18
Posts: 148

Re: [SOLVED] Booting encrypted system with systemd hooks: boot hangs

1. After the timeout, does it drops to the emergency shell ? Are you able to mount the VG then?
2. I found this post. Perhaps better recheck the syntax of the boot entry and pass it here.


* Good formatted problem description will cause good and quick solution smile
* Please don't forget to mark as [SOLVED].

Offline

#7 2024-04-27 17:10:13

progandy
Member
Registered: 2012-05-17
Posts: 5,269

Re: [SOLVED] Booting encrypted system with systemd hooks: boot hangs

If your new bootloader config is an exact copy of the one you posted here, then you are missing "options" before the kernel parameters.

title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options rd.luks.name=<UUID>=myvolgroup root=/dev/myvolgroup/root

Last edited by progandy (2024-04-27 17:11:27)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#8 2024-04-27 17:53:27

hyperbolicblue
Member
Registered: 2020-12-01
Posts: 9

Re: [SOLVED] Booting encrypted system with systemd hooks: boot hangs

You have a keen eye, progandy! Now my systems boots with systemd as well. smile

The kernel parameters page even gives an example in Section 1.2 systemd-boot. So on the one hand I could have guessed the solution myself, on the other hand this is my first install with UEFI and systemd (instead of GRUB), so I had a lot of reading to do and I'm kinda happy this was a typo kind of error, so I was at least close to the mark.

Anyways, thank you guys for helping me out and especially for replying lightning fast! It's been a while since I posted in the Arch forums and it's always a very nice experience. Thank you!

Offline

Board footer

Powered by FluxBB