Skip to content

bootc: use the DPS root partition type, drop XBOOTLDR for UKI images - #2719

Merged
supakeen merged 3 commits into
osbuild:mainfrom
cgwalters-forge:bot/bootc-dps-root
Sep 28, 2026
Merged

supakeen merged 3 commits into
osbuild:mainfrom
cgwalters-forge:bot/bootc-dps-root

Conversation

@cgwalters-bot

@cgwalters-bot cgwalters-bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Disks built from a bootc image with a UKI boot to emergency mode: the UKI command line normally has no root=, so the initrd relies on systemd-gpt-auto-generator, and our default table types the root partition as generic Linux data.

When the container has a UKI, this PR changes the default bootc partition table in two ways:

  • It gives the root partition the per-architecture Discoverable Partitions Specification root type, like bootc install to-disk does. That's the expected default for UKIs, not a hard requirement, so a table embedded in the container keeps its types. Other bootc images keep the generic type and are unchanged.
  • It drops the XBOOTLDR partition, which would stay empty; without an fstab, gpt-auto mounts it on /boot, which breaks the ESP automount (see below).
    • A /boot filesystem or disk customization is now rejected for UKI images with a clear error, instead of re-creating the empty XBOOTLDR.
    • A partition extra exporting /boot fails early with a UKI-specific message; before, it failed later with "partition for mountpoint not found".

A partition table embedded in the container is left alone, apart from ensure_xbootldr. The ESP keeps its default size; how big the ESP should be is better left to the container, e.g. via repart.d (bootc-dev/bootc#2314).

Testing (16-core RHEL 10 devspace cgwalters-devspace-36152612363):

  • go test on ./pkg/distro/... ./pkg/disk/... ./pkg/manifest/... ./pkg/manifestgen/... ./pkg/image/... ./cmd/image-builder/... passes. tools/gen-manifest-checksums.sh was run on each commit and changes no checksums, since none of the test configs have a UKI.
  • bootc-image-builder was built from this branch with bootc-image-builder/Containerfile. The test image was an unsealed UKI + systemd-boot composefs image from bootc main (variant=composefs bootloader=systemd boot_type=uki, ext4, based on centos-bootc stream10), moved to root storage as an OCI archive. The qcow2 has BIOS boot, a 501 MiB ESP and a DPS root. Under UEFI qemu-kvm it boots to a login prompt, the ESP is on /boot (104M used, one 103 MiB UKI), bootc status shows the booted composefs image, and the system is running. With main, the same image drops to emergency mode. In an earlier round with only the DPS type and XBOOTLDR kept, gpt-auto mounted the empty XBOOTLDR on /boot and the system was degraded.
  • quay.io/centos-bootc/centos-bootc:stream10 (grub/ostree): the partition types of the qcow2 are the same as with main (root 0FC63DAF), the bootc-image-builder manifest output differs from main only in random filesystem UUIDs, and the disk boots to a login prompt with the system running.
  • image-builder manifest --bootc-ref <uki> with a /boot filesystem customization fails with a /boot partition is not supported for bootc containers with a unified kernel (UKI): the UKI is installed into the ESP (earlier round, same code).

Caveat: btrfs and LVM root volumes from a disk customization still get the generic data type (in pkg/disk, all image types), so UKI images with such a layout still won't find their root.

Related: #2337

Generated-by: https://github.com/cgwalters/#llms

Comment thread pkg/distro/defs/bootc_image_test.go Outdated
assert.Equal(t, "vfat", mnt.GetFSType())
}

// A UKI has no root= karg and relies on systemd-gpt-auto-generator to find

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.

This isn't strictly true. A UKI could have one, it's just that we want to support the DPS and the DPS is the expected default for UKIs

Would it ever make sense to do something other than the DPS with a UKI? I mean, I'd struggle to articulate one but theoetically..

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

Sure, multi-disk ambiguity (the DPS generally only concerns a single disk and its the same disk that the ESP is on, systemd-gpt-auto-generator / systemd-dissect only scans the disk that contains the ESP that was used to boot); not using systemd, things coming from non-local storage, complex LUKS setups where ordering matters. None of these really matter in the context of bootc sealed images I don't think.

