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

create_disk.sh should use the grub2-install from the target OS #3156

Closed
jlebon opened this issue Nov 1, 2022 · 4 comments · Fixed by #3190
Closed

create_disk.sh should use the grub2-install from the target OS #3156

jlebon opened this issue Nov 1, 2022 · 4 comments · Fixed by #3190
Assignees

Comments

@jlebon
Copy link
Member

jlebon commented Nov 1, 2022

Currently, on x86_64 and ppc64le we use the grub2-install from the cosa environment to install the BIOS/PReP bootloader. We should be using the target system's grub2-install instead.

Random notes:

  • For RHCOS, this will mean using older bootloader code on new bootimages that previously which might lead to regressions. To be safe, we should probably do this right after branching cosa for an OCP release (e.g. 4.12).
  • grub2-install is part of grub2-tools at least on FCOS. That subpackage also ships e.g. grub2-mkconfig and other tools which we don't actually need. We've discussed in the past not shipping those tools in FCOS (since we use pure BLS). This issue would make that more difficult, but not impossible.

Related: coreos/fedora-coreos-tracker#1360

@cgwalters
Copy link
Member

One thought I had here is that we could try to move the basic logic for this into bootupd - and then, we'd run bootupd from a privileged container. We already partially do this.

@cgwalters
Copy link
Member

@HuijingHei are you taking this? I think to start I'd play with something like this:

diff --git a/src/create_disk.sh b/src/create_disk.sh
index 710da788e..70f85a46f 100755
--- a/src/create_disk.sh
+++ b/src/create_disk.sh
@@ -470,7 +470,7 @@ x86_64)
     if [ "${x86_bios_bootloader}" = 1 ]; then
         # And BIOS grub in addition.  See also
         # https://github.com/coreos/fedora-coreos-tracker/issues/32
-        grub2-install \
+        chroot_run grub2-install \
             --target i386-pc \
             --boot-directory $rootfs/boot \
             --modules mdraid1x \
@@ -483,7 +483,7 @@ aarch64)
     ;;
 ppc64le)
     # to populate PReP Boot, i.e. support pseries
-    grub2-install --target=powerpc-ieee1275 --boot-directory $rootfs/boot --no-nvram "${disk}${PREPPN}"
+    chroot_run grub2-install --target=powerpc-ieee1275 --boot-directory $rootfs/boot --no-nvram "${disk}${PREPPN}"
     install_grub_cfg
     ;;
 s390x)

@HuijingHei
Copy link
Member

HuijingHei commented Nov 11, 2022

Thanks @cgwalters for the pointer, I will try with your guidance.
Yes, I will assign this to me, feel free to change if other one already working on this

@HuijingHei HuijingHei self-assigned this Nov 11, 2022
@HuijingHei
Copy link
Member

Build ova image on ppc64le with chroot_run grub2-install on cosa container (include grub2-2.06-54.fc36), upload to ibmcloud and create vm, it can start successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants