Skip to content

Add support for installing to devices with multiple parents#1068

Merged
cgwalters merged 9 commits intocoreos:mainfrom
ckyrouac:multi-device-commit-cleanup
Mar 19, 2026
Merged

Add support for installing to devices with multiple parents#1068
cgwalters merged 9 commits intocoreos:mainfrom
ckyrouac:multi-device-commit-cleanup

Conversation

@ckyrouac
Copy link
Contributor

@ckyrouac ckyrouac commented Mar 5, 2026

See individual commits for details. Generally, this migrates to using the new blockdev crate funtions and standardize on the Device struct operating on block devices. On top of this, handle the --filesystem and multiple --device flags to install the bootloader to multiple devices, e.g. a /dev/md0 RAID1 device backed by 3 physical disks, each with an ESP partition.

Keeping this as a draft because it will break older bootc versions prior to bootc-dev/bootc#2048.

Leaving the TEMP code in to validate CI passes (previously validated on my fork).

@openshift-ci
Copy link

openshift-ci bot commented Mar 5, 2026

Hi @ckyrouac. Thanks for your PR.

I'm waiting for a coreos member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link

@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 is a significant and well-executed refactoring to support installing bootloaders to multiple devices, such as in a RAID setup. The migration to the bootc-internal-blockdev crate and the Device struct is consistently applied across the codebase. The new CLI options --device and --filesystem are sensible additions. The logic for handling multiple devices, especially for EFI where it filters for ESPs, is robust. I've also noticed some nice correctness improvements, like verifying that a VFAT partition is a true mount point. I have a couple of suggestions to fix a potential panic when dealing with relative paths, and one for code simplification.

Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

I didn't do a deep review, only superficial. There's some nontrivial regression risk here - CI covers some basics, but far from everything.

@ckyrouac ckyrouac force-pushed the multi-device-commit-cleanup branch 8 times, most recently from 10341ba to d868b99 Compare March 10, 2026 14:22
@ckyrouac ckyrouac force-pushed the multi-device-commit-cleanup branch from d868b99 to 1365054 Compare March 11, 2026 12:38
@ckyrouac ckyrouac marked this pull request as ready for review March 11, 2026 13:33
@ckyrouac
Copy link
Contributor Author

marking as ready for review but waiting on bootc 1.14.0 to release to remove the temp commit and for the arm/s390/ppc builds for the tests

@ckyrouac ckyrouac force-pushed the multi-device-commit-cleanup branch 3 times, most recently from 612732a to b9b9176 Compare March 11, 2026 19:17
Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

Offhand this is looking plausible. This may touch on e.g. bootc-dev/bootc#1648 and similar issues, I hope we can try to see if we've fixed them with this.

}
}

/// Get the block device backing the current root by trying `/boot` first,
Copy link
Member

Choose a reason for hiding this comment

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

I think it'd be cleaner to use /sysroot if it exists and is a mountpoint, otherwise use /.

In bootc/ostree we call this "physical root" - there's similar code there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This pattern was copied from the removed blockdev.rs code. I'm not entirely sure why it was done this way originally, but I think your suggestion makes sense.

Copy link
Member

Choose a reason for hiding this comment

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

Consider that if boot and root partitions are on separate disks, see bootc-dev/bootc#1916, maybe /boot makes sense?

Copy link
Member

Choose a reason for hiding this comment

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

That's a very good point! Indeed...we should support that case. So I think things will work correctly if we list /boot first.

That said, there's a related thing here which is: we should honor XBOOTLDR from the DPS spec if it exists.

At the current time we aren't setting that up in the Fedora-derivative ecosystem much that I know of, but we should support it.

@ckyrouac ckyrouac force-pushed the multi-device-commit-cleanup branch from b9b9176 to 42500c3 Compare March 12, 2026 14:30
Align cap-std-ext with the version used by bootc-internal-blockdev,
eliminating duplicate cap-std/cap-primitives dependency chains.

