Bug 1983000

Summary: PPC64: grub2-install doesn't execute properly, making the recovered system unbootable
Product: Red Hat Enterprise Linux 7 Reporter: Renaud Métrich <rmetrich>
Component: rearAssignee: Pavel Cahyna <pcahyna>
Status: CLOSED ERRATA QA Contact: David Jež <djez>
Severity: high Docs Contact:
Priority: urgent    
Version: 7.9CC: djez, fkrska, jreznik, lzaoral, ovasik, pcahyna
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: ---Flags: pm-rhel: mirror+
Hardware: ppc64   
OS: Linux   
Whiteboard:
Fixed In Version: rear-2.4-14.el7_9 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-01-11 17:36:05 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:

Description Renaud Métrich 2021-07-16 08:52:23 UTC
Description of problem:

When recovering a PPC64+multipath system, the ofpathname binary may fail executing due to not having /sys mounted in the chroot:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
Installing for powerpc-ieee1275 platform.
/sbin/ofpathname: line 411: cd: /sys/class/*/dm-2: No such file or directory
/usr/bin/find: warning: Unix filenames usually don't contain slashes (though pathnames do).  That means that '-name '/'' will probably evaluate to false all the time on this system.  You might find the '-wholename' test more useful, or perhaps '-samefile'.  Alternatively, if you are using GNU grep, you could use 'find ... -print0 | grep -FzZ '/''.
/usr/bin/find: missing argument to `-name'
ofpathname: Could not retrieve Open Firmware device path
            for logical device "/dev/mapper/mpathf".
/vdevice/v-scsi@300000e2/disk@8200000000000000 /vdevice/v-scsi@3000007e/disk@8200000000000000
Installation finished. No error reported.
2021-06-04 13:42:33.207523277 GRUB2 installed on /dev/mapper/mpathf1
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

The ofpathname binary is called by grub2-install but additionally grub2-install doesn't detect the error, which doesn't make ReaR fail.

The result is an unbootable system.


Version-Release number of selected component (if applicable):

rear-2.4


How reproducible:

Always on the customer system


Additional info:

rear-2.6 has code to mount /sys automatically.

The following fix in /usr/share/rear/finalize/Linux-ppc64/620_install_grub2.sh is known to work on customer's systems:

Original lines (with numbers)
---------------------------------------------------
23 LogPrint "Installing GRUB2 boot loader"
24 mount -t proc none $TARGET_FS_ROOT/proc
25
:
75 umount $TARGET_FS_ROOT/proc
---------------------------------------------------

Modified lines:
---------------------------------------------------
23 LogPrint "Installing GRUB2 boot loader"
24 mount -t proc none $TARGET_FS_ROOT/proc
25 mount -t sysfs sys $TARGET_FS_ROOT/sys
26
:
76 umount $TARGET_FS_ROOT/sys
77 umount $TARGET_FS_ROOT/proc
---------------------------------------------------

Comment 3 Pavel Cahyna 2021-07-22 09:20:55 UTC
Thank you for the suggested fix. I suppose that in this case the system could be affected also by bz1983008, as "ofpathname" is included in the same package that may be missing (powerpc-utils) and is added to PROGS, not to REQUIRED_PROGS? Is there a way to determine whether "ofpathname" will be needed in order to add it to REQUIRED_PROGS conditionally? (Maybe, do it always except on PowerNV?)

I suppose the code in ReaR 2.6 was introduced in commit 61f36e6e5326888111b97450cf21f0b859e669c5 (PR 1848).

Comment 4 Pavel Cahyna 2021-07-22 10:37:34 UTC
Also, how to reproduce the problem? I suppose that if any ppc machine had the problem, it would have been discovered a long time ago. Is multipath the key element that makes the setup special and vulnerable to the problem?

Comment 5 Renaud Métrich 2021-07-22 11:00:33 UTC
The "ofpathname" + "bootlist" binaries need to be added to REQUIRED_PROGS in all non-PowerNV cases.
To reproduce, you need multipath indeed, I had a reproducer on a QEMU/KVM with a multipath disk but it's gone now.

Comment 6 Pavel Cahyna 2021-08-03 08:58:15 UTC
(In reply to Renaud Métrich from comment #5)
> The "ofpathname" + "bootlist" binaries need to be added to REQUIRED_PROGS in
> all non-PowerNV cases.

According to the code, KVM-emulated virtual machines do not need "bootlist"? So maybe the condition should be non-PowerNV, non KVM cases? But perhaps it does not do any harm to include it even in the KVM case and it will make the conditions a bit simpler?

Comment 7 Renaud Métrich 2021-08-31 08:21:49 UTC
I would say the simpler the better indeed.

Comment 8 Pavel Cahyna 2021-08-31 08:52:19 UTC
(In reply to Renaud Métrich from comment #7)
> I would say the simpler the better indeed.

Well, in the meantime I submitted PR 2665, which goes the more complicated way of requiring ofpathname except on PowerNV and bootlist on PowerVM.

Comment 9 Pavel Cahyna 2021-11-10 12:05:38 UTC
I tried to reproduce the bug on RHEL 8 (bz1983003) and despite the error messages the system has booted fine. How does exactly the problem manifest? You say "unbootable system", but does it mean that it does not enter GRUB, or that GRUB is not able to load the kernel, or that there is some error message from GRUB?
The problem might be RHEL 7-specific, I don't have a compatible RHEL 7 system (yet).

Comment 10 Pavel Cahyna 2021-11-10 15:50:15 UTC
> The problem might be RHEL 7-specific, I don't have a compatible RHEL 7 system (yet).

I realized that one can use RHEL-ALT-7.6 as a replacement because we have LPARs compatible with that. Still, I was not able to reproduce the problem. Despite the error messages from ofpathname called from grub-install in the recovery log the system has booted fine. Are you sure that ofpathname error was the real cause behind the unbootable system that you encountered?

Comment 22 errata-xmlrpc 2022-01-11 17:36:05 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 (rear 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-2022:0069