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
# 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.
What is your issue exactly? It is really unclear to me…
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.
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.