Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 524152 - sys-boot/grub-2.02_beta2-r* - updating (or installing) grub on the efi-partition does not work
Summary: sys-boot/grub-2.02_beta2-r* - updating (or installing) grub on the efi-partit...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: Normal major (vote)
Assignee: Mike Gilbert
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-30 19:14 UTC by Gerold Schellstede
Modified: 2014-10-02 14:31 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gerold Schellstede 2014-09-30 19:14:18 UTC
I use "grub2-install --target=x86_64-efi --boot-directory=/boot/efi/efi --bootloader-id=GRUB --recheck" to update (or install a new) grub on my Efi-Partition (sda1 with Fat32). Up to version 2.00_p5107-r2 everything works well. But grub-2.02_beta2 and also grub-2.02_beta2-r2 says me that they found no EFI-partition. If I reemerge the old 2.00_p5107-r2 it works again.

The efi-partiton is mountet into /boot/efi and grub is installed into the "Efi-Folder" of the "Efi-Partition"

Reproducible: Always

Steps to Reproduce:
As described in the "description" one tries to install grub's efi-application to the efi-partition by: "grub2-install --target=x86_64-efi --boot-directory=/boot/efi/efi --bootloader-id=GRUB --recheck"

Actual Results:  
Grub's efi-application is not installed to the efi-Folder on the efi-partition

Expected Results:  
grub-2.02_beta2 and also grub-2.02_beta2-r2 should akt like grub 2.00_p5107-r2 and install grub's efi-application to the efi-Folder on the efi-partition.
Comment 1 Mike Gilbert gentoo-dev 2014-09-30 19:22:05 UTC
Can you show me your partition setup?

For example, the output of fdisk -l /dev/sda or gdisk -l /dev/sda. Replace sda with the appropriate block device.
Comment 2 Mike Gilbert gentoo-dev 2014-09-30 19:24:14 UTC
Also, I wonder why you are passing --boot-directory=/boot/efi/efi. That makes no sense.

If you could show me /proc/self/mounts and the contents of /boot, /boot/efi, and /boot/efi/efi that might help.
Comment 3 Mike Gilbert gentoo-dev 2014-09-30 19:25:44 UTC
Also, please provide the output of the grub2-install command.
Comment 4 Gerold Schellstede 2014-10-01 12:12:50 UTC
Thanks for your reply:

grub-2.02_beta2(-r2) says:

blabla# grub2-install --target=x86_64-efi --boot-directory=/boot/efi/efi --bootloader-id=GRUB --recheck
Installing for x86_64-efi platform.
grub2-install: Fehler: cannot find EFI directory.

------------------------------------------------
My partition configuration:
blabla# gdisk -l /dev/sda
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 1953525168 sectors, 931.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 78A31DDB-BE31-410F-9FE9-4DE439F038E2
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         2099199   1024.0 MiB  EF00  EFI System
   2         2099200         2361343   128.0 MiB   0C01  Microsoft reserved ...
   3         2361344       217139199   102.4 GiB   0700  Basic data partition
   4       217139200       421939199   97.7 GiB    0700  Basic data partition
   5       421939200       524339199   48.8 GiB    0700  Basic data partition
   6       524339200       729139199   97.7 GiB    0700  Basic data partition
   7       729139200       792627199   30.3 GiB    0700  Basic data partition
   8       792627200       794724351   1024.0 MiB  8300  Linux filesystem
   9       794724352       899579903   50.0 GiB    8200  Linux swap
  10       899579904      1109295103   100.0 GiB   8300  Linux filesystem
  11      1109295104      1518972927   195.3 GiB   8300  Linux filesystem
  12      1518972928      1521070079   1024.0 MiB  8300  Linux filesystem
  13      1521070080      1625927679   50.0 GiB    8200  Linux swap
  14      1625927680      1835642879   100.0 GiB   8300  Linux filesystem
  15      1835642880      1953525134   56.2 GiB    8300  Linux filesystem
-----------------------------------------------------

Ok, the setup is crazy. Partition 1 ist the EFI-Partition. Partitions 2-7 are Windows (NTFS), 8-11 is Gentoo Linux I use for work (EFI-partition not mountet). 12-15 is Gentoo Linux I use for updating (hold Gentoo up to date and build stage4 for installing new versions for "work"). 

Everything concerning grub I make from the "12-15 Update-System". Here 14 is the root-partition "/" where 12 is mounted into "/boot" and 15 into "/home". The Efi-partition (FAT32) is mountet into "/boot/efi". Inside the efi-partition there exist a folder also named "efi". Therefore the grub-application has to be installed into "/boot/efi/efi/grub" whereas for example Microsoft installed it's efi-application into "/boot/efi/efi/Microsoft". The Efi-BIOS of my motherboard automatically loads the application stored in "/boot/efi/efi/boot".

Therefore the argument "--boot-directory=/boot/efi/efi" is necessary to install grub's efi-application into "/boot/efi/efi/grub" The manpage of grub2-install says:
"--boot-directory=DIR
              install GRUB images under the directory DIR/grub instead of the
              boot/grub directory"

With all grub2 Versions before grub-2.02_beta2 this prcedure worked very well. Since grub-2.02_beta2(-r2) it wors anymore. (I use grub 2 sine a long time ago)

Content of /boot: The kernel image and the efi-folder

Content of /boot/efi: Only the mounted efi-partition. The efi-partition contains only one folder also named "efi"

Content of /boot/efi/efi: three folders: grub, Microsoft and BOOT
Comment 5 Mike Gilbert gentoo-dev 2014-10-02 00:02:23 UTC
Ok, so this is sort of an oddball grub configuration.

I think grub-install was changed to assume that the EFI directory will be (boot-directory)/efi.

You can probably accomplish your desired config by manually passing the EFI directory to grub-install.

       --efi-directory=DIR
              use DIR as the EFI System Partition root.

Try this:

grub2-install --target=x86_64-efi --boot-directory=/boot/efi/efi --efi-directory=/boot/efi ...
Comment 6 Gerold Schellstede 2014-10-02 08:09:52 UTC
It worked! Thanks a lot! 

Anyway: I looked in the Gentoo Wiki and they also asume that one uses /boot/efi/EFI (See two lines under "Install Grub")

http://wiki.gentoo.org/wiki/GRUB2#UEFI.2FGPT

If one mounts the efi-partition under /boot so that one installes grub to /boot/EFI one has to store the kernel onto the efi-partition (In the case the kernel should be located at /boot). If one has a seperate boot-partition one has to use /boot/efi/EFI or not?
Comment 7 Mike Gilbert gentoo-dev 2014-10-02 13:29:05 UTC
(In reply to Gerold Schellstede from comment #6)

grub is not normally installed to the EFI system partition if you do not mount it on /boot.

In such a scenario, just the core image is installed on the EFI system partition, which is expected to be mounted at /boot/efi. The rest of grub gets installed to /boot/grub.
Comment 8 Gerold Schellstede 2014-10-02 14:31:26 UTC
Aha! Then it is clear why I am alone with my problem. Thanks again for your support!