What might make sense but I don't think bootc has any intent to use this is A/B(/C...) root and user partitions. In that case you might still not have a root= karg but you would (likely) have either roothash or a systemd.image_filter to couple a specific slot to a UKI (though I have work-in-progress to do the selection in the systemd dissection through the .osrel section of the UKI so we can drop all kargs).

@cgwalters-bot cgwalters-bot Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed, fixed in 99e9111: the test comment, the setDPSRootPartitionType doc and the commit message of "use the DPS root partition type for bootc UKI images" now say the DPS type is the expected default for UKIs, not a requirement. The rationale now lives only in the function doc; the call site no longer repeats it and the test comment points to it. No behavior change; go test for pkg/disk and pkg/distro/defs and gen-manifest-checksums.sh pass on each commit, with no checksum changes.

On "would it ever make sense": I can't point to a real case for a bootc UKI either. root= in the UKI command line boots with any partition type, but that ties the signed UKI to one disk's UUID. supakeen's cases (multi-disk, non-systemd initrd, network root, LUKS ordering) don't really apply to sealed bootc images. So hardcoding the DPS type for our default table seems right, and a container that wants something else can ship its own partition table.

Generated-by: https://github.com/cgwalters/#llms

Comment thread pkg/distro/defs/bootc_imagetype.go Outdated
basept.Policy.EnsureXBOOTLDR = false
// A partition table that comes from the container is used as-is.
if bd.sourceInfo == nil || bd.sourceInfo.PartitionTable == nil {
// A UKI has no root= karg, so the initrd finds the root

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.

Avoid duplicating comments like this keep source of truth in the function doc

supakeen
supakeen previously approved these changes Sep 25, 2026

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

This is generally OK, we already had the knobs to turn and turning them for sealed images is also OK.

A few remarks but none are any real blocker.

  1. We could still set the type GUID for a disk.yaml-provided partition table if it is lacking in the disk.yaml; when I implemented things for the fedora-atomic-sealed-desktops (https://github.com/travier/fedora-atomic-desktops-sealed/blob/1d75f05d64c75163475cbd80f324e7c1bfb31610/scripts/prepare-rootfs.sh#L107-L109) I explicitly mentioned that we could drop a bunch of code there if we would automatically set GUIDs.
  2. We can actually set the type GUID for btrfs, this will mount the default subvolume, or honor any rootflags that are passed as kargs (like fedora-atomic-sealed-desktops currently does).
  3. For LVM we might want to set the LVM GUID (even if not part of the DPS directly).

All of those can be followups.


Personally I don't particularly like the description of "UKI means systemd-gpt-auto-generator and no XBOOTLDR", that's not the law but it makes sense in this sealed bootc context.

@cgwalters-bot cgwalters-bot moved this to In Review in Composefs Stable Sep 25, 2026
cgwalters-bot added a commit to cgwalters-forge/rhel-bootc-examples that referenced this pull request Sep 26, 2026
`just e2e sealed|unsealed` builds three versions of an example on CentOS
Stream 10 (with bootc from git by default), lints them, makes a qcow2 of
the first with image-builder, boots it under QEMU (with our Secure Boot
keys enrolled for sealed), checks that a composefs deployment booted, then
switches to the second through a local registry and upgrades to the
third. After each reboot (detected by a new boot ID) it checks the booted
image digest against the one the push reported.

image-builder needs root, and its --in-vm doesn't cover the pipeline that
sets up the bootc build root, so it runs as root in a bcvk ephemeral VM.
The SSH key goes in as a systemd credential over SMBIOS, since
image-builder can't customize images with a UKI. The sealed variant needs
an image-builder with osbuild/image-builder#2719, so it refuses to run
without IB_IMAGE rather than failing at boot.

It's in Python like sealing/util/keys.py (stdlib only), and needs KVM, so
it isn't run in CI.

Generated-by: AI
Prep for giving the root partition of bootc images with a UKI its
Discoverable Partitions Specification type.

Generated-by: AI
Disks built from a bootc image with a UKI drop into emergency mode on
first boot: the UKI command line normally has no root=, so the initrd
relies on systemd-gpt-auto-generator to find the root filesystem, and
our default table types the root partition as generic Linux data, which
it ignores.

Make the per-architecture Discoverable Partitions Specification root
type the default for the root partition of the default table when the
container has a UKI, like "bootc install to-disk" does. That's the
expected default for UKIs rather than a hard requirement (a UKI with
root= would boot either way), so a partition table embedded in the
container is left alone. Other bootc images keep the generic type for
now: they boot with root= and changing their layout has wider
implications.

The base table is now copied before it is changed, it is the one from
the YAML definitions (or the container).

Related: osbuild#2337

Generated-by: AI
With a UKI, bootc installs the kernel, initrd and systemd-boot entries
into the ESP, so the 1 GiB XBOOTLDR partition from our default table
stays empty. It is also not harmless: with no fstab,
systemd-gpt-auto-generator mounts it on /boot, and efi.automount for
the ESP then fails, leaving the booted system degraded. Without it the
ESP is mounted on /boot, which is the layout the sealed image work
converged on and what users currently get by writing their own disk
customization.

For the same reason, reject a /boot filesystem or disk customization
for UKI images instead of re-creating an empty XBOOTLDR, and don't
auto-create one for btrfs or LVM disk customizations either. A
partition table embedded in the container is left alone, apart from
its ensure_xbootldr policy; the rest of its policy is kept.

Partition extras are part of every disk manifest, so a UKI container
whose extras.yaml exports /boot (the documented example) would now
fail any disk build with "partition for mountpoint not found"; report
that early with a UKI-specific message instead.

Generated-by: AI
@cgwalters-bot

Copy link
Copy Markdown
Contributor Author

Rebased onto main; 3 commits, no content change.

Generated-by: https://github.com/cgwalters/#llms

@supakeen

supakeen commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

Rebased onto main; 3 commits, no content change.

Generated-by: https://github.com/cgwalters/#llms

Please don't do this unless there are conflicts, we have a merge queue and it means I keep having to retrigger CI (since you're an external contributor) to keep this PR green to get it into the queue in the future.

@cgwalters-bot

Copy link
Copy Markdown
Contributor Author

Understood, sorry about that. The bot will only rebase this repository's PRs when there are conflicts from now on.

Generated-by: https://github.com/cgwalters/#llms

cgwalters-bot added a commit to cgwalters-bot/homegit that referenced this pull request Sep 26, 2026
The coordinator rebased osbuild/image-builder#2719 because bot-watch
listed it as behind, and a maintainer asked us to stop: with a merge
queue, the queue tests the PR against the current base anyway, and each
push from an outside contributor means someone approving CI again.

So where 'upstream-policy rebase' says conflicts-only (a merge queue, or
the record's say-so), bot-watch no longer lists conflict-free upstream
PRs as needing a rebase, and 'bot-pr rebase' refuses them unless
--force-merge-queue. Conflicting PRs still get rebased, since that's
the one thing the maintainers can't do for us. Fork PRs are unaffected:
their pushes run nothing upstream.

If detection fails, bot-watch lists the PR anyway and bot-pr refuses,
so the refusal stays in one place.

Generated-by: AI

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

This all LGTM. Small question though:

Other bootc images keep the generic type for now: they boot with root= and changing their layout has wider implications.

(from the second commit message)

What are the implications exactly? What stops us from setting the correct partition type in all cases?

@cgwalters

Copy link
Copy Markdown
Contributor

The bot will only rebase this repository's PRs when there are conflicts from now on.

I mean, maybe, my harness somewhat intentionally doesn't have "memory" in that form. Is instructions for this in your CONTRIBUTING.md (and AGENTS.md)? Looking at https://github.com/osbuild/image-builder/blob/main/CONTRIBUTING.md seems not

What stops us from setting the correct partition type in all cases?

It would absolutely make sense to try to do the DPS across the board by default, but it did break some surprising things because e.g. suddenly systemd-gpt-auto-generator will start mounting some things when it didn't before.

See ostreedev/ostree#3608 (comment) which was triggered by a secondary level of this (but needs one to be using the DPS for the root disk to hit).

There's some lingering conflicts between historical Fedora-derivative setups/meaning for /boot (and /efi isn't present by default at all) etc.

@supakeen
supakeen added this pull request to the merge queue Sep 28, 2026
Merged via the queue into osbuild:main with commit fd7dc5c Sep 28, 2026
52 of 54 checks passed
cgwalters-bot added a commit to cgwalters-forge/rhel-bootc-examples that referenced this pull request Sep 29, 2026
`just e2e sealed|unsealed` builds three versions of an example on CentOS
Stream 10 (with bootc from git by default), lints them, makes a qcow2 of
the first with image-builder, boots it under QEMU (with our Secure Boot
keys enrolled for sealed), checks that a composefs deployment booted, then
switches to the second through a local registry and upgrades to the
third. After each reboot (detected by a new boot ID) it checks the booted
image digest against the one the push reported.

image-builder needs root, and its --in-vm doesn't cover the pipeline that
sets up the bootc build root, so it runs as root in a bcvk ephemeral VM.
The SSH key goes in as a systemd credential over SMBIOS, since
image-builder can't customize images with a UKI. The sealed variant needs
an image-builder with osbuild/image-builder#2719, so it refuses to run
without IB_IMAGE rather than failing at boot.

It's in Python like sealing/util/keys.py (stdlib only), and needs KVM, so
it isn't run in CI.

Generated-by: AI
cgwalters-bot added a commit to cgwalters-forge/rhel-bootc-examples that referenced this pull request Sep 29, 2026
`just e2e sealed|unsealed` builds three versions of an example on CentOS
Stream 10 (with bootc from git by default), lints them, makes a qcow2 of
the first with image-builder, boots it under QEMU (with our Secure Boot
keys enrolled for sealed), checks that a composefs deployment booted, then
switches to the second through a local registry and upgrades to the
third. After each reboot (detected by a new boot ID) it checks the booted
image digest against the one the push reported.

image-builder needs root, and its --in-vm doesn't cover the pipeline that
sets up the bootc build root, so it runs as root in a bcvk ephemeral VM.
The SSH key goes in as a systemd credential over SMBIOS, since
image-builder can't customize images with a UKI. The sealed variant needs
an image-builder with osbuild/image-builder#2719, so it refuses to run
without IB_IMAGE rather than failing at boot.

It's in Python like sealing/util/keys.py (stdlib only), and needs KVM, so
it isn't run in CI.

Generated-by: AI
cgwalters-bot added a commit to cgwalters-forge/rhel-bootc-examples that referenced this pull request Sep 29, 2026
`just e2e sealed|unsealed` builds three versions of an example on CentOS
Stream 10 (with bootc from git by default), lints them, makes a qcow2 of
the first with image-builder, boots it under QEMU (with our Secure Boot
keys enrolled for sealed), checks that a composefs deployment booted, then
switches to the second through a local registry and upgrades to the
third. After each reboot (detected by a new boot ID) it checks the booted
image digest against the one the push reported.

image-builder needs root, and its --in-vm doesn't cover the pipeline that
sets up the bootc build root, so it runs as root in a bcvk ephemeral VM.
The SSH key goes in as a systemd credential over SMBIOS, since
image-builder can't customize images with a UKI. The sealed variant needs
an image-builder with osbuild/image-builder#2719, so it refuses to run
without IB_IMAGE rather than failing at boot.

It's in Python like sealing/util/keys.py (stdlib only), and needs KVM, so
it isn't run in CI.

Generated-by: AI
cgwalters-bot added a commit to cgwalters-forge/rhel-bootc-examples that referenced this pull request Oct 8, 2026
`just e2e sealed|unsealed` builds three versions of an example on CentOS
Stream 10 (with bootc from git by default), lints them, makes a qcow2 of
the first with image-builder, boots it under QEMU (with our Secure Boot
keys enrolled for sealed), checks that a composefs deployment booted, then
switches to the second through a local registry and upgrades to the
third. After each reboot (detected by a new boot ID) it checks the booted
image digest against the one the push reported.

image-builder needs root, and its --in-vm doesn't cover the pipeline that
sets up the bootc build root, so it runs as root in a bcvk ephemeral VM.
The SSH key goes in as a systemd credential over SMBIOS, since
image-builder can't customize images with a UKI. The sealed variant needs
an image-builder with osbuild/image-builder#2719, so it refuses to run
without IB_IMAGE rather than failing at boot.

It's in Python like sealing/util/keys.py (stdlib only), and needs KVM, so
it isn't run in CI.

Generated-by: AI
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