Red Hat Bugzilla – Bug 1492177
rear fails to create a backup on (some?) UEFI systems, "cannot open `/usr/lib/grub/x86_64-efi/moddep.lst'"
Last modified: 2018-08-16 08:54:34 EDT
Description of problem: rear mkbackup fails on UEFI system due to missing Version-Release number of selected component (if applicable): # rpm -q rear rear-2.00-2.el7.x86_64 How reproducible: Always Steps to Reproduce: 1. Use the following settings for /etc/rear/local.conf OUTPUT=ISO OUTPUT_URL=null BACKUP=NETFS BACKUP_URL=iso:///backup ISO_MAX_SIZE=4095 2. Run "rear -v -d mkbackup" Actual results: # rear -v -d mkbackup Relax-and-Recover 2.00 / Git Using log file: /var/log/rear/rear-rhel74uefi.log Using backup archive '/tmp/rear.wqoVQQqv5kRWKeF/tmp/isofs/backup/backup.tar.gz' Using UEFI Boot Loader for Linux (USING_UEFI_BOOTLOADER=1) Creating disk layout Creating root filesystem layout Copying logfile /var/log/rear/rear-rhel74uefi.log into initramfs as '/tmp/rear-rhel74uefi-partial-2017-09-15T17:01:06+0100.log' Copying files and directories Copying binaries and libraries Copying kernel modules Creating initramfs Creating tar archive '/tmp/rear.wqoVQQqv5kRWKeF/tmp/isofs/backup/backup.tar.gz' Archived 5733 MiB [avg 13652 KiB/sec] OK Archived 5733 MiB in 431 seconds [avg 13621 KiB/sec] ERROR: Error occurred during grub2-mkimage of BOOTX64.efi Aborting due to an error, check /var/log/rear/rear-rhel74uefi.log for details You should also rm -Rf /tmp/rear.wqoVQQqv5kRWKeF Terminated # less /var/log/rear/rear-rhel74uefi.log 2017-09-15 17:09:13.487278564 Including output/ISO/Linux-i386/250_populate_efibootimg.sh mkdir: created directory '/tmp/rear.wqoVQQqv5kRWKeF/tmp/mnt' mkdir: created directory '/tmp/rear.wqoVQQqv5kRWKeF/tmp/mnt/EFI' mkdir: created directory '/tmp/rear.wqoVQQqv5kRWKeF/tmp/mnt/EFI/BOOT' mkdir: created directory '/tmp/rear.wqoVQQqv5kRWKeF/tmp/mnt/EFI/BOOT/fonts' mkdir: created directory '/tmp/rear.wqoVQQqv5kRWKeF/tmp/mnt/EFI/BOOT/locale' '/boot/efi/EFI/redhat/shimx64.efi' -> '/tmp/rear.wqoVQQqv5kRWKeF/tmp/mnt/EFI/BOOT/BOOTX64.efi' grub2-mkimage: error: cannot open `/usr/lib/grub/x86_64-efi/moddep.lst': No such file or directory. 2017-09-15 17:09:13.769914020 ERROR: Error occurred during grub2-mkimage of BOOTX64.efi ==== Stack trace ==== Trace 0: /usr/sbin/rear:504 main Trace 1: /usr/share/rear/lib/mkbackup-workflow.sh:22 WORKFLOW_mkbackup Trace 2: /usr/share/rear/lib/framework-functions.sh:85 SourceStage Trace 3: /usr/share/rear/lib/framework-functions.sh:45 Source Trace 4: /usr/share/rear/output/ISO/Linux-i386/250_populate_efibootimg.sh:69 source Trace 5: /usr/share/rear/lib/uefi-functions.sh:50 build_bootx86_efi Trace 6: /usr/share/rear/lib/_input-output-functions.sh:132 StopIfError Message: Error occurred during grub2-mkimage of BOOTX64.efi == End stack trace == 2017-09-15 17:09:13.797605345 Running exit tasks. # ls /usr/lib/grub i386-pc # rpm -qa | grep grub | sort grub2-2.02-0.64.el7.x86_64 grub2-common-2.02-0.64.el7.noarch grub2-efi-x64-2.02-0.64.el7.x86_64 grub2-pc-2.02-0.64.el7.x86_64 grub2-pc-modules-2.02-0.64.el7.noarch grub2-tools-2.02-0.64.el7.x86_64 grub2-tools-extra-2.02-0.64.el7.x86_64 grub2-tools-minimal-2.02-0.64.el7.x86_64 grubby-8.28-23.el7.x86_64 Expected results: Backup completes successfully. Additional info:
This error message appears to be caused by the below snippet of code from /usr/share/rear/lib/uefi-functions.sh. $gmkimage $v -O x86_64-efi -c $TMP_DIR/mnt/EFI/BOOT/embedded_grub.cfg -o $TMP_DIR/mnt/EFI/BOOT/BOOTX64.efi -p "/EFI/BOOT" part_gpt part_msdos fat ext2 normal chain boot configfile linux linuxefi multiboot jfs iso9660 usb usbms usb_keyboard video udf ntfs all_video gzio efi_gop reboot search test echo btrfs StopIfError "Error occurred during $gmkimage of BOOTX64.efi" If a server is installed with 7.4 directly via uefi, it installs the grub2-pc-modules package instead of the grub2-efi-x64-modules package. If the server is installed with 7.2 or 7.3 directly then updated to 7.4 some appear to have installed the grub2-efi-x64-modules package, but some haven't. So based on the above code, for uefi there needs to be a required progs added for the grub2-efi-x64-modules package to prevent this error earlier on.
grub2-pc does depend on grub2-pc-modules, but grub2-efi does not depend on grub2-efi-modules, nor does grub2-efi-x64 depend on grub2-efi-x64-modules. Why this asymmetry?
For QE: sanity test was modified for testing this problem on UEFI system, see https://tcms.engineering.redhat.com/case/560858/
suggested workaround: install the grub2-efi-x64-modules package
*** Bug 1518217 has been marked as a duplicate of this bug. ***
I am afraid of forcing a dependency in spec as it would install it (the grub2-efi-x64-modules package) even on non-UEFI systems and I am not sure about the consequences. Therefore, I intend only to: - document the workaround - and add a more helpful error message, as suggested by Renaud (this would be a patch but probably a simple one).
I propose the following change: add a file usr/share/rear/output/ISO/Linux-i386/249_check_rhel_grub2_efi_package.sh with this content: ---------->8----------- # 249_check_rhel_grub2_efi_package.sh is_true $USING_UEFI_BOOTLOADER || return # empty or 0 means NO UEFI ( VERBOSE=1 test -r /usr/lib/grub/x86_64-efi/moddep.lst PrintIfError "WARNING: /usr/lib/grub/x86_64-efi/moddep.lst not found, grub2-mkimage will likely fail. Please install the grub2-efi-x64-modules package to fix this." ) ---------->8----------- Output of "rear mkrescue" with this change: WARNING: /usr/lib/grub/x86_64-efi/moddep.lst not found, grub2-mkimage will likely fail. Please install the grub2-efi-x64-modules package to fix this. ERROR: Error occurred during grub2-mkimage of BOOTX64.efi Aborting due to an error, check /var/log/rear/rear-localhost.log for details rmetrich, jentrena, are you happy with this?
I'm ok with that.
(In reply to Pavel Cahyna from comment #13) > rmetrich, jentrena, are you happy with this? Yes, thanks Pavel.
========================== Verified in: rear-2.00-6.el7.x86_64 PASS ========================== * Tested on UEFI system. * Patch was applied. * Better warning message was used: WARNING: /usr/lib/grub/x86_64-efi/moddep.lst not found, grub2-mkimage will likely fail. Please install the grub2-efi-x64-modules package to fix this. See: ==== # cat /etc/rear/local.conf OUTPUT=ISO OUTPUT_URL=null BACKUP=NETFS BACKUP_URL=iso:///backup ISO_MAX_SIZE=4095 # rear -v mkrescue ... Copying kernel modules Creating initramfs WARNING: /usr/lib/grub/x86_64-efi/moddep.lst not found, grub2-mkimage will likely fail. Please install the grub2-efi-x64-modules package to fix this. ERROR: Error occurred during grub2-mkimage of BOOTX64.efi Aborting due to an error, check /var/log/rear/rear-hpe-tm200-01.log for details Terminated # yum install grub2-efi-x64-modules # rear -v mkrescue ... Copying kernel modules Creating initramfs '/tmp/rear.XB9xyNFtwSja50o/tmp/mnt/./EFI' -> '/tmp/rear.XB9xyNFtwSja50o/tmp/efi_virt/./EFI' '/tmp/rear.XB9xyNFtwSja50o/tmp/mnt/./EFI/BOOT' -> '/tmp/rear.XB9xyNFtwSja50o/tmp/efi_virt/./EFI/BOOT' '/tmp/rear.XB9xyNFtwSja50o/tmp/mnt/./EFI/BOOT/fonts' -> '/tmp/rear.XB9xyNFtwSja50o/tmp/efi_virt/./EFI/BOOT/fonts' '/tmp/rear.XB9xyNFtwSja50o/tmp/mnt/./EFI/BOOT/fonts/unicode.pf2' -> '/tmp/rear.XB9xyNFtwSja50o/tmp/efi_virt/./EFI/BOOT/fonts/unicode.pf2' '/tmp/rear.XB9xyNFtwSja50o/tmp/mnt/./EFI/BOOT/locale' -> '/tmp/rear.XB9xyNFtwSja50o/tmp/efi_virt/./EFI/BOOT/locale' '/tmp/rear.XB9xyNFtwSja50o/tmp/mnt/./EFI/BOOT/BOOTX64.efi' -> '/tmp/rear.XB9xyNFtwSja50o/tmp/efi_virt/./EFI/BOOT/BOOTX64.efi' '/tmp/rear.XB9xyNFtwSja50o/tmp/mnt/./EFI/BOOT/embedded_grub.cfg' -> '/tmp/rear.XB9xyNFtwSja50o/tmp/efi_virt/./EFI/BOOT/embedded_grub.cfg' '/tmp/rear.XB9xyNFtwSja50o/tmp/mnt/./EFI/BOOT/grub.cfg' -> '/tmp/rear.XB9xyNFtwSja50o/tmp/efi_virt/./EFI/BOOT/grub.cfg' Making ISO image Wrote ISO image: /var/lib/rear/output/rear-hpe-tm200-01.iso (219M)
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, 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-2018:1000