Skip to content

Regression between 101 and 102: LUKS root filesystem is broken #333

@LaserEyess

Description

@LaserEyess

Describe the bug
When upgrading to 102, and after adding systemd-cryptsetup as a module, automatic decryption with a tpm2 locked root drive no longer works.

Distribution used
Arch Linux

Dracut version
102

Init system
systemd

To Reproduce
Use systemd-cryptsetup to bind a LUKS root partition to a TPM device, then add

add_dracutmodules=" tpm2-tss systemd-cryptsetup "

To your config along with the corresponding commandline options:

root=/dev/mapper/root rw rd.luks.name=$UUID=root rd.luks.options=no-read-workqueue,no-write-workqueue,tpm2-device=auto

Expected behavior
Auto decyption of root if tpm pcr conditions are met

Downgrading to dracut 101 works.
Additional context
Logs of the failed boot on 102 (truncated):

May 31 18:09:12 charlotte systemd[1]: Starting Cryptography Setup for luks-2f3c07db-91ed-4233-bd13-82a37b8996e0...
May 31 18:09:12 charlotte systemd-cryptsetup[648]: Encountered unknown /etc/crypttab option '-', ignoring.
May 31 18:09:13 charlotte kernel: BTRFS: device label rootfs devid 1 transid 1462895 /dev/dm-0 scanned by (udev-worker) (425)
May 31 18:09:13 charlotte systemd[1]: Found device /dev/mapper/root.
May 31 18:09:13 charlotte systemd[1]: Reached target Initrd Root Device.
May 31 18:09:13 charlotte systemd[1]: systemd-cryptsetup@root.service: Deactivated successfully.
May 31 18:09:13 charlotte systemd[1]: Started systemd-cryptsetup@root.service.
May 31 18:09:14 charlotte systemd-cryptsetup[648]: Cannot use device /dev/nvme0n1p2 which is in use (already mapped or mounted).
May 31 18:09:14 charlotte systemd[1]: Started Dispatch Password Requests to Console.
May 31 18:09:14 charlotte systemd-tty-ask-password-agent[685]: Starting password query on /dev/tty1.

Also I have a remote shell and logging in shows /dev/mapper/root mounted properly. Entering the password to decrypt works but it gives these errors:

May 31 18:12:33 charlotte systemd-tty-ask-password-agent[685]: Starting password query on /dev/tty1.
May 31 18:12:49 charlotte systemd-cryptsetup[648]: Set cipher aes, mode xts-plain64, key size 256 bits for device /dev/nvme0n1p2.
May 31 18:12:52 charlotte systemd-cryptsetup[648]: Cannot use device /dev/nvme0n1p2 which is in use (already mapped or mounted).
May 31 18:12:52 charlotte systemd-cryptsetup[648]: Failed to activate with specified passphrase: Device or resource busy
May 31 18:12:52 charlotte systemd[1]: systemd-cryptsetup@luks\x2d2f3c07db\x2d91ed\x2d4233\x2dbd13\x2d82a37b8996e0.service: Main process exited, code=exited, status=1/FAILURE
May 31 18:12:52 charlotte systemd[1]: systemd-cryptsetup@luks\x2d2f3c07db\x2d91ed\x2d4233\x2dbd13\x2d82a37b8996e0.service: Failed with result 'exit-code'.
May 31 18:12:52 charlotte systemd[1]: Failed to start Cryptography Setup for luks-2f3c07db-91ed-4233-bd13-82a37b8996e0.
May 31 18:12:52 charlotte systemd[1]: Dependency failed for Local Encrypted Volumes.
May 31 18:12:52 charlotte systemd[1]: cryptsetup.target: Job cryptsetup.target/start failed with result 'dependency'.
May 31 18:12:52 charlotte dracut-initqueue[647]: A dependency job for cryptsetup.target failed. See 'journalctl -xe' for details.
May 31 18:12:52 charlotte systemd[1]: systemd-cryptsetup@luks\x2d2f3c07db\x2d91ed\x2d4233\x2dbd13\x2d82a37b8996e0.service: Consumed 15.623s CPU time.

Logs from a successful boot on 101

Jun 03 16:09:06 charlotte systemd[1]: Starting Cryptography Setup for root...
Jun 03 16:09:08 charlotte kernel: BTRFS: device label rootfs devid 1 transid 1470172 /dev/dm-0 scanned by (udev-worker) (439)
Jun 03 16:09:08 charlotte systemd[1]: Found device /dev/mapper/root.
Jun 03 16:09:08 charlotte systemd[1]: Finished Cryptography Setup for root.

Please let me know what other information is helpful here. I suspect the generation of the /etc/crypttab got broken some how, but I'm not sure how.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugOur bugscryptIssues related to the crypt moduleregression

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions