13.1 - Error while installing GRUB2 EFI

A bit of background, I have been using openSUSE for a pretty long time (7+ years) and I have always used the MBR partitioning scheme. I built a new workstation and I went with a 3 TB drive. I thought it would be a good idea to use GPT partitioning scheme and since UEFI supports it, why not boot the system in UEFI mode.

  • My Hard disk was partitioned manually by myself first to create a GPT partition table with all the recommended partitions (ESP, MSR, Few Windows partitions, A Linux root partition, A swap partition and few other data partitions) using a gparted Live CD.

  • I had installed Windows 7 first onto this hard drive (in UEFI mode) and was able to boot that successfully.

  • I set “Other OS” within my BIOS Secure Boot option so that it will allow booting EFI bootloaders which are not signed.

  • I booted off a 13.1 Gnome Live CD in UEFI Mode (I have a Asus Z87 Pro motherboard and I explicitly chose booting the CD in UEFI mode).

  • I wanted to confirm that I was actually booted in EFI mode. I verified that /sys/firmware/efi/efivars was populated.

  • I chose the Live Install option.

  • Chose custom partitioning

  • Specified mount points for /boot/efi, / (also format this partition), Linux Swap, and mount points for the Windows partitions.

  • I chose GRUB2-EFI as the bootloader.

  • The installer went through almost all the way till the end. When it tried installing the bootloader, it gave an error popup saying “Error installing GRUB2”, but it did not give any information or details about the error within the popup.

  • It asked me to retry specifying the bootloader configuration, but it kept failing.

  • I just finally chose to continue even with the failure.

Now my system still boots directly into Windows 7. In addition I do not see any boot entries for opensuse in my UEFI boot manager.

I took a look at the /boot/efi partition after this, and saw a directory EFI/opensuse with an .efi file under it (can’t remember the filename right now, can take a look once I’m back to the machine)

These are my 2 questions:

  1. Where are the logs for the installation stored at ? I would like to take a look at them to get more details about the error if possible.

  2. Would manually installing grub2-efi from a Live CD like this work (after manually mounting the the / and /boot/efi partitions) ?

grub2-install --target=x86_64-efi --efi-directory=/mnt/boot/efi --boot-directory=/mnt/boot --bootloader-id=opensuse

I presume I should also be running grub-mkconfig and efibootmgr after this to create the GRUB configuration and add an UEFI boot entry in the nvram after the grub2-install step. ?

I figured out the problem and SOLVED it. It looks like when grub2-install or a successive step during the grub2-efi installation calls efibootmgr to create a boot menu entry it was failing on my system. I came to this conclusion because I saw all the files were populated under the $esp/EFI/boot/opensuse as well as the grub2 config files under /boot/grub2

Somehow when I ran efibootmgr to create a new boot menu entry from the Live CD, it does not display any error message on the console (in fact no output at all), whereas the return code ($?) is always 1. This kind of explains the error message popup without any errors. I think there should be a bug filed for this, to indicate where the failure was at least.

I wanted to get into UEFI shell, but somehow my motherboard’s BIOS was not letting me launch UEFI shell without disabling **Secure Boot **which was pretty lame.

I used an ArchLinux ISO to boot into UEFI shell instead. Then added the boot menu entries manually using:

bcfg boot add <OPTION_NUM> fs0:\EFI\opensuse\grubx64.efi

I also added entries for the UEFI Shell, and rEFind.

Now everything works.

Just as a reference, this is how my partition table looks like:

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048            6143   2.0 MiB     EF02  
   2            6144         2103295   1024.0 MiB  EF00  
   3         2103296         2365439   128.0 MiB   0C01  
   4         2365440       212080639   100.0 GiB   0700  
   5       212080640      1050941439   400.0 GiB   0700  
   6      1050941440      1470371839   200.0 GiB   0700  
   7      1470371840      1889802239   200.0 GiB   0700  
   8      1889802240      5111027711   1.5 TiB     0700  
   9      5111027712      5178136575   32.0 GiB    8200

And the output of efibootmgr:

BootCurrent: 0002
Timeout: 1 seconds
BootOrder: 0002,0000,0005,0004,0007,0009,0008
Boot0000* Windows 7	ACPI(a0341d0,0)PCI(1c,5)PCI(0,0)03120a000000ffff0000HD(2,1800,200000,12cbc759-f68c-4a1a-9b24-5177f9af51b3)File(\EFI\Microsoft\Boot\BOOTMGFW.EFI)
Boot0002* openSUSE	ACPI(a0341d0,0)PCI(1c,5)PCI(0,0)03120a000000ffff0000HD(2,1800,200000,12cbc759-f68c-4a1a-9b24-5177f9af51b3)File(\EFI\opensuse\grubx64.efi)
Boot0004* UEFI Shell v2	ACPI(a0341d0,0)PCI(1c,5)PCI(0,0)03120a000000ffff0000HD(2,1800,200000,12cbc759-f68c-4a1a-9b24-5177f9af51b3)File(\EFI\Boot\shellx64.efi)
Boot0005* rEFind	ACPI(a0341d0,0)PCI(1c,5)PCI(0,0)03120a000000ffff0000HD(2,1800,200000,12cbc759-f68c-4a1a-9b24-5177f9af51b3)File(\EFI\refind\refind_x64.efi)
Boot0007* Windows Boot Manager	HD(2,1800,200000,12cbc759-f68c-4a1a-9b24-5177f9af51b3)File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}...a................