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: using the target system's grub2-install to install BIOS/PReP bootloader #3190

Merged
merged 2 commits into from
Nov 18, 2022

Conversation

HuijingHei
Copy link
Member

Fix #3156

@HuijingHei
Copy link
Member Author

/hold
Should wait until OCP 4.12 release

@cgwalters
Copy link
Member

Should wait until OCP 4.12 release

Hmm, does it need to? We've branched off 4.12 so I think we can safely land things in main here right?

@HuijingHei
Copy link
Member Author

Should wait until OCP 4.12 release

Hmm, does it need to? We've branched off 4.12 so I think we can safely land things in main here right?

Not sure, is it necessary to wait art build using coreos-assembler:rhcos-4.12 for ocp 4.12 (refer to https://gitlab.cee.redhat.com/openshift-art/rhcos-upshift/-/blob/rhcos-4.12/jobspec.yaml#L141)?

@cgwalters cgwalters merged commit 255ff1d into coreos:main Nov 18, 2022
@dustymabe
Copy link
Member

Now that this merged.. Is there a way to verify that the installed bootloader was installed using the grub from the target system? Could we make a exttest out of it and we'll know if it ever gets out of sync again?

@HuijingHei HuijingHei deleted the grub2-target branch November 21, 2022 01:19
@HuijingHei
Copy link
Member Author

Now that this merged.. Is there a way to verify that the installed bootloader was installed using the grub from the target system? Could we make a exttest out of it and we'll know if it ever gets out of sync again?

That would be better, I will try to add. Do you have any suggestions?

@HuijingHei
Copy link
Member Author

Can I record the grub2-install package version when running, and compare it with rhcos after booted?

# rpm -qf /sbin/grub2-install
grub2-tools-2.02-123.el8_6.8.x86_64

@cgwalters
Copy link
Member

That's the thing...what we see in the RPM database previously was not the same as what got installed to the disk! But note this is actually the same problem as what happens on a traditional e.g. Anaconda+yum/dnf system - typing dnf update does not rerun grub2-install on the MBR.

This is something that adding support into bootupd was aiming to fix.

There might be some version data embedded into the binary data installed into the partition but if there is it's not obvious to me.

I think such a test for now would have to do something basically like simulating create_disk.sh on a temporary loopback device, then compare the raw data in the partitions.

HuijingHei added a commit to HuijingHei/fedora-coreos-config that referenced this pull request Nov 22, 2022
@HuijingHei
Copy link
Member Author

Thanks @cgwalters for the pointer.

Find that when running grub2-install, this will generate core.img

[root@cosa-devsh ~]# grub2-install --target i386-pc --boot-directory /boot/ --modules mdraid1x /dev/vda
...
grub2-install: info: grub-mkimage --directory '/usr/lib/grub/i386-pc' --prefix '(,gpt3)/grub2' --output '/boot/grub2/i386-pc/core.img'  --dtb '' --format 'i386-pc' --compression 'auto' --appended-signature-size 0  'mdraid1x' 'ext2' 'part_gpt' 'biosdisk'

Test with old version 412.86.202211082314-0, compare the size is different before (bootloader is installed by cosa container) and after running grub2-install(bootloader is installed by target os). Maybe can reinstall bootloader and check core.img size.

[root@cosa-devsh ~]# rpm-ostree status
State: idle
Deployments:
● 1e6a74981d2379c11ecec924f59a799efe07b257add5ce34fc4e89198978291e
                  Version: 412.86.202211082314-0 (2022-11-08T23:17:18Z)
[root@cosa-devsh ~]# ll /boot/grub2/i386-pc/core.img
-rw-r--r--. 1 root root 38318 Nov  8 23:21 /boot/grub2/i386-pc/core.img
[root@cosa-devsh ~]# mount -o remount,rw /boot
[root@cosa-devsh ~]# grub2-install --target i386-pc --boot-directory /boot/ --modules mdraid1x /dev/vda
Installing for i386-pc platform.
Installation finished. No error reported.
[root@cosa-devsh ~]# ll /boot/grub2/i386-pc/core.img
-rw-r--r--. 1 root root 37729 Nov 22 09:13 /boot/grub2/i386-pc/core.img

HuijingHei added a commit to HuijingHei/fedora-coreos-config that referenced this pull request Nov 22, 2022
HuijingHei added a commit to HuijingHei/fedora-coreos-config that referenced this pull request Nov 22, 2022
HuijingHei added a commit to HuijingHei/fedora-coreos-config that referenced this pull request Nov 22, 2022
HuijingHei added a commit to HuijingHei/fedora-coreos-config that referenced this pull request Nov 22, 2022
HuijingHei added a commit to HuijingHei/fedora-coreos-config that referenced this pull request Nov 23, 2022
HuijingHei added a commit to HuijingHei/fedora-coreos-config that referenced this pull request Nov 23, 2022
HuijingHei added a commit to HuijingHei/fedora-coreos-config that referenced this pull request Nov 24, 2022
HuijingHei added a commit to HuijingHei/fedora-coreos-config that referenced this pull request Nov 24, 2022
HuijingHei added a commit to HuijingHei/fedora-coreos-config that referenced this pull request Nov 25, 2022
HuijingHei added a commit to HuijingHei/fedora-coreos-config that referenced this pull request Nov 25, 2022
jlebon pushed a commit to coreos/fedora-coreos-config that referenced this pull request Nov 28, 2022
HuijingHei added a commit to HuijingHei/fedora-coreos-config that referenced this pull request Oct 10, 2023
HuijingHei added a commit to HuijingHei/fedora-coreos-config that referenced this pull request Oct 10, 2023
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.

create_disk.sh should use the grub2-install from the target OS
3 participants