Bug 1277227 - grub2-install fails in anaconda (pre) shell with 'grub2-install: error: /usr/lib/grub/x86_64-efi/modinfo.sh doesn't exist. Please specify --target or --directory.' [NEEDINFO]
grub2-install fails in anaconda (pre) shell with 'grub2-install: error: /usr/...
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: lorax (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Brian Lane
Release Test Team
Depends On:
  Show dependency treegraph
Reported: 2015-11-02 12:59 EST by Joseph Tingiris
Modified: 2018-04-05 08:55 EDT (History)
5 users (show)

See Also:
Fixed In Version: lorax-19.6.67-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-11-03 19:44:57 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
pkhedeka: needinfo? (bcl)

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2165 normal SHIPPED_LIVE lorax bug fix and enhancement update 2016-11-03 09:15:01 EDT

  None (edit)
Description Joseph Tingiris 2015-11-02 12:59:18 EST
Description of problem:

grub2-install fails if run from anaconda pre shell or used within pre script on an x86_64 EFI based machine.

The grub target for x86_64-efi is missing.  There is no /usr/lib/grub/x86_64-efi.

Version-Release number of selected component (if applicable):


anaconda 19.31.123-1

How reproducible:

run grub2-install when in anaconda 19.31.123-1 pre install shell on an EFI based machine

Steps to Reproduce:
1. kickstart or otherwise boot an x86_64 EFI based machine with install media
2. go to shell (alt+f2 or ssh)
3. execute grub2-install

Actual results:

grub2-install: error: /usr/lib/grub/x86_64-efi/modinfo.sh doesn't exist. Please specify --target or --directory.

Expected results:

Installing for x86_64-efi platform.
grub2-install: error: cannot find EFI directory.

Additional info:

Copying the contents of /usr/lib/grub/x86_64-efi/ from an installed machine gets grub2-install working properly.
Comment 2 Brian Lane 2015-11-02 13:38:56 EST
Why are you trying to run it from %pre?
Comment 3 Joseph Tingiris 2015-11-02 14:25:37 EST
The project I'm working has a requirement for a custom recovery/install partition.  As a result, all partitioning is done in pre so it can be created (or preserved) as necessary.  The methods and reasoning for doing custom partitioning via pre is well established.

In this case, physical access to the machines is limited.  They are headless appliances and being booted via said recovery/install partition over the Internet via inst.ks (https, not pxe).  Transient network failures are a reality.  Installs don't always go as planned.

In the event post install fails, the machine must be able to reboot itself from the recovery partition and ultimately try again unattended (via grub2/custom.cfg).  The recovery partition is also used as a 'factory reset' mechanism and more.

Everything works as planned on bios based machines.  grub2-install performs as expected, etc.  With the proliferation of more modern hardware, duplicating the same functionality on EFI based machines is desirable.  All of the necessary tools are already available in pre and the only missing component is apparently /usr/lib/grub/x86_64-efi/
Comment 4 Brian Lane 2015-11-02 14:41:30 EST
Thanks for the additional detail. Lorax should include grub2-efi-modules when building the boot.iso
Comment 8 errata-xmlrpc 2016-11-03 19:44:57 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.

Comment 9 Parikshit Khedekar 2018-04-05 08:53:45 EDT

Reopening the BugZilla as the issue is still faced in Red Hat Enterprise Linux 7.4 and 7.5 Beta as well.

The installation media of DVD RHEL7.4 doesn't include any file within /usr/lib/grub ( this directory is empty). For this reason, the command fails.

Reproducible as, enter in rescue mode from a RHEL7.4 DVD and try to execute the command, you will see that this folder is empty.

Another way to reproduce it is to mount the stage2 LiveOS/squashfs.img (anaconda installation) and verify that the /usr/lib/grub folder is empty.
But it does not recommend doing it.

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