Bug 2140011

Summary: leapp can not find grub location for bios-grub gpt disks
Product: Red Hat Enterprise Linux 8 Reporter: tbsky <tbskyd>
Component: leapp-repositoryAssignee: Petr Stodulka <pstodulk>
Status: CLOSED ERRATA QA Contact: Martin KlusoĊˆ <mkluson>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.6CC: mmacura, mmoran, mreznik, pholica, smitterl
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: leapp-repository-0.18.0-5.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-14 15:35:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
grub failed screenshot
none
leapp-upgrade.log
none
leapp.db
none
leapp-upgrade.log(after upgrade)
none
leapp.db(after upgrade) none

Description tbsky 2022-11-04 06:33:32 UTC
Created attachment 1922127 [details]
grub failed screenshot

I tried to upgrade a multiple disks mdadm BIOS system from 8.6 to 9.0 but failed.

so I create a 4 disks BIOS kvm vm to test. each disk is 2GB GPT format. and each disk has a biosboot grub partition, a raid-1 /boot partition, a raid-5 lvm partition. disk layout is below:

Device      Start     End Sectors  Size Type
/dev/vda1    2048    4095    2048    1M BIOS boot
/dev/vda2    4096  620543  616448  301M Linux RAID
/dev/vda3  620544 4192255 3571712  1.7G Linux RAID

the leapp upgrade gave warning at "leapp-report.txt" like below:

----------------------------------------
Risk Factor: high
Title: Leapp could not identify where GRUB core is located
Summary: We assume GRUB core is located on the same device as /boot. Leapp needs to update GRUB core as it is not done automatically on legacy (BIOS) systems.
Remediation: [hint] Please run "grub2-install <GRUB_DEVICE> command manually after upgrade
Key: ca7a1a66906a7df3da890aa538562708d3ea6ecd
----------------------------------------

the upgrade procedure is smooth. first reboot to upgrade.initramfs and it finished the job. the system reboot again automatically and then grub fall to rescue mode as screenshot.

I use install media and boot to rescue mode. "chroot /mnt/sysimage" and then "grub2-install /dev/vda". the system is happy now. it just lack one step.

I wonder if I can place the command "grub2-install /dev/vda" into upgrade.initramfs so I can prevent the rescue trouble. 

which leapp actor file can I put the "grub2-install /dev/vda" command?

Comment 1 Michal Reznik 2022-12-06 13:29:53 UTC
Hello, we actually have the functionality here:

https://github.com/oamg/leapp-repository/tree/master/repos/system_upgrade/common/actors/updategrubcore

Recently, we identified an issue in the "checkgrubcore" actor which is responsible for the report in your description but that should not affect running the command.

Could you please provide us with "/var/log/leapp/leapp-upgrade.log" and "/var/lib/leapp/leapp.db" files? Thanks...

Comment 2 tbsky 2022-12-06 16:03:36 UTC
Created attachment 1930506 [details]
leapp-upgrade.log

Comment 3 tbsky 2022-12-06 16:04:52 UTC
Created attachment 1930507 [details]
leapp.db

Comment 4 tbsky 2022-12-06 16:05:59 UTC
Hi:
   I recreate the vm and make sure the result is the same. attach leapp-upgrade.log and leapp.db

Comment 5 tbsky 2022-12-07 07:07:05 UTC
Hi:
   according to your hint, I modify the file updategrubcore.py. after that the upgrade process is very smooth. thanks a lot for the workaround.

Comment 6 Michal Reznik 2022-12-07 12:27:22 UTC
I am glad to hear you were able to workaround the issue on your own. I checked the files you provided but those are unfortunately only from the "preupgrade" phase. We will need the files from after the upgrade finished. Out of curiosity, what was the changes you performed to the "updategrubcore.py" file?

Comment 7 tbsky 2022-12-08 04:17:14 UTC
Hi:
   I do it again and get the files after upgrade via rescue mode. for curious I "grep grub2-install leapp-upgrade.log" and I found the upgrade procedure is doing "grub2-install /dev/vdd". since I am booting from "/dev/vda" so it failed. I change boot disk to "/dev/vdd" and it boot successfully. the original RHEL-8 system can boot from any drive. so I think the procedure should try to update grub at every possible drive.
   the updategrubcore.py I modified is from "cmd = ['grub2-install', grub_dev]" to "cmd = ['grub2-install', '/dev/vda']

Comment 8 tbsky 2022-12-08 04:17:59 UTC
Created attachment 1930959 [details]
leapp-upgrade.log(after upgrade)

Comment 9 tbsky 2022-12-08 04:18:40 UTC
Created attachment 1930960 [details]
leapp.db(after upgrade)

Comment 10 Michal Reznik 2022-12-09 13:03:54 UTC
Thank you very much for the follow-up and the data. It makes sense now. We will let you know when the fix is ready and would appreciate if you could verify it.

Comment 11 Petr Stodulka 2023-07-18 07:10:31 UTC
Resolved by upstream PR:
  * https://github.com/oamg/leapp-repository/pull/1093

Comment 20 errata-xmlrpc 2023-11-14 15:35:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (leapp-repository bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:7013