Restore EFI boot partition

Forget grub entirely - it is nothing but a distraction. It isn't even a boot-loader anymore; on EFI systems the bootloader is built-in to the firmware. grub is just a boot-manager in that context - and almost definitely entirely redundant. What's more - it is probably the grub install that broke everything in the first place.

These are the things you need:

  1. A FAT-formatted GPT partition of type ef00.
  2. A UEFI-compatible system kernel located on that partition (such as the linux kernel).
  3. The path to that system kernel saved to a UEFI environment variable (commonly Boot0000-{UUID}, but this also depends on the value of BootOrder-{UUID}).

Strictly speaking, that is all. You can achieve the above setup with nothing more than gdisk and the efibootmgr command-line tools.

Pragmatically, a boot-manager does make sense - but grub is the most complicated of all of those available. As is elsewhere recommended, rEFInd is probably the best of the bunch.

I have written a step-by-step tutorial before on how to partition, format, and setup a rEFInd-enabled EFI system partition before here. Here also is another answer on this subject, in which you might find some further explanation about the assertions I make here.


When I reinstalled my ESP and grub I used rEFInd: http://sourceforge.net/projects/refind/files/?source=navbar (the flashdrive variant) to boot into my distribution.

After booting mount your ESP into /boot/efi

mount -t vfat /dev/yourESPdev /boot/efi

Then you should be able to reinstall grub with this EFI directory.

grub-install --efi-directory=/boot/efi

This should restore grub. If your ESP was deleted and you had to recreate it, then you will have to update it's UUID in /etc/fstab. Use blkid to list the UUIDs of your devices. After updating the UUID of your device in /etc/fstab, run update-grub.

You will probably also have to create a new efi entry for grub. Use something along the lines of:

efibootmgr -c -d /dev/yourHD -p ESP_PartionNumber -L "Boot Title" -l '\\EFI\\DIST\\grubx64.efi' -u "root=/dev/yourRootFS"

Where ESP_PartitionNumber is the number of your ESP on the hard drive (/dev/sda1 would be 1), and DIST is a folder whose name is specific to your distro unless you created it. The folder is in /boot/efi/EFI. Boot Title is simply the title you want for your EFI entry.

It has been some time since I reinstalled my ESP, so I can't test any of these commands again. You may need more parameters for some, but I am pretty sure this was all.

Tags:

Uefi