15

I know this is a pretty common problem, but I've tried a bunch of common answers (enumerated below) to no avail.

Basic setup: I'm setting up a Fedora 31 / Ubuntu 18.04 dual-boot, each with a separate encrypted / and non-encrypted /boot partition, and a single /boot/efi partition for a total of 5. Installed Fedora first, then Ubuntu. All went smoothly, and I can boot into either from the efi boot menu. I'd like to lock the efi boot order and make the startup choice in grub though, and the current Ubuntu grub options missed Fedora. So I booted into Fedora and tried grub2-install /dev/sda to reset the MBR to Fedora's grub configuration and add Ubuntu. Instead I got the oh-too-common grub2-install: error: /usr/lib/grub/x86_64-efi/modinfo.sh doesn't exist. Please specify --target or --directory.

Despite all this all I can find in my /usr/lib/grub directory is arm64-efi and i386-pc but no x86_64-efi. I'm a little out of my depth with this bootmgr stuff (my experience extends as far as hammering these problems until they work every time I have a new install).

Does anyone have a guess at what the problem is or another place to search for answers?

9 Answers 9

14

First I ran "dnf provides" to find the right package:

dnf provides /usr/lib/grub/x86_64-efi

Then I installed the right package using its full name:

dnf install grub2-efi-x64-modules-1:2.06~rc1-2.fc33.noarch

1
  • This works for my CentOS 8 stream dnf provides /usr/lib/grub/i386-pc sudo dnf install grub2-pc-modules-1:2.02-99.el8.noarch Commented May 2, 2022 at 17:54
7

I could add the missing modules by installing grub2-efi-x64-modules package on Fedora.

In my case I had another error after that that "EFI variables were not supported on my system". I found another stackexchange post and could fix that by exiting the chroot environment and loading the efivarfs module by modprobe efivarfs. Then I logged back in into the mounted root and mounted it via mount -t efivarfs efivarfs /sys/firmware/efi/efivars.

7

On ubuntu (this will create efi support in /usr/lib/grub/x86_64-efi)

sudo apt install grub-efi
2

Maybe try

grub2-install --target=arm64-efi --efi-directory=/boot/efi --bootloader-id=grub2
1

I solved by installing grub2-efi-modules and efibootmgr

1

For deb system

apt install grub-efi-amd64-bin

for rpm system

dnf install grub2-efi-x64-modules

in my case it helped

1

If your server supports both BIOS and UEFI modes, perhaps you tried installing grub-efi while it was in BIOS mode. In doubt, check if /sys/firmware/efi is available on your system. If it isn't your machine is likely using BIOS.

0

I was on Ubuntu 20.04.1 live CD when I encountered this problem. I tried CodeAlfa's and A-la She's answers, but they didn't work.

Coincidentally, I had installed Artix Linux so I had the iso still on my disk. artix-base-runit-20201128-x86_64.iso image had the file /usr/lib/grub/x86_64-efi/modinfo.sh.

I mounted rootfs.img (inside the Artix iso image) and copied the entire directory over:

mkdir /tmp/axi && mount artix-base-runit-20201128-x86_64.iso /tmp/axi
mkdir /tmp/rfs && mount /tmp/axi/LiveOS/rootfs.img /tmp/rfs
cp /tmp/rfs/usr/lib/grub/x86_64-efi /usr/lib/grub/x86_64-efi -r

This solved the problem.

0

I had this problem after installing some updates, which apparently did not succeed. I tried lots of things, and nothing seemed to work.

  • Finally I did this:
    yum history list      # find the ID where it all started
    yum history undo 147  # 147 was the ID of the failed patch
    
  • However, the undo command would not proceed (I can't remember the error), so I looked at the details of 147
    yum history info 147
    
  • I noticed it installed four kernel items, upgraded several packages, and removed some. I decided to remove the four kernel items, then re-install them.
    yum remove kernel-5.14.0-503.16.1.el9_5.x86_64 kernel-core-5.14.0-503.16.1.el9_5.x86_64 kernel-modules-5.14.0-503.16.1.el9_5.x86_64 kernel-modules-core-5.14.0-503.16.1.el9_5.x86_64
    yum install kernel-5.14.0-503.16.1.el9_5.x86_64 kernel-core-5.14.0-503.16.1.el9_5.x86_64 kernel-modules-5.14.0-503.16.1.el9_5.x86_64 kernel-modules-core-5.14.0-503.16.1.el9_5.x86_64
    

That fixed my problem, and I was able to boot into the latest kernel.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.