composefs: Find GRUB's boot directory on a separate /boot when upgrading - #2516
Conversation
| /// there's a separate boot partition | ||
| const PHYSICAL_ROOT_BOOT_PATH: &str = "/sysroot/boot"; | ||
| /// Where a separate boot partition is mounted in the booted root | ||
| const BOOT_MOUNT_PATH: &str = "/boot"; |
There was a problem hiding this comment.
This has gotta be the 4th of these const for /boot
There was a problem hiding this comment.
Done in 12fe993:
- The new
/sysroot/bootand/bootconsts are gone. The PR's code (and the rest of crates/lib that spelled out"boot"/"/boot") now usesinstall::BOOT, in a new prep commit, 2ba5da9 "lib: Use the BOOT const for the boot directory". That one needs your sign-off. - The
get_boot_dir_for_grub()doc and the test's header comment no longer imply thatsystemd.mount-extrais the only way/bootgets mounted. - Once install: Use systemd-repart for partitioning #2314 lands, plan-57 could switch to its repart.d fixture instead of repartitioning the VM's disk.
Your sign-off is kept on 3350f09 and 12fe993, the reworked versions of your two signed commits.
Tested on a 16-core devspace: just validate, just unit-tests, and plans 57 and 24 (composefs, GRUB, ext4, BLS) passed. The only change since that run is comment text.
Generated-by: https://github.com/cgwalters/#llms
| # Disk images from e.g. image-builder have a separate /boot partition, which | ||
| # the VMs these tests run in don't have. With GRUB, the boot partition holds |
There was a problem hiding this comment.
Okay. It's kind of about time now we need a CI flow that is going through the image-builder CLI so we are covering that in general, but specifically so we are matching the defaults around things like /boot as a partition.
This is going to be messy because there's a fundamental conflict right now in that it wants to run as root, prior bits in bootc-dev/bcvk#73
The most likely viable path is to enhance bcvk for this so we can mostly otherwise reuse our infrastructure there to do things like run the VMs with tmt if we craft a flow which hands them off to libvirt etc.
That said, we already have prior art for testing anaconda code (see anaconda.rs here).
We can also try out the "image builder in vm" flow...
@cgwalters-bot just research this a bit with live experimentation and code investigation into a gist as p1
There was a problem hiding this comment.
Actually there's also an intersection with #2314 here - a test fixture which uses an embedded repart.d definition to require a separate /boot would work.
But I'm uncertain if we want to merge that first. Maybe...
There was a problem hiding this comment.
Having systemd-repart in the base image would definitely make this test much simpler. But again, we don't want to test only a separate /boot partition. This comes back to, I think, having a --systemd-repart cli option and not us unconditionally using repart if we find definitions. Wdyt @cgwalters? We can probably make it a hidden option as it's only useful for testing a bunch of stuff using the same image
There was a problem hiding this comment.
But again, we don't want to test only a separate /boot partition.
Isn't that all we need here? Or why do you say that?
This comes back to, I think, having a --systemd-repart cli option and not us unconditionally using repart if we find definitions.
I am not sure what you mean. We just made repart the default if found...but if yuou think there's issue with our repart let's take that to a new issue?
| Ok(if is_mountpoint == Some(true) { | ||
| "/" | ||
| } else { | ||
| "/boot" |
There was a problem hiding this comment.
Let's have the const used for things like this
|
#2399 was incomplete (my fault) and failed to explain that the issue also affected upgrade and switch. |
| /// is mounted on `/boot` (see the `systemd.mount-extra` karg added at install | ||
| /// time). Everything that reads or writes GRUB's boot entries must go through |
There was a problem hiding this comment.
Note systemd.mount-extra is not the only way to do a separate /boot, in the general case other tools may not do that.
I'd just rephrase to clarify.
| # Disk images from e.g. image-builder have a separate /boot partition, which | ||
| # the VMs these tests run in don't have. With GRUB, the boot partition holds |
There was a problem hiding this comment.
Actually there's also an intersection with #2314 here - a test fixture which uses an embedded repart.d definition to require a separate /boot would work.
But I'm uncertain if we want to merge that first. Maybe...
58ac509 to
12fe993
Compare
12fe993 to
4e10ca5
Compare
|
plan-57 failed in CI on fedora-44 (my earlier devspace run had used the default base, not F44) with On a 16-core devspace with Generated-by: https://github.com/cgwalters/#llms |
cgwalters
left a comment
There was a problem hiding this comment.
I really dislike the test case code, but we can break out the image-builder or enhanced bcvk as a followup
4e10ca5 to
fa5e9c3
Compare
|
@cgwalters The centos-10 ext4 grub failure was infra: libvirt's session socket was missing, so the VM for the first plan never started and no test ran. The centos-10 xfs grub leg passed, plan-57 included. Please restart the failed job: https://github.com/bootc-dev/bootc/actions/runs/36734182266/job/109968865098 Generated-by: https://github.com/cgwalters/#llms |
Head branch was pushed to by a user without write access
fa5e9c3 to
0246895
Compare
|
@cgwalters Rebased onto main (now 0246895). The only conflicts were in the generated
Tested on a 16-core devspace with Generated-by: https://github.com/cgwalters/#llms |
We already have `install::BOOT`, but many places still spelled out "boot" or "/boot" by hand, which makes it easy to miss one and invites yet more local constants for the same thing. Prep for reusing it in the GRUB separate /boot handling. Generated-by: AI Signed-off-by: Colin Walters <walters@verbum.org>
With GRUB and a separate boot partition, `bootc switch` and `bootc upgrade` fail with "Getting sorted Type1 boot entries: No such file or directory": the boot partition is mounted on /boot (via the systemd.mount-extra karg install adds), and /sysroot/boot is just an empty directory on the physical root. bootc-dev#2440 taught the booted storage to find the right directory for status, rollback, finalization and GC, but staging a new deployment still built its paths from /sysroot, both for BLS entries and for GRUB's UKI menu entries. So have get_boot_dir_for_grub() return the path it picked along with the directory, keep that in Storage, and derive every GRUB boot path while staging from it. The decision itself moves into a pure function so it can be unit tested. That also fixes the BLS entries' kernel and initramfs paths, which must be relative to the boot partition then. Every disk image-builder makes has a separate /boot, so this blocked using those for composefs. Generated-by: AI Signed-off-by: Colin Walters <walters@verbum.org>
0246895 to
0f565f9
Compare
|
@cgwalters Rebased onto main (regenerated tmt fmf only); 0f565f9 needs your approval for DCO. Generated-by: https://github.com/cgwalters/#llms |
Disks from image-builder always have a separate /boot, but the VMs tmt runs in don't, so nothing covered switching, upgrading or rolling back with that layout on composefs. Installing to a loop device inside the VM with a separate /boot would exercise install, but we can't boot that disk. So instead, like the XBOOTLDR test does, give the VM's own disk the layout install would have made: split the ESP into a smaller ESP and an ext4 XBOOTLDR partition, move /sysroot/boot there, make the BLS entries point at the kernels relative to it and add the systemd.mount-extra karg, and point bootupd's bootuuid.cfg at the new filesystem. Then switch, upgrade and roll back, checking that everything stays on /boot and that GC keeps the kernels there in sync with the entries. Generated-by: AI Signed-off-by: Colin Walters <walters@verbum.org>
0f565f9 to
d26a2cd
Compare
With GRUB and a separate /boot partition (as every image-builder disk has), composefs
bootc switchandbootc upgradefail with "Getting sorted Type1 boot entries: No such file or directory": staging built its paths from /sysroot, and /sysroot/boot is empty when the boot partition is mounted on /boot. #2440 fixed the same for status (and, through the booted storage, rollback, finalize and GC), so this keeps the path thatget_boot_dir_for_grub()picked inStorageand derives the BLS and GRUB UKI staging paths from it, including the kernel paths in BLS entries, which must then be relative to the boot partition.The second commit adds plan-57, which gives the test VM's disk a separate ext4 /boot (carved out of the ESP, like the XBOOTLDR test does) and then switches, upgrades and rolls back. bcvk's disks have no separate /boot, and a disk installed to a loop device inside the VM can't be booted, so repartitioning was the way to cover the booted paths.
Tested on a 16-core devspace (composefs, GRUB, ext4, BLS):
just unit-tests,just validate, and plans 56 (now renumbered 57), 24 and 36 passed. Without the fix, the new plan fails with the error above. The fix also passed switch + reboot + upgrade + reboot in rhel-bootc-examples' composefs e2e test on an image-builder disk: https://gist.github.com/cgwalters-bot/04b3e5503547a054ebcdf227238eaec1Related: #2440
The
Signed-off-by: Colin Walters <walters@verbum.org>on these commits was added on cgwalters's approval of the review draft: cgwalters-forge#29 (review)Generated-by: https://github.com/cgwalters/#llms