dracutdevs / dracut

dracut the event driven initramfs infrastructure
https://github.com/dracutdevs/dracut/wiki
GNU General Public License v2.0
599 stars 399 forks source link

LVM+LUKS.KEY (without kernel modules) only 055 is working #2283

Closed Anoncheg1 closed 2 months ago

Anoncheg1 commented 1 year ago

Describe the bug OS Gentoo. I compile kernel from sources. After version 055 it does not load gpg encrypted key file. I do not have files in /lib/modules/6.1.12-gentoo/ it is OK for me.

I was trying with encrypted keydev in place of GPG keyfile on an unencrypted dive. It gives error:

dm_crypt was not found in /lib/modules/6.1.12-gentoo/

but in my kernel .config I have:

COMFIG_DM_CRYPT=y

Dracut version 057 059

Init system OpenRC

To Reproduce

udevdir=/lib/udev
ro_mnt=yes
omit_drivers+=" i2o_scsi "

# for rd.luks.key
omit_dracutmodules+=" systemd systemd-initrd dracut-systemd i18n systemd-udevd "

# dm crypt
add_dracutmodules+=" lvm btrfs crypt-gpg "
filesystems+=" btrfs "
early_microcode="no"
show_modules="yes"
use_fstab="yes"
hostonly="yes"
#
kernel_cmdline="rd.luks.key=/file.gpg:UUID=uidhere rd.luks.uuid=luks-xxx rd.luks rd.lvm rd.lvm.vg=vg0 rd.lvm.lv=vg0/root root=/dev/mapper/vg0-root rootfstype=btrfs rootflags=rw,noatime,nodiratime,compress=lzo,ssd,noacl,space_cache=v2,subvolid=5,subvol=/ "
# rd.shell rd.debug
kernel_image="/boot/vmlinuz-6.1.12-gentoo"

add_drivers+=" i915 " # for X11 earlt KMS
LaszloGombos commented 1 year ago

@Anoncheg1 Are you in a position to try this PR - https://github.com/dracutdevs/dracut/commit/e3e8108eb75247249ec05eaba943c3f48637c04b and report back ? Thanks .

Anoncheg1 commented 1 year ago

I try master branch newest version right now. It now asks for password, but then freeze. I use SD card in USB reader as USB. It would be good to have support for both USB and SD readers. Here is screens:

boot at version 055 freez at bleeding adge Please fix it.

LaszloGombos commented 1 year ago

@Anoncheg1 You posted 2 boot logs, but I do not see it described what are these logs.

The boot first log seems to succeed. Have you just posted this for reference ?

1./ One difference between the first and second log seems to be this line:

EXT-4fs (sdb1): unmounting filesystem

Why is this happening ? This is very unusual. Can you please help troubleshooting with rd.debug ?

2./ Could you please try to make sure that btrfs-progs are either not installed or the binaries are not copied into the generated initramfs.

Perhaps you can try not to include the btrfs dracut module and inly include the btrfs kernel module/fileystsem support. Somewhat similar discussion here - https://www.reddit.com/r/voidlinux/comments/p5x44f/void_linux_hang_on_scanning_for_btrfs_file_systems/

Anoncheg1 commented 1 year ago

I removed btrfs - it solved problem for "no LVM" encryption.

I have two laptops: 1) without LVM - now it boot with latest version 2) with lvm - still error: "Wrong password" - no error messages. But 055 version working.

"Wrong password" with LVM volumes and rd.luks.key.

udevdir=/lib/udev
ro_mnt=yes
omit_drivers+=" i2o_scsi "

# for rd.luks.key
omit_dracutmodules+=" systemd systemd-initrd dracut-systemd i18n systemd-udevd "

# dm crypt #btrfs
add_dracutmodules+=" lvm crypt-gpg "
# filesystems+=" btrfs "
early_microcode="no"
show_modules="yes"
use_fstab="yes"
hostonly="yes"
kernel_cmdline="rd.luks.key=/file.gpg:UUID=xxxx rd.luks.uuid=luks-xxxx rd.luks.key.tout=10 rd.luks=1 rd.lvm=1 rd.lvm.vg=vg0 rd.lvm.lv=vg0/root root=/dev/mapper/vg0-root rootfstype=btrfs rootflags=rw,noatime,nodiratime,compress=lzo,ssd,noacl,space_cache=v2,subvolid=5,subvol=/ ipv6.disable=1 mds=full,nosmt"
# rd.shell rd.debug
kernel_image="/boot/vmlinuz-linux-6.1.28-gentoo"

add_drivers+=" i915 "
Anoncheg1 commented 2 months ago

Error disapeared.

          gentoo sys-kernel/dracut-060_pre20240104-r4

          dracut --version
          dracut 060

installed packages

           sys-kernel/dracut 
          sys-boot/grub 
          sys-fs/lvm2
          sys-fs/cryptsetup  
          sys-apps/busybox
          app-shells/dash

Gentoo patches. idk maybe one of them fix this issue. dracut-060-fix-resume-hostonly.patch dracut-060-grub-layout.patch dracut-060-systemd-255.patch