#1193 Issue closed: rear miss grub2-efi-modules dependency: fails mkrescue with Error occurred during grub2-mkimage of BOOTX64.efi

Labels: enhancement, fixed / solved / done, minor bug

gdha opened issue at 2017-02-07 13:06:

  • rear version (/usr/sbin/rear -V): rear-2.00-1.fc25.x86_64
  • OS version (cat /etc/rear/os.conf or lsb_release -a): f25
  • rear configuration files (cat /etc/rear/site.conf or cat /etc/rear/local.conf):
  • Are you using legacy BIOS of UEFI boot? UEFI
  • Brief description of the issue:
    When running
    /usr/sbin/rear mkrescue

On a EFI system

it fails with error:

Error occurred during grub2-mkimage of BOOTX64.efi

[...]
2017-02-06 01:36:32 Including output/ISO/Linux-i386/250_populate_efibootimg.sh
grub2-mkimage: error: cannot open `/usr/lib/grub/x86_64-efi/moddep.lst': No
such file or directory.
2017-02-06 01:36:32 ERROR: Error occurred during grub2-mkimage of BOOTX64.efi
==== Stack trace ====
Trace 0: /usr/sbin/rear:504 main
Trace 1: /usr/share/rear/lib/mkrescue-workflow.sh:22 WORKFLOW_mkrescue
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 ==

This is caused by the miss of /usr/lib/grub/x86_64-efi/moddep.lst , provided on
Fedora by "grub2-efi-modules" package

gdha commented at 2017-02-14 08:18:

@gozora Does this issue ring any bell with you?

gozora commented at 2017-02-14 09:02:

Hello @gdha,

Thanks for my first assigned issue! :-)

Yes, it does ring a bell, (https://github.com/rear/rear/issues/849#issuecomment-227459162).
When talking about dependencies, this one is similar to https://github.com/rear/rear/issues/1198.

In my opinion, satisfy all dependencies we would need to install ALL programs ReaR is supporting, which is just waste. Because during installation of ReaR we basically don't know what backup type will be used. :-(
Not talking about solving nightmare where different distributions are using different names with different content...

This specific case is mentioned in docu, but yes, who is reading documentation nowadays?

Currently only idea I have, is something like rear configcheck which would check user created configuration and inform him about possibly missing packages ...

V.

jsmeix commented at 2017-02-15 10:56:

I think it is perfectly right and o.k. when
"rear mkbackup/mkrescue" errors out
with a meaningful error message in such cases.

When the user gets something like

Error: '/usr/lib/grub/x86_64-efi/moddep.lst': No such file or directory.

he is sufficiently informed what is missing.

Only an offhanded further comment:

I don't think a new workflow "configcheck" is needed.
I think during "rear mkbackup/mkrescue"
all needed checks should be done.

See also
https://github.com/rear/rear/issues/892
and in particular note
https://github.com/rear/rear/issues/755#issuecomment-171603580
and subsequent comments.
I.e. for me "rear mkbackup/mkrescue" did not error out
if a program in REQUIRED_PROGS does not exist.
I think during "rear mkbackup/mkrescue" according to the
values in /etc/rear/local.conf the REQUIRED_PROGS array
should be extended and if something is missing
"rear mkbackup/mkrescue" should error out.

For specific required files an additional array REQUIRED_FILES
might be useful where each array member is a list of files
separated by space where one of them must be present
so that one can specify AND and OR conditions like

REQUIRED_FILES=( '/path1/foo' '/path2/this /path3/that' '/path4/bar' )

which means that those files must exist
/path1/foo
AND
/path2/this OR /path3/that
AND
/path4/bar

gdha commented at 2017-02-15 12:18:

OK - we mark this one as won't fix then. I'll update the according RH bugzilla with our decision.
The following text was added to the RHBZ:
Using UEFI is not by default the standard boot mechanism, and therefore, we do not advise to add this rpm requirement to the rear spec file.
If needed a prep script can be added or enhanced to capture this short-coming. Your input is more then welcome - here and in the upstream story

gdha commented at 2019-01-04 13:59:

https://bugzilla.redhat.com/show_bug.cgi?id=1492177 explains how RH fixed the issue via a simple script:
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:

# 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."
)

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

Note from @gdha : if we decide to add this we should verify the OS version - probably only a script meant for RHEL

jsmeix commented at 2019-01-07 11:21:

At least on openSUSE Leap 15.0 (probably on all SUSE systems)
the directory is not /usr/lib/grub/ but /usr/lib/grub2/
so that the test should be
test -r /usr/lib/grub*/x86_64-efi/moddep.lst

In current ReaR we have the LogPrintError function
for messages that should appear in the log file and also
on the user's terminal regardless whether or not the
user launched 'rear' in verbose mode.

Finally I think we should better error out here because
I assume it cannot work on UEFI without the GRUB2 moddep.lst file, cf.
https://blog.schlomo.schapiro.org/2015/04/warning-is-waste-of-my-time.html

jsmeix commented at 2019-01-07 11:24:

I will try out something and do a pull request...

jsmeix commented at 2019-01-07 14:18:

In general I do not like to have one kind of functionality
split into pieces and spread over several scripts
(because it makes it harder to maintain that particular
functionality as a whole).

Accordingly I implemented all test for the prerequirements
to make a bootable EFI image of GRUB2 at the one same place
where the bootable EFI image of GRUB2 is actually made in the
build_bootx86_efi function via https://github.com/rear/rear/pull/2013

jsmeix commented at 2019-01-09 08:48:

With https://github.com/rear/rear/pull/2013 merged
this issue should be sufficiently solved:

Now it errors out if no /usr/lib/grub*/x86_64-efi/moddep.lst
file is found with

ERROR: grub2-mkimage would not make bootable EFI image of GRUB2
(no /usr/lib/grub*/x86_64-efi/moddep.lst file)

cf. https://github.com/rear/rear/pull/2013#issue-242669421

In general when some program or file is missing, we try to tell what is missing
but often things will just fail with a generic system error because we cannot
check all and every preconditions, cf. the section about
"No disaster recovery without testing and continuous validation" in
https://en.opensuse.org/SDB:Disaster_Recovery

If we detect something is missing, we will not tell the user what software package
(e.g. a rpm or deb package or whatever else) he must install to get the missing piece
because we cannot continuously track and maintain for all those various kind
of different Linux distributions what particular software package provides
what program or file in what version of each Linux distribution.


[Export of Github issue for rear/rear.]