Skip to content

Worktree fix luks soft reboot#2219

Open
prestist wants to merge 1 commit into
coreos:mainfrom
prestist:worktree-fix-luks-soft-reboot
Open

Worktree fix luks soft reboot#2219
prestist wants to merge 1 commit into
coreos:mainfrom
prestist:worktree-fix-luks-soft-reboot

Conversation

@prestist
Copy link
Copy Markdown
Collaborator

@prestist prestist commented Apr 8, 2026

Add x-initrd.attach option unconditionally to all LUKS crypttab entries.
This prevents systemd-cryptsetup-generator from adding
Conflicts=umount.target, which is necessary for soft-reboot to work
correctly with LUKS.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces logic to detect if the system is running on ostree and updates the crypttab generation to include the 'x-initrd.attach' option when necessary. I have identified an issue where the ostree marker file is incorrectly being checked within the target sysroot instead of the host's runtime directory. Additionally, I have suggested updating the detection logic to support an environment variable override for better testability and recommended updating the test case to verify the full crypttab output.

Comment thread internal/exec/stages/files/filesystemEntries.go Outdated
Comment thread internal/exec/stages/files/filesystemEntries.go Outdated
Comment thread tests/positive/luks/crypttab.go Outdated
@prestist prestist force-pushed the worktree-fix-luks-soft-reboot branch 2 times, most recently from 7d58038 to 774a042 Compare April 8, 2026 20:43
@prestist prestist marked this pull request as ready for review May 6, 2026 16:03
@travier
Copy link
Copy Markdown
Member

travier commented May 7, 2026

This looks OK. But why is this CoreOS specific? Isn't Image Mode / bootc in the same boat here?

@prestist
Copy link
Copy Markdown
Collaborator Author

prestist commented May 7, 2026

@travier ah im sorry, yeah my description was a little too specific sounding, I was just giving examples. The changes also would fix it for bootc / Image Mode. I will update the description.

Unless you were talking more about why I was conditionality pivoting for ostree systems only?


// Detect if we're on an ostree system
// Check the host's /run directory, not the target sysroot
isOstree := isOstreeSystem("/run/ostree-booted")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hum, I don't think this file will exist at the time ignition runs. We might have to look at the kernel command line and see if ostree is in it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Hmm, I think /run/ostree-booted should actually exist by the time the files stage runs -- ostree-prepare-root.service has Before=initrd-root-fs.target and ignition-files.service runs after that target. But yeah, checking the kernel cmdline for ostree= is probably the better approach here --since that seems to be what all the other ostree initrd services do (like ignition-ostree-mount-var.service etc) and doesn't depend on another service having already run. I'll switch to that.

@travier
Copy link
Copy Markdown
Member

travier commented May 12, 2026

I think my question is: What happens on Image Mode? If you take a bootc image and install it via Anaconda, does soft-reboot works? Is it anaconda that does the same workaround that we are adding here? Then adding it to Ignition makes sense as we use it instead of Anaconda. Otherwise if this does not work on Image Mode then we should probably figure out a fix that does not rely on Ignition.

@prestist
Copy link
Copy Markdown
Collaborator Author

I think my question is: What happens on Image Mode? If you take a bootc image and install it via Anaconda, does soft-reboot works? Is it anaconda that does the same workaround that we are adding here? Then adding it to Ignition makes sense as we use it instead of Anaconda. Otherwise if this does not work on Image Mode then we should probably figure out a fix that does not rely on Ignition.

oooh that is a very fair concern, to be honest I am not sure; I can do some research but it is out of my initial knowledge scope.

@prestist
Copy link
Copy Markdown
Collaborator Author

prestist commented May 12, 2026

Alright so I did look into anaconda, its doing the same thing mostly. Its adding x-initrd.attach unconditionally for any LUKS device. @travier , In which case maybe we just drop our conditional. Makes it cleaner?

rhinstaller/anaconda#6785

Add x-initrd.attach option unconditionally to all LUKS crypttab entries.
This prevents systemd-cryptsetup-generator from adding
Conflicts=umount.target, which is necessary for soft-reboot to work
correctly with LUKS.
@prestist prestist force-pushed the worktree-fix-luks-soft-reboot branch from 774a042 to 01d9516 Compare May 13, 2026 13:47
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.

2 participants