I recently installed Fedora 18 using EFI boot. Like the other current linux distributions, it sets up GRUB2 for me.

I have experience with re-installing the BIOS version of GRUB when things go wrong. I know e.g. how to boot a rescue disc, chroot into the installed system, run grub-install and possibly update-grub / grubby / grub-mkconfig.

How would I reinstall the EFI version of GRUB when things go wrong? (I know things will go wrong: I break them).

  • Why have you asked a vague question and then immediately answered it? Although the answer provides useful information, the question really needs elucidation: Knowing you changed something is not sufficient. Understanding precisely what was changed is really necessary to provide a good response to the question.
    – Rod Smith
    May 16, 2013 at 17:35
  • @RodSmith thanks for replying to my email about EFI earlier :). And for adding your comment to the downvotes. The question I started with was literally this. I'm experienced with re-installing grub-pc. I want to have the same level of confidence, that I know how to recover an EFI system. I editted the question once to emphasize that it was about reinstalling grub... I guess I should try again and be more explicit about my motive.
    – sourcejedi
    May 17, 2013 at 7:44
  • Why are you using grub if you have UEFI? What advantage does chaining the two boot loaders provide?
    – Marco
    May 17, 2013 at 7:59
  • @Marco UEFI is not the boot loader supported by any linux distribution I know! Fedora updates GRUB automatically when it installs a new kernel, and installs necessary boot options like root=. It doesn't do that for EFI. I could abandon distribution support & use REFIND's automatic scanning w/ kernel options in refind.conf, but that would still be chaining boot loader/managers! And Microsoft don't sign GPL drivers, so Secure Boot has to go SHIM->boot loader->Linux anyway, and you really want a boot menu after the UEFI->SHIM part.
    – sourcejedi
    May 17, 2013 at 8:18
  • After installing a new kernel a single call to efibootmgr is sufficient to update the entry in the UEFI menu. I don't know about rEFInd or SHIM. I personally don't chain multiple boot loaders. All operating systems are added to the UEFI boot menu and it's working perfectly fine.
    – Marco
    May 17, 2013 at 8:32

5 Answers 5


Firstly, you will need an EFI-booted linux system. If you still have your original install media (CD/DVD/USB stick), that should usually include an adequate rescue system. It might even have a one-click repair option :).

Alternatively, the Ubuntu community provides an automatic boot-repair image. It claims to support Fedora. If you want to know what it actually does, I suggest you read this third-party explanation in advance.

