help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How does grubx64.efi find the /boot/grub partition?


From: Philipp Haselwarter
Subject: How does grubx64.efi find the /boot/grub partition?
Date: Thu, 21 Sep 2017 14:27:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Hi,

I've had some troubles when a windows update renumbered my partitions. I
managed to fix the problems, but it seems that there may be a way of
preventing future headaches, which brings me here.

I have two instances of grub registered on my UEFI system, one from Arch
Linux (this is the one I usually use) and one from an Ubuntu install (I
use this as a rescue system). After the Windows update, when I selected
the Arch grub from the UEFI boot menu, it failed to find its /boot
partition. I think the reason was that this partition now had a
different partition number from when it was installed. The Ubuntu system
on the other hand was working fine, even though its /boot partition had
also been assigned a different partition number.

The arch grub was installed via
sudo grub-install -v --target=x86_64-efi --efi-directory=/boot/efi 
--bootloader-id=arch_grub --recheck

My naive understanding of the installation process is that a .efi file
is copied onto the efi partition into a subfolder of /EFI, and
efibootmgr registers it with the UEFI system (whatever that means). Now
in /EFI/ubuntu I find:

$ ls -lh /boot/efi/EFI/ubuntu/
total 3.6M
drwxr-xr-x 2 root root 4.0K Jul 19  2016 fw
-rwxr-xr-x 1 root root  63K Jul 19  2016 fwupx64.efi
-rwxr-xr-x 1 root root  129 Jul 19  2016 grub.cfg
-rwxr-xr-x 1 root root 1.1M Jul 19  2016 grubx64.efi
-rwxr-xr-x 1 root root 1.3M Jul 19  2016 MokManager.efi
-rwxr-xr-x 1 root root 1.3M Jul 19  2016 shimx64.efi

On the other hand, for archlinux I find:

$ ls -lh /boot/efi/EFI/arch_grub/
total 124K
-rwxr-xr-x 1 root root 120K Sep 19 17:06 grubx64.efi


I would like to better understand how the start-up chain works, i.e.
who loads what and how do they know where to find it.

My guess would be that the Ubuntu system still booted because its
grubx64.efi was generated differently: it's 1.1M big, where the Arch one
is only 120k. And because there is a grub.cfg in the ubuntu folder with
these contents:

search.fs_uuid cc89543d-0e5f-416b-b8cb-f31eec1624d8 root hd0,gpt11
set prefix=($root)'/@/boot/grub'
configfile $prefix/grub.cfg

As a matter of fact, the fs_uuid does not reside on (hd0,gpt11) but on
(hd0,gpt10).

So my guess would be that the grub boot partition is hardcoded in the
Arch grubx64.efi while the Ubuntu includes enough modules to search for
the partition by uuid (thus the larger file size).

Is this the case? If so, how do I have to call grub-install (or
grub-mkimage or whatever generates grubx64.efi) to get the Ubuntu style
behaviour?


With kind regards,
-- 
Philipp G. Haselwarter




reply via email to

[Prev in Thread] Current Thread [Next in Thread]