If you replace an UEFI motherboard, you will need to add paths of your OS loaders to UEFI.
It can be done by efibootmgr
utility. You will need to boot from Ubuntu LiveUSB, find your EFI partition and add the records.
The EFI partition can be easily found. It is a small fat32 partition, that has a boot
flag in many cases.
EFI loaders are files located at your EFI partition. Ubuntu has two loaders grubx64.efi
and shimx64.efi
. The latter is signed with Microsoft key to be able to boot with Secure Boot on. But in most cases either one works. You can safely add only shimx64.efi
.
These loaders are located at /boot/EFI/ubuntu
.
So to add a record to UEFI you will need to run
sudo efibootmgr -c -l "\EFI\UBUNTU\SHIMX64.EFI" -L ubuntu -d /dev/sdX -p N
where /dev/sdX
is the disk where EFI partition is located and N
the number of that partition. For example for /dev/sdb2
it will look this way
sudo efibootmgr -c -l "\EFI\UBUNTU\SHIMX64.EFI" -L ubuntu -d /dev/sdb -p 2
/dev/sda1
is default. If you have your EFI partition there, you can skip -d
and -p
parameters.
-c
parameter is to create an UEFI record.
-l
is a path to the loader in Windows format starting with \EFI
for some reason.
-L
is a label. You will see it in your bios as a boot option. You can change it to something else, but I am not sure that update-grub
will not change it to ubuntu
back.
If you run sudo efibootmgr -v
, you will see all your records with paths and labels.
You can remove a wrongly added record by running
sudo efibootmgr -Bb nnnn
where nnnn
is the record number.
More information regarding efibootmgr
utility can be obtained by
man efibootmgr
You can add records for other OSes like Windows the same way. But I can't give more details on what files and what paths they are located at.