Skip to content

osbuild: support LUKS devices in bootupd stage - #2708

Merged
supakeen merged 1 commit into
osbuild:mainfrom
ArtiomDivak:osbuild-luks-support
Oct 20, 2026
Merged

supakeen merged 1 commit into
osbuild:mainfrom
ArtiomDivak:osbuild-luks-support

Conversation

@ArtiomDivak

Copy link
Copy Markdown

Generate LUKS2 devices and mount their contained filesystems for bootupd. Add tests for valid and invalid LUKS payloads.

@ArtiomDivak
ArtiomDivak requested a review from a team as a code owner September 22, 2026 09:25

type LUKS2DeviceOptions struct {
Passphrase string `json:"passphrase"`
Partnum *int `json:"partnum,omitempty"`

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yeah, I wanted to open a discussion in the Slack channel. These changes will require changes in the osbuild code.

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.

Given that the parent device (org.osbuild.loopback) can easily be created to reference a specific partition (by offset and size), I don't think this is necessary and just adds extra complexity to the stage.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I tried to add loopback for the LUKS partition, and it didn't work.
After the creation of the bootc install to-filesystem runs, and when it gets the LUKS loopback (as it has the /sysroot), it fails because it cannot find the EFI. I tried to add the --device option to bootc to navigate it to the real disk, but bootc does not expose this option currently. It needs changes in the osbuild to get the device and use it. WDYT? Should we go with the partnum solution, or should I keep trying to do the loopback option?

@achilleas-k achilleas-k Sep 25, 2026 •

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.

Interesting. Silly of me to assume that the details of the backing device shouldn't matter but it doesn't surprise me that bootc gets tripped up by it. I'd be interested to see a minimal reproducer for the failure, out of curiosity, but based on what you're saying, it sounds like we'll have to add the partition number to the luks device module like you said.
Have you tested the solution in this PR already?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hi @achilleas-k ,
I will share the error with you.
AIB run.txt
The way I run it is I use AIB with my changes to add LUKS.
So it starts with AIB and fails in the image builder.
In the error files, you can see that

device/luks-partition-5 (org.osbuild.loopback): loop1 acquired 
so LUKS takes /dev/loop1

and the error that fails is

[WARN  bootupd::bootupd] Skipping device /dev/loop1 for EFI: ESP partition not found on /dev/loop1
error: boot data installation failed: installing component EFI to device (auto): No device specified and no mounted ESP found
error: Installing to filesystem: Installing bootloader: Failed to run command: Command {
    program: "bootupctl",
    args: [
        "bootupctl",
        "backend",
        "install",
        "--write-uuid",
        "--filesystem",
        "/sysroot",
        "/",
    ],
    env: CommandEnv {
        clear: true,
        vars: {
            "PATH": Some(
                "/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin",
            ),
        },
    },
    create_pidfd: false,
}

which means that bootupctl tried to find EFI in loop1 but can't, as it only contains the file system.

Have you tested the solution in this PR already?

If you mean locally with AIB changes and osbuild changes and with partnum, then yes.
I ran AIB and got the raw image, checked inside the raw image, and saw the LUKS-encrypted file system.

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.

I guess we'll have to add the partnum to luks2 device then. Have you prepared the patch for osbuild to support this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes I do have. I will push MR to the osbuild.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

We will be able to merge it only after the osbuild release, right?
If yes, when is the new osbuild release scheduled?

@achilleas-k

Copy link
Copy Markdown
Member

Should be good to go now

@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.

Sorry, yes this is good like this. @ArtiomDivak this fell out of my visibility because I had already reviewed. If you want you can hit the 're-request' review in the PR on my name so it pops up in my list of PRs (maybe for next time) or reach out elsewhere.

@supakeen
supakeen enabled auto-merge October 19, 2026 15:59
Generate LUKS2 devices and mount their contained filesystems for bootupd. Add tests for valid and invalid LUKS payloads.

Signed-off-by: Artiom Divak <[email protected]>
auto-merge was automatically disabled October 20, 2026 06:45

Head branch was pushed to by a user without write access

@ArtiomDivak

Copy link
Copy Markdown
Author

Sorry, I thought I needed to wait for the osbuild 194 release

@supakeen
supakeen enabled auto-merge October 20, 2026 07:43
@supakeen
supakeen added this pull request to the merge queue Oct 20, 2026
Merged via the queue into osbuild:main with commit 33d9153 Oct 20, 2026
72 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