Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bios+ppc64le: Support being passed a whole device #839

Merged
merged 2 commits into from
Feb 12, 2025

Conversation

cgwalters
Copy link
Member

And automatically find the PReP partition.

Closes: #837

@cgwalters
Copy link
Member Author

This depends on containers/bootc#1086

@cgwalters
Copy link
Member Author

OK I only compile tested this locally but if someone has a reproducer env, can you try e.g.:

FROM <rhel>
RUN <<EORUN
set -xeuo pipefail
rm /usr/lib/ostree-boot/loader -vrf
curl -Lf -o /usr/bin/bootupctl https://fedorapeople.org/~walters/bootupd-ppc64le
ln -f /usr/bin/bootupctl /usr/libexec/bootupd
EORUN

@cgwalters cgwalters force-pushed the ppc64le-blockdev branch 2 times, most recently from aede886 to 8e1bb34 Compare February 10, 2025 15:57
@HuijingHei
Copy link
Member

Do testing on ppc64, failed to run update, here are the steps. Will look at it more tomorrow.

[root@cosa-devsh core]# rpm-ostree useroverlay
[root@cosa-devsh core]# curl -Lf -o /usr/bin/bootupctl https://fedorapeople.org/~walters/bootupd-ppc64le                                                                     
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current       
                                 Dload  Upload   Total   Spent    Left  Speed         
100 73.7M  100 73.7M    0     0  20.3M      0  0:00:03  0:00:03 --:--:-- 20.3M        
[root@cosa-devsh core]# ln -f /usr/bin/bootupctl /usr/libexec/bootupd                 
[root@cosa-devsh core]# bootupctl status                                                                                                                                     
Running as unit: bootupd.service; invocation ID: f943b7a8304c4835822ec13845bec43c                                                                                            
Component BIOS                                                                                                                                                               
  Installed: grub2-tools-1:2.12-15.fc41.ppc64le                                                                                                                              
  Update: At latest version                                                                                                                                                  
No components are adoptable.                                                                                                                                                 
CoreOS aleph version: 41.20250209.20.0                                                
[root@cosa-devsh core]# mount -o remount,rw /boot                                     
[root@cosa-devsh core]# rm -f /boot/bootupd-state.json                                                                                                                       
[root@cosa-devsh core]# bootupctl update -vvvv
[TRACE bootupd] executing cli                                                         
Running as unit: bootupd.service; invocation ID: e38c74b5f23e4163aea4fdab6f1f7cfc     
[TRACE bootupd] executing cli                                                         
[TRACE bootupd::bootupd] No saved state                                               
[TRACE bootupd::bootupd] Remaining known components: 1                                                                                                                       
[TRACE bootupd::component] Adoptable: ContentMetadata { timestamp: 2025-02-10T02:25:23.330Z, version: "41.20250209.20.0" }                                                   
[TRACE bootupd::component] Adoptable: ContentMetadata { timestamp: 2025-02-10T02:25:23.330Z, version: "41.20250209.20.0" }                                                   
[DEBUG bootupd::blockdev] Find parent devices: ["/dev/vda"]                                                                                                                  
error: Failed adopt and update: Failed to find PReP partition with GUID 9E1A2D38-C612-4316-AA26-8B49521E5A8B

@cgwalters cgwalters force-pushed the ppc64le-blockdev branch 2 times, most recently from 82ae251 to f89818e Compare February 11, 2025 16:50
@cgwalters
Copy link
Member Author

OK yeah digging in we're hitting udev issues; lsblk -J -O doesn't pick up the partition UUIDs from inside a container even with -v /dev:/dev; I think we're missing some data from /run on the host.

We'll need to switch to sfdisk to directly parse the partition tables

On general principle but this is also prep for
coreos#839
And automatically find the PReP partition.

Closes: coreos#837
Signed-off-by: Colin Walters <[email protected]>
cgwalters added a commit to cgwalters/bootc that referenced this pull request Feb 11, 2025
This will depend on coreos/bootupd#839

And cleans up our bootloader code; move the bootloader
partition definitions back to `install/baseline`. Conceptually
now it's just the `to-disk` flow and bootupd that
know about bootloader partition GUIDs which is how I think
it should be - the bootc core is agnostic to bootloaders.

Signed-off-by: Colin Walters <[email protected]>
@cgwalters cgwalters marked this pull request as ready for review February 11, 2025 19:47
@cgwalters
Copy link
Member Author

OK, I've tested this one now in concert with containers/bootc#1106 and it looks like it works.

I did hit an issue when trying to use to-existing-root that took me a while to figure out - the host system was provisioned with RHEL10 and I was trying to install RHEL9, and the grub XFS probe failed to parse the too-new layout of the host filesystem. grub failing here is of course just the canary, the Linux kernel would also fail to parse it.

Ideally we figure out a generic way to probe this in containers/bootc#192

[root@cosa-devsh core]# curl -Lf -o /usr/bin/bootupctl https://fedorapeople.org/~walters/bootupd-ppc64le

I think I hadn't updated that binary with the latest from this PR before, but I have now. Want to retest?

@cgwalters cgwalters enabled auto-merge February 11, 2025 21:31
@HuijingHei
Copy link
Member

I understood the problem now, can reproduce using bootupd-0.2.26-1.fc41.ppc64le.

[root@cosa-devsh core]# bootupctl update -vvvvv
...
Installing for powerpc-ieee1275 platform.
/usr/sbin/grub2-install: error: the chosen partition is not a PReP partition.
error: Failed adopt and update: Failed to run "/usr/sbin/grub2-install" "--target" "powerpc-ieee1275" "--boot-directory" "/boot" "--no-nvram" "/dev/vda"

Sorry that it is introduced by 07c3661 which ignore the ppc64le platform.

Retest and run bootupctl update successfully using https://fedorapeople.org/~walters/bootupd-ppc64le.

@@ -12,6 +14,30 @@ use crate::packagesystem;
// grub2-install file path
pub(crate) const GRUB_BIN: &str = "usr/sbin/grub2-install";

#[cfg(target_arch = "powerpc64")]
fn target_device(device: &str) -> Result<Cow<str>> {
Copy link
Member

Choose a reason for hiding this comment

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

Just one minor suggestion, not blocker, better to rename target_device to get_prepboot_device(), and move it to src/blockdev.rs? I am also OK to keep it here as it is only used on ppc64.

Copy link
Member

@HuijingHei HuijingHei left a comment

Choose a reason for hiding this comment

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

LGTM

@cgwalters cgwalters merged commit 596af93 into coreos:main Feb 12, 2025
12 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.

Change ppc64le to handle being passed whole device
2 participants