Skip to content

osinfo: default LUKS pbkdf memory and parallelism, log the disk.yaml found - #2727

Merged
supakeen merged 2 commits into
osbuild:mainfrom
andrewdunndev:bootc-disk-yaml-luks-defaults
Oct 5, 2026
Merged

supakeen merged 2 commits into
osbuild:mainfrom
andrewdunndev:bootc-disk-yaml-luks-defaults

Conversation

@andrewdunndev

Copy link
Copy Markdown
Contributor

A luks payload in a bootc disk.yaml can now leave out pbkdf.memory and pbkdf.parallelism. Reading the file fills in the org.osbuild.luks2.format stage defaults, 32 and 1, so NewLUKS2CreateStage no longer panics on the zero values. iterations has no stage default and stays required.

The second commit logs the path of the disk.yaml it finds, so bootc-image-builder --verbose shows which file the disk definitions came from.

Both changes were suggested in #2609.

A `luks` payload in a bootc `disk.yaml` that leaves out `pbkdf.memory`
or `pbkdf.parallelism` makes the build panic, because the LUKS2 format
stage options reject zero for both. The `org.osbuild.luks2.format`
stage itself treats them as optional and uses 32 and 1, so fill in the
same values when the `disk.yaml` is read. See [1].

[1]: osbuild#2609

Signed-off-by: Andrew Dunn <[email protected]>
Log the path of the `disk.yaml` that is read, so that
`bootc-image-builder --verbose` shows which file in the container the
disk definitions came from. See [1].

[1]: osbuild#2609

Signed-off-by: Andrew Dunn <[email protected]>
@supakeen

Copy link
Copy Markdown
Member

Thanks! I've approved CI, I'll take a look at the code more in depth soon. A question up front: could zero values be actual values here? E.g, do we want to be able to actually set them to zero or do we not? 🙂

@supakeen
supakeen self-requested a review September 29, 2026 18:35
@andrewdunndev

Copy link
Copy Markdown
Contributor Author

Zero can't be a real value for either today. validate() requires memory between 32 and 4194304 and parallelism between 1 and 4, and the osbuild stage schema has the same minimums for argon2, so a zero fails now as the panic. The one behaviour change is that an explicit memory: 0 or parallelism: 0 in a disk.yaml becomes 32 or 1.

I did notice the stage itself skips --pbkdf-memory and --pbkdf-parallel when it gets a zero, which would leave cryptsetup on its own defaults, though the schema's minimums reject a zero before that. Was that meant as a way to let cryptsetup choose?

On the disk.yml question in #2609: that was deliberate. The loader is right to look for disk.yaml, but a file saved as disk.yml is skipped without a sign, which the new log line makes visible.

@andrewdunndev

Copy link
Copy Markdown
Contributor Author

The 32 and 1 in this PR are the stage's defaults and also its minimums. The built-in LUKS image types use the same values with a cipher_null placeholder and the passphrase osbuild, so nothing rests on the KDF there. A disk.yaml that sets a real passphrase and leaves out memory now gets the minimum without being asked, where before it panicked. Is the stage minimum the default you want for disk.yaml, or should it be higher here?

With the defaults in place disk.yaml no longer reaches the panic, so I left validate() as it is instead of the error I'd offered in #2609.

@supakeen supakeen left a comment

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.

Thanks look good to me, thank you! The wording of the log message can be changed later if we need to; and it's not being output anyhow.

@avitova avitova left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM:) Thanks for insights in the discussion:) I only have one question, maybe mainly for Simon.
Do we want to set the default here in osinfo.go? This codepath is not executed everywhere, as I understand this, this is used only for bootc. Is this something we would like to put into luks.go to be executed maybe during Unmarshaling the JSON (and thus also for distrodefs)? If not, why only bootc?

@supakeen

supakeen commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

LGTM:) Thanks for insights in the discussion:) I only have one question, maybe mainly for Simon. Do we want to set the default here in osinfo.go? This codepath is not executed everywhere, as I understand this, this is used only for bootc. Is this something we would like to put into luks.go to be executed maybe during Unmarshaling the JSON (and thus also for distrodefs)? If not, why only bootc?

That's a good question. This way of setting defaults needs to be applied anywhere we load a partition table from YAML (or JSON) and we do it directly in osinfo for disk.yaml I can see moving the defaults function into luks.go (maybe only once we need to?) but I don't think we can move calling it into a place where it's shared between the two at a glance or do you want to put it into a custom unmarshaller for the type? That could work and I didn't think of it, but maybe a smaller potential blast radius is nice initially? I am unsure :)

@avitova avitova left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's a good question. This way of setting defaults needs to be applied anywhere we load a partition table from YAML (or JSON) and we do it directly in osinfo for disk.yaml I can see moving the defaults function into luks.go (maybe only once we need to?) but I don't think we can move calling it into a place where it's shared between the two at a glance or do you want to put it into a custom unmarshaller for the type? That could work and I didn't think of it, but maybe a smaller potential blast radius is nice initially? I am unsure :)

Okay, let's leave this in osinfo for now. Our distrodefs have all this information, and this fixes not having memory and parallelism in bootc's disk.yaml. :)

@avitova avitova left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ooops, forgot to hit approve.

@supakeen
supakeen added this pull request to the merge queue Oct 5, 2026
Merged via the queue into osbuild:main with commit 1ce6055 Oct 5, 2026
54 checks passed
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.

3 participants