However I used a general purpose rescue system with console tools. As well as supporting EFI boot, I made sure efibootmgr is in the list of packages. It happened to be called GRML and was based on Debian. Here's the information about console tools and grub-efi I discovered while rescuing my Fedora system:

  1. When running a Fedora 18 system booted by EFI, do not run grub2-install. It will claim success, but it breaks the Fedora grub-efi boot system.

    • The file /boot/EFI/fedora/grub.efi is installed by the grub-efi package. If you do want to reinstall it, use yum reinstall grub-efi. (To do this from a generic rescue system, you can do this after mounting and chrooting into your installed Fedora system). Fedora grub-efi uses the config file /boot/EFI/fedora/grub.cfg (presumably generated by grubby). Fedora on EFI won't generate a file at /boot/grub2/grub.cfg. Running grub2-install will replace grub.efi with an image that tries to read /boot/grub2/grub.cfg, and will therefore fail.

    • grub2-install installs an EFI boot entry for grub.efi. However if you have not disabled Secure Boot in your Windows 8-certified firmware, this entry will fail to boot. You need to boot shim.efi instead (ignore shim-fedora.efi, I'm not sure exactly what that is). See below.

  2. You can lose your EFI boot entry for Fedora if your firmware settings are reset. (Manually, or by firmware upgrade, or because firmware is buggy - the latter has been reported in the wild). Here's how to manually create an EFI boot entry for Fedora with secure boot:

    $ sudo efibootmgr -c -L Fedora -d /dev/sda -p 100 -l \\EFI\\fedora\\shim.efi

    This example uses partition number 100 on the first standard disk recognized by linux. You should adjust the options -d /dev/sda and -p 100 to identify the filesystem which Fedora mounts at /boot/efi. This is an EFI system partition. The Fedora installer will have created a dedicated ESP for your Fedora install to use, separate from the ESPs used by any other operating system. (This is different from Ubuntu and OpenSUSE).

    Note the efibootmgr command requires that you run it from an EFI-booted system.

  • "Note the efibootmgr command requires that you run it from an EFI-booted system." - in this case how do you "bootstrap" an EFI-booted system? (my current USB won't boot when selecting the UEFI option)
    – jozxyqk
    Jan 9, 2017 at 3:46
  • 1
    Install media is the supported way to bootstrap your system. I think you should also be able to boot an EFI system without installing EFI firmware variables, it involves creating /EFI/boot/bootx64.efi (assuming 64-bit UEFI). This is exactly how USB install media work (anything other than CDs / DVDs). It could be sufficient to copy shim.efi there, but I'm not sure if that's set up to work or not.
    – sourcejedi
    Jan 9, 2017 at 8:08

If you are dual-booting with UEFI Windows, there's another possibility. which doesn't require a recovery disk.

You can boot into Windows, open a command line with admin privileges, and run the following command:

bcdedit /set {bootmgr} path \EFI\fedora\shim.efi

This will replace the Windows boot entry in UEFI, with one that boots into GRUB. Assuming your GRUB menu then includes a working entry for Windows, you now have working dual-boot :-). Hopefully this should all work without disabling Secure Boot.

I have just had to do so myself after a Windows update and it seems to have done the trick.

Source and more information: http://nwrickert2.wordpress.com/2013/05/13/notes-on-uefi-windows-and-linux/.

  • Alternatively, see the two solution described at askubuntu.com/a/799734/462004 (using EasyUEFI or how to change the boot order using bcdedit.exe instead of the Windows entry like your command does).
    – phk
    Jul 17, 2016 at 14:47


dnf reinstall grub2-efi grub2-efi-modules shim

(assuming you have those packages already installed and a previous configuration is existing)

  • Thanks! "Create a boot menu entry: TL;DR: This should happen automatically" - yay.
    – sourcejedi
    Feb 2, 2016 at 8:45
  • Oh yea, it does: grub2-mkconfig -o /boot/grub2/grub.cfg (or on an (U)EFI system it would be something like grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg. Didn't work?
    – user552724
    Feb 2, 2016 at 15:25
  • Sorry, I meant the wiki implies that re-installing the grub package re-creates the EFI variables which are necessary to boot GRUB (which might need to be recreated e.g. if you reset the "BIOS" settings for some reason). I don't think I'd tried dnf reinstall, and if true it sounds pretty great.
    – sourcejedi
    Feb 2, 2016 at 15:34

Just to keep it simple here is all you do:

yum reinstall grub2-efi

DO NOT run grub2-install it will break your system by presenting you with a blank grub boot menu (this is because grub2-install will give you a bad/generic .efi file that tries to load grub.cfg from the wrong location.

Additionally you may want to update your grub-config if you have migrated to new disks or your partition/layout has changed with:

grub2-mkconfig -o /boot/EFI/fedora/grub.cfg
  • Nice to read some confirmation :). I proposed an edit showing how grub2-mkconfig has to be used with -o. I'm unclear how useful the simple answer is though - not that mine is strictly more useful, but this assumes you're still able to boot the Fedora system somehow, or you noticed you'd made a mistake before you shut down. (My answer handwaves about generic rescue disks, but AFAIK you need to chroot into the install, making sure to mount whatever filesystems are needed... that's the nice thing about a specialized rescue system like the Debian installer, it does the mount+chroot for you).
    – sourcejedi
    Jul 4, 2017 at 11:38

In my case, I broke my Fedora installation by running grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg (could have sworn this used to the right path) after modifying /etc/default/grub. The path to the main GRUB2 configuration file in Fedora is now /boot/grub2/grub.cfg, and the config file on the EFI system partition contains only enough config to load that GRUB2 config from /boot/grub2.

The small config file on the ESP is created by the postinstall script of the grub2-common package. That script can be viewed by running rpm -q --scripts grub2-common. To fix my error, I removed the /boot/efi/EFI/fedora/grub.cfg file that I had created and ran sudo dnf reinstall grub2-common to regenerate it as it should be.

Fedora GRUB2 documentation

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .