Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luks: make sure cryptsetup.target is installed #493

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

LaszloGombos
Copy link
Contributor

@LaszloGombos LaszloGombos commented Oct 12, 2024

dracut v103 introduced systemd-cryptsetup.

dracut v104 requires systemd-cryptsetup for cryptsetup.target
(dracut-ng/dracut-ng@ad52085.

CC @BtbN @Cornelicorn

@Cornelicorn
Copy link

dracut v103 introduced systemd-cryptsetup.

dracut v104 requires systemd-cryptsetup for cryptsetup.target (dracut-ng/dracut-ng@ad52085.

CC @BtbN @Cornelicorn

I tested this change before reporting it in the dracut-ng matrix room.
But the problem still shows with this:

dracut[I]: *** Including module: clevis ***
Failed to add dependency on unit: Unit cryptsetup.target does not exist
dracut[I]: *** Including module: clevis-pin-null ***
dracut[I]: *** Including module: clevis-pin-sss ***
dracut[I]: *** Including module: clevis-pin-tang ***
dracut[I]: *** Including module: clevis-pin-tpm2 ***
dracut[I]: *** Including module: btrfs ***
dracut[I]: *** Including module: crypt ***
dracut[I]: *** Including module: dm ***
dracut[I]: *** Including module: kernel-modules ***
dracut[I]: *** Including module: kernel-modules-extra ***
dracut[I]: *** Including module: kernel-network-modules ***
dracut[I]: *** Including module: systemd-cryptsetup ***

clevis is included before systemd-cryptsetup and the target doesn't exist yet.

@Cornelicorn
Copy link

dracut v103 introduced systemd-cryptsetup.
dracut v104 requires systemd-cryptsetup for cryptsetup.target (dracut-ng/dracut-ng@ad52085.
CC @BtbN @Cornelicorn

I tested this change before reporting it in the dracut-ng matrix room. But the problem still shows with this:

dracut[I]: *** Including module: clevis ***
Failed to add dependency on unit: Unit cryptsetup.target does not exist
dracut[I]: *** Including module: clevis-pin-null ***
dracut[I]: *** Including module: clevis-pin-sss ***
dracut[I]: *** Including module: clevis-pin-tang ***
dracut[I]: *** Including module: clevis-pin-tpm2 ***
dracut[I]: *** Including module: btrfs ***
dracut[I]: *** Including module: crypt ***
dracut[I]: *** Including module: dm ***
dracut[I]: *** Including module: kernel-modules ***
dracut[I]: *** Including module: kernel-modules-extra ***
dracut[I]: *** Including module: kernel-network-modules ***
dracut[I]: *** Including module: systemd-cryptsetup ***

clevis is included before systemd-cryptsetup and the target doesn't exist yet.

I think the solution would only be the reorder if this should be fixed here, i.e. installing this as 91clevis or something higher.
This is due to the way the module dependencies are only checked for including modules but not for ordering modules, see https://github.com/dracut-ng/dracut-ng/blob/main/dracut.sh#L1971

@Cornelicorn
Copy link

The imminent problem is solved by https://github.com/dracut-ng/dracut-ng/pull/711, but the dependency should still be updated.

Copy link
Collaborator

@sergio-correia sergio-correia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good to me.

@sergio-correia sergio-correia merged commit 4fc8130 into latchset:master Nov 7, 2024
12 checks passed
@oldium
Copy link
Contributor

oldium commented Nov 9, 2024

This change is unfortunately not backwards-compatible, it breaks usage with pre-v103 Dracut.

Another thing is that $systemdsystemunitdir/cryptsetup.target is installed by both 90systemd-cryptsetup in v103 and 10systemd-cryptsetup in v105, so there is no need to install it. Also Clevis units do not depend on it.

I am testing my latest TPM 1.2 change currently, so I might come-up with a fix for this :-)

@oldium
Copy link
Contributor

oldium commented Nov 9, 2024

Fixed in #501

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants