`--removable` may important when you fix startup by grub-install

Equipment: Support uefi, manufacturing date more than 10 years

error:

Create backup with tar, repartition and restore data, the root path is not updated when grub start, but grub.cfg is correct. I have to reset root and prefix every time.

log:

set
cmdpath=(hd3,gpt3)/EFI/BOOT
prefix=(hd0,gpt3)/boot/grub
root=hd0,gpt3

ls
ls (hd0,gpt2)/boot/grub
set root=hd0,gpt2
set prefix=(hd0,gpt2)/boot/grub
insmod normal
normal

Partition information:

/dev/sda1 ==> /boot/efi     fat32/esp
/dev/sda2 ==> /  			xfs
/dev/sda3 ==> /home  		xfs

some trying:

# start with liveCD

# mount and restore
mount /dev/sda2 /mnt
mkdir /mnt/home
mount /dev/sda3 /mnt/home
mkdir /mnt/boot/efi
mount /dev/sta1 /mnt/boot/efi
tar xvpzf /path/to/backup.tar.gz -C /mnt --numeric-owner

# fix grub
sudo arch-chroot /mnt
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=EndeavourOS
grub-mkconfig -o /boot/grub/grub.cfg

# fix default mounted
blkid
# update uuid
vim /etc/fstab

# create folders above excludes
mkdir proc
mkdir mnt
mkdir sys
mkdir run

exit
sudo umount /mnt/home
sudo unmout /mnt/boot/efi
sudo unmout /mnt
reboot

how to solve

I found the Differences by compare the OpenCore EFI files.

When using grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=EndeavourOS, it will create /EFI/EndeavourOS/grubx64.efi on path /boot/efi/, but not update /boot/efi/EFI/BOOT/bootx64.efi.

When add --removable parameter, it will ignore the bootloader-id and create efi file on default path and using default name.

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=EndeavourOS --removable

Maybe it’s too old for my computer to identify other efi path, but it 's effective.

What is your issue exactly? It is really unclear to me… :thinking:

Restoring data after partitioning the $ESP is not exactly that good (in my experience). Formatting $ESP is not recommended, or any backup restoration is advised as a solution. You always need to install the bootloader after that, to restore/create UEFI environment variables properly.

If your HW requires installing the bootloader at the default location, then you will always have to do it after re-partitioning.

I’m sorry, my English is not very good, and using translation software may cause semantic confusion.

In fact, I would like to remind some users of old devices that after repartitioning and restoring system data, they should pay attention to using some parameters of grub-install.

Some old devices only support booting from the default path such as /EFI/BOOT/bootx64.efi, and when you use grub-install without adding the --removable parameter, it will not update to the default path mentioned above.

Actually, my $ESP partition file is the restored backup data. If I had discovered earlier that grub-install cannot create /EFI/BOOT/bootx64.efi by default.

As for why my partition number has changed, I remember that when I last created the system, the partition tool inserted an unused blank partition before the ‘/’ partition, so its partition number was (hd0,gpt3), and this time I manually created the partition, so the ‘/’ partition number is (hd0,gpt2).

So, IIUC this is an advice topic, not asking for support.

The knowledge you have discovered is already known and documented in Archwiki (the link I have posted above) and in man pages of grub-install and efibootmgr.

This is an issue with different (bad) UEFI implementations by some vendors in some HW.

:wink: :+1:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.