Assisted-by: Claude Code (Opus 4)
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
@ckyrouac ckyrouac force-pushed the multi-device-commit-cleanup branch from 42500c3 to 313c930 Compare March 17, 2026 15:09
@cgwalters
Copy link
Member

FYI I put up #1072 which may textually (but not semantically) conflict with this

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
Instead of referencing devices as a &str, use Device from the blockdev
crate and its related functions.

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
This adds a new --filesystem flag that will use the blockdev crate to
determine the parent devices of the root filesystem and install the
bootloader to each device. The devices can also be explicitly specified
via multiple --device flags.

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
When running install-to-filesystem, the host may already have the ESP
mounted (e.g. /dev/sda15 at /boot/efi). Previously mount_esp_device
would unconditionally call mount, which fails with "already mounted".

Check if the mount point already contains a vfat filesystem on a
different device than its parent (i.e. is a real mount point) before
attempting to mount, and reuse the existing mount if so.

Assisted-by: Claude Code (Opus 4)
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
This uses the latest bootc RPM built from main in the CI tests.

Assisted-by: Claude Code (Opus 4)
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
@ckyrouac ckyrouac force-pushed the multi-device-commit-cleanup branch from 313c930 to 7d0b735 Compare March 17, 2026 19:32
@ckyrouac
Copy link
Contributor Author

updated to use the bootc rpm from copr and the 0.2.0 release of the blockdev crate, should be ready for another test run and review

@ckyrouac ckyrouac requested a review from cgwalters March 18, 2026 16:23
@cgwalters
Copy link
Member

/ok-to-test

@ckyrouac
Copy link
Contributor Author

@cgwalters is there a way to trigger the tests now that /ok-to-test was applied?

@cgwalters
Copy link
Member

The prow job ran and passed, so that's good, although it's not testing too much more than Jenkins is I believe.

Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

So...I think this looks good but we should talk about tests.

install the bootloader to multiple devices, e.g. a /dev/md0 RAID1 device backed by 3 physical disks, each with an ESP partition.

Does Anaconda support setting this up? I think we could automate that here. Other than that, another way would be a custom bit that spawns a bcvk ephemeral instance w/two virtio block devices attached, partitions both disks, then uses bootc install to-filesystem.

Comment on lines +451 to +454
// Unmount any previously mounted ESP to ensure we install to the
// correct device. This is important for multi-device installs where
// each device has its own ESP.
self.unmount()?;
Copy link
Member

Choose a reason for hiding this comment

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

I think this is OK as is, but it'd probably be cleaner longer term to have the mount clearly scoped to the device.

dnf -y copr enable rhcontainerbot/bootc centos-stream-9-x86_64
dnf -y install bootc
dnf clean all
rm -rf /var/log
Copy link
Member

Choose a reason for hiding this comment

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

Yeah...at some point we'll need to do rpm-software-management/dnf5#2011 (comment)

@ckyrouac
Copy link
Contributor Author

So...I think this looks good but we should talk about tests.

install the bootloader to multiple devices, e.g. a /dev/md0 RAID1 device backed by 3 physical disks, each with an ESP partition.

Does Anaconda support setting this up? I think we could automate that here. Other than that, another way would be a custom bit that spawns a bcvk ephemeral instance w/two virtio block devices attached, partitions both disks, then uses bootc install to-filesystem.

Currently the tests for multi device are in the bootc PR, see https://github.com/bootc-dev/bootc/pull/1911/changes#diff-c8f79904b9f0bdcea90dd5a8e8cfd0c84e7f6da4a36868cf0b86421c767f452b

@ckyrouac
Copy link
Contributor Author

The prow job ran and passed, so that's good, although it's not testing too much more than Jenkins is I believe.

The cross arch builds didn't re-run after the /ok-to-test. I'm not sure if that's blocking this from merging. The builds should pass now with the copr rpm in the test container.

@cgwalters cgwalters merged commit b788553 into coreos:main Mar 19, 2026
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants