RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1492177 - rear fails to create a backup on (some?) UEFI systems, "cannot open `/usr/lib/grub/x86_64-efi/moddep.lst'"
Summary: rear fails to create a backup on (some?) UEFI systems, "cannot open `/usr/lib...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: rear
Version: 7.4
Hardware: x86_64
OS: Linux
urgent
medium
Target Milestone: rc
: ---
Assignee: Pavel Cahyna
QA Contact: Tereza Cerna
Petr Bokoc
URL:
Whiteboard:
: 1518217 (view as bug list)
Depends On: 1512493
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-09-15 16:19 UTC by Julio Entrena Perez
Modified: 2023-03-24 13:52 UTC (History)
9 users (show)

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.
Clone Of:
Environment:
Last Closed: 2018-04-10 18:43:20 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1419521 0 unspecified CLOSED rear miss grub2-efi-modules dependency: fails mkrescue with Error occurred during grub2-mkimage of BOOTX64.efi 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 1601063 1 None None None 2021-01-20 06:05:38 UTC
Red Hat Knowledge Base (Solution) 3213391 0 None None None 2018-01-31 10:28:26 UTC
Red Hat Product Errata RHBA-2018:1000 0 None None None 2018-04-10 18:44:10 UTC

Internal Links: 1601063

Description Julio Entrena Perez 2017-09-15 16:19:53 UTC
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 20:59:03 UTC
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 18:14:01 UTC
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 13:56:55 UTC
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 19:32:50 UTC
suggested workaround: install the grub2-efi-x64-modules package

Comment 7 Pavel Cahyna 2017-11-28 13:27:37 UTC
*** Bug 1518217 has been marked as a duplicate of this bug. ***

Comment 9 Pavel Cahyna 2018-02-02 15:04:45 UTC
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 17:45:52 UTC
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 09:49:23 UTC
I'm ok with that.

Comment 15 Julio Entrena Perez 2018-02-09 10:31:57 UTC
(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 13:07:00 UTC
==========================
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 18:43:20 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, 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.