Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1492177 - rear fails to create a backup on (some?) UEFI systems, "cannot open `/usr/lib/grub/x86_64-efi/moddep.lst'"
rear fails to create a backup on (some?) UEFI systems, "cannot open `/usr/lib...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: rear (Show other bugs)
7.4
x86_64 Linux
urgent Severity medium
: rc
: ---
Assigned To: Pavel Cahyna
Tereza Cerna
Petr Bokoc
: Documentation, EasyFix
: 1518217 (view as bug list)
Depends On: 1512493
Blocks:
  Show dependency treegraph
 
Reported: 2017-09-15 12:19 EDT by Julio Entrena Perez
Modified: 2018-08-16 08:54 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
*ReaR* now provides a more helpful error message when _grub2-efi-x64-modules_ is missing Previously, an attempt to create a *ReaR* backup on UEFI systems using the "rear mkrescue" and "rear mkbackup" commands failed due to a missing _grub2-efi-x64-modules_ package, which is not installed by default but is required by *ReaR* to generate a GRUB image. The commands failed with the following error message: ERROR: Error occurred during grub2-mkimage of BOOTX64.efi This message proved to be confusing and unhelpful. With this update, the error will still appear in the same circumstances, but it will point out how to fix the problem: 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. As the updated message explains, you must install the missing _grub2-efi-x64-modules_ package before you can create a *ReaR* backup on a system with UEFI firmware.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-04-10 14:43:20 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3213391 None None None 2018-01-31 05:28 EST
Red Hat Product Errata RHBA-2018:1000 None None None 2018-04-10 14:44 EDT

  None (edit)
Description Julio Entrena Perez 2017-09-15 12:19:53 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:
Comment 3 Ryan Blakley 2017-09-15 16:59:03 EDT
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.
Comment 4 Pavel Cahyna 2017-09-18 14:14:01 EDT
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?
Comment 5 Tereza Cerna 2017-09-21 09:56:55 EDT
For QE:
sanity test was modified for testing this problem on UEFI system, see
https://tcms.engineering.redhat.com/case/560858/
Comment 6 Pavel Cahyna 2017-10-30 15:32:50 EDT
suggested workaround: install the grub2-efi-x64-modules package
Comment 7 Pavel Cahyna 2017-11-28 08:27:37 EST
*** Bug 1518217 has been marked as a duplicate of this bug. ***
Comment 9 Pavel Cahyna 2018-02-02 10:04:45 EST
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).
Comment 13 Pavel Cahyna 2018-02-08 12:45:52 EST
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?
Comment 14 Renaud Métrich 2018-02-09 04:49:23 EST
I'm ok with that.
Comment 15 Julio Entrena Perez 2018-02-09 05:31:57 EST
(In reply to Pavel Cahyna from comment #13)
> rmetrich, jentrena, are you happy with this?
Yes, thanks Pavel.
Comment 18 Tereza Cerna 2018-02-20 08:07:00 EST
==========================
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)
Comment 22 errata-xmlrpc 2018-04-10 14:43:20 EDT
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

Note You need to log in before you can comment on or make changes to this bug.