You are not logged in.

#1 2024-03-22 17:07:59

Iriomote
Member
Registered: 2013-11-10
Posts: 29

[SOLVED] efibootmgr + btrfs + luks wont boot

Hello,

I wanted to install arch on my new laptop. To date I have used grub + ext4 + lvm and luks.
But now I wanted to try something new with efibootmgr, btrfs and luks.

My problem is, that at boot it says

Waiting 10 seconds for device /dev/mapper/cryptroot ...
Waiting 10 seconds for device /dev/mapper/cryptroot ...
Waiting 10 seconds for device /dev/mapper/cryptroot ...

And then drops me into an emergency shell.

To generate the boot entry I used this:

root@laptop ~# efibootmgr --create --disk /dev/nvme0n1 --part 1 \
	--label "Arch Linux" \
	--loader /vmlinuz-linux \
	--unicode ' rd.luks.name=09d2cc47-b844-4a3f-b9b8-2cb1d4c41644=cryptroot \
	rd.luks.options=allow-discards \
	root=/dev/mapper/cryptroot \
	rootflags=subvol=@ rw initrd=\amd-ucode.img initrd=\initramfs-linux.img'

To me it seems, that it tries to unlock /dev/mapper/cryptroot and not 09d2cc47-b844-4a3f-b9b8-2cb1d4c41644 but every guide said, that "rd.luks.name=xxx=cryptroot" is the place to put the UUID of the luks-Partition.
I'm confused as to what is correct.

This is the information I got out of the live system:

root@laptop ~# blkid
/dev/nvme0n1p1: UUID="E519-D9ED" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="f132d4fb-94a3-440e-a818-3b3a23a2c23b"
/dev/nvme0n1p2: LABEL="swap" UUID="feca47c4-71f3-46f1-be61-148213463047" TYPE="swap" PARTUUID="8cb542e3-e812-4abb-9e78-cca33569a291"
/dev/nvme0n1p3: UUID="09d2cc47-b844-4a3f-b9b8-2cb1d4c41644" TYPE="crypto_LUKS" PARTUUID="b2a36a4c-151e-431c-95a8-51b02522d770"
/dev/mapper/root: LABEL="root" UUID="26d0a487-3141-4f5a-87ee-951ce45b2ba7" UUID_SUB="60ba0a87-8cc8-481a-b8c7-8eedf21382da" BLOCK_SIZE="4096" TYPE="btrfs"
root@laptop ~# cat /etc/fstab
# <file system> <dir> <type> <options> <dump> <pass>
# /dev/mapper/root LABEL=root
UUID=26d0a487-3141-4f5a-87ee-951ce45b2ba7	/         	btrfs     	rw,relatime,compress=zstd:3,ssd,space_cache=v2,subvolid=5,subvol=/	0 0

# /dev/nvme0n1p1
UUID=E519-D9ED      	/boot     	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro	0 2

# /dev/nvme0n1p2 LABEL=swap
UUID=feca47c4-71f3-46f1-be61-148213463047	none      	swap      	defaults  	0 0

Last edited by Iriomote (2024-03-24 14:33:30)

Offline

#2 2024-03-24 13:56:25

Iriomote
Member
Registered: 2013-11-10
Posts: 29

Re: [SOLVED] efibootmgr + btrfs + luks wont boot

I just got a litte further.

I was using the systemd-cryptsetup-generator without using the right hooks in mkinitcpio.conf

Now I have gone from the systemd to the encrypt hook like this:

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

And with a new efibootmgr configuration:

root@laptop ~# efibootmgr --create --disk /dev/nvme0n1 --part 1 \
    --label "Arch Linux" \
    --loader /vmlinuz-linux \
    --unicode ' cryptdevice=/dev/disk/by-uuid/09d2cc47-b844-4a3f-b9b8-2cb1d4c41644:cryptroot:allow-discards \
    root=/dev/mapper/cryptroot \
    rootflags=subvol=@ rw initrd=\amd-ucode.img initrd=\initramfs-linux.img'

Now I can enter a password at boot, and the decryption seems to work. But when it tries to mount the decrypted device it failes.

A password is required to access the cryptroot volume:
Enter passphrase for /dev/disk/by-uuid/09d2cc47-b844-4a3f-b9b8-2cb1d4c41644:
:: performing fsck on 'dev/mapper/cryptroot'
:: mounting '/dev/mapper/cryptroot' on real root
mount: /new_root: mount(2) system call failed: No such file or directory.
    dmesg(1) may have more information after failed mount system call.
ERROR: Failed to mount '/dev/mapper/cryptroot' on real root
You are now being dropped into an emergency shell.
sh: can't access tty; job control turned off
[rootfs ~]# _

Offline

#3 2024-03-24 14:21:25

ua4000
Member
Registered: 2015-10-14
Posts: 419

Re: [SOLVED] efibootmgr + btrfs + luks wont boot

fstab: subvol=/
rootflags=subvol=@
subvol does not match. Do you have a subvolume on the BTRFS or not ?

P.S. you don't need a fstab line for "/" at all if you put  everything in the rootflags with comma separated, e.g.
rootflags=rw,relatime,compress=zstd:3,ssd,subvol=@

Last edited by ua4000 (2024-03-24 14:22:42)

Offline

#4 2024-03-24 14:32:14

Iriomote
Member
Registered: 2013-11-10
Posts: 29

Re: [SOLVED] efibootmgr + btrfs + luks wont boot

ua4000 wrote:

fstab: subvol=/
rootflags=subvol=@
subvol does not match. Do you have a subvolume on the BTRFS or not ?

P.S. you don't need a fstab line for "/" at all if you put  everything in the rootflags with comma separated, e.g.
rootflags=rw,relatime,compress=zstd:3,ssd,subvol=@


That was it, thanks. I'm new to btrfs so I don't know yet how to work with subvolumes.
I changed "rootflags=subvol=@" to "rootflags=subvol=/" and that did the trick.

I like to keep the options in the fstab, so I don't have to edit the kernel parameters every time.

Last edited by Iriomote (2024-03-24 14:33:10)

Offline

Board footer

Powered by FluxBB