Bug 2096916

Summary: [ppc64le] ReaR may fail to install GRUB and set boot order after restore due to missing /dev/nvram
Product: Red Hat Enterprise Linux 9 Reporter: Lukáš Zaoral <lzaoral>
Component: rearAssignee: Pavel Cahyna <pcahyna>
Status: CLOSED ERRATA QA Contact: David Jež <djez>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: djez, pcahyna
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: ppc64le   
OS: Unspecified   
Whiteboard:
Fixed In Version: rear-2.6-12.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 10:42:27 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 Lukáš Zaoral 2022-06-14 14:41:02 UTC
Description of problem: ReaR may fail to install GRUB and set boot order after restore due to missing `/dev/nvram` making the system unbootable.

Version-Release number of selected component (if applicable): rear-2.6-11.el9.ppc64le

How reproducible: always

Steps to Reproduce:
1. Create a rescue image (e.g. ISO) and backup using `rear mkrescue` on a ppc64le machine.
2. Boot into such rescue system.
3. Run `rear recover` and answer all questions with affirmative replies.

Actual results:
GRUB 2 fails to install due to missing `/dev/nvram` and the boot order will not be changed to the corresponding block device.

Expected results:
GRUB 2 installs successfully and the boot order is set to corresponding block device.

Additional info:
- On newer kernels, the NVRAM driver is built as a kernel module which needs to be loaded so that `/dev/nvram` is created.  ReaR must load this kernel module before installing GRUB 2 and  changing the boot order.

- logs:
>2022-05-18 01:36:01.321238142 Including finalize/Linux-ppc64le/660_install_grub2.sh
>/sbin/grub2-probe
>2022-05-18 01:36:01.322570843 Installing GRUB2 boot loader on PPC64/PPC64LE...
>Generating grub configuration file ...
>Adding boot menu entry for UEFI Firmware Settings ...
>done
>2022-05-18 01:36:11.099705611 Determining where to install GRUB2 (no GRUB2_INSTALL_DEVICES specified)
>2022-05-18 01:36:11.103006970 Found PPC PReP boot partition /dev/sda1 - installing GRUB2 there
>dd: writing to '/dev/sda1': No space left on device
>8193+0 records in
>8192+0 records out
>4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.0771412 s, 54.4 MB/s
>Installing for powerpc-ieee1275 platform.
>nvram: ERROR: cannot open "/dev/nvram": No such file or directory
>nvram: ERROR: cannot open "/dev/misc/nvram": No such file or directory
>grub2-install: error: `nvsetenv' failed. 
>You will have to set `boot-device' variable manually.  At the IEEE1275 prompt, type:
>  setenv boot-device /vdevice/v-scsi@30000003/disk@8100000000000000
>.
>2022-05-18 01:36:13.883630644 Failed to install GRUB2 on PPC PReP boot partition /dev/sda1
>2022-05-18 01:36:13.889924451 Failed to install GRUB2 - you may have to manually install it
>2022-05-18 01:36:13.893384398 Including finalize/Linux-ppc64le/680_install_PPC_bootlist.sh
>2022-05-18 01:36:13.903409037 PPC PReP Boot partition found: /dev/sda1
>2022-05-18 01:36:13.911498962 Boot device disk is /dev/sda.
>2022-05-18 01:36:13.919528935 Set LPAR bootlist to '/dev/sda'
>/usr/sbin/nvram: ERROR: cannot open "/dev/nvram": No such file or directory
>/usr/sbin/nvram: ERROR: cannot open "/dev/misc/nvram": No such file or directory
>Could not update bootlist!
>2022-05-18 01:36:14.280003500 Including finalize/default/880_check_for_mount_by_id.sh
>2022-05-18 01:36:14.289783287 Including finalize/default/890_finish_checks.sh
>2022-05-18 01:36:14.302983687 WARNING:
>For this system
>RedHatEnterpriseServer/9 on Linux-ppc64le (based on Fedora/9/ppc64le)
>there is no code to install a boot loader on the recovered system
>or the code that we have failed to install the boot loader correctly.
>Please contribute appropriate code to the Relax-and-Recover project,
>see http://relax-and-recover.org/development/
>Take a look at the scripts in /usr/share/rear/finalize - for example
>for PC architectures like x86 and x86_64 see the script
>/usr/share/rear/finalize/Linux-i386/660_install_grub2.sh
>and for POWER architectures like ppc64le see the script
>/usr/share/rear/finalize/Linux-ppc64le/660_install_grub2.sh
>---------------------------------------------------
>|  IF YOU DO NOT INSTALL A BOOT LOADER MANUALLY,  |
>|  THEN YOUR SYSTEM WILL NOT BE ABLE TO BOOT.     |
>---------------------------------------------------
>You can use 'chroot /mnt/local bash --login'
>to change into the recovered system and
>manually install a boot loader therein.

- upstream PR with a fix: https://github.com/rear/rear/pull/2580

Comment 10 errata-xmlrpc 2022-11-15 10:42:27 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:8246