Modern computers with UEFI are a pain when you are installing a system different from windows and is harder if you want a double boot.
Last week I installed Linux Mint on my laptop that already has Windows. If you didn't know Linux Mint is a distribution based on Ubuntu so this process applies to both distributions.
The problem was can't boot with the Linux Mint grub even after trying to change the order of boot with
efibootmngr. You can open the boot menu pressing a key in the boot it is different for each motherboard it could be ESC, F2, F10 or F12, and select the system that you want to boot in my case Linux mint.
On Linux, we need to see the boot order for EFI with this command:
And you will see something similar to this:
BootCurrent: 0002 Timeout: 0 seconds BootOrder: 0000,0002,0001,2001,2002,2003 Boot0000* Windows Boot Manager Boot0001* Unknown Device: Boot0002* ubuntu Boot2001* EFI USB Device Boot2002* EFI DVD/CDROM Boot2003* EFI Network
The important in this output is the BootOrder, as you can see it is booting Windows and it resets on every boot, so How I solve the problem?
For some reason the Mint/Ubuntu entry for EFI boot is not working correctly you can get more information with the verbose option for efibootmngr, remember the Mint/Ubuntu id because we are going to use it in the next step.
sudo efibootmgr -v
So we are going to delete ubuntu from the boot, in my case 0002 is the ubuntu id and it can be different. The command to delete the entry is:
sudo efibootmgr -Bb 0002
Next step is to create again the entry with efibootmgr for Mint/Ubuntu:
sudo efibootmgr -c -L "Linux Mint" -l '\EFI\ubuntu\grubx64.efi'
Now that we have the new entry, we want to check the Boot Order with the command
efibootmgr because it could change, if you already have the entry in the first place you don't need to do extra steps.
Change the Boot Order
If after create the new entry the Boot Order still wrong, you can change it using the command
efibootmgr, in the case that you got the same id 0002 it should be the first id in the Boot Order.
To change the boot order with efibootmgr you need to use this command:
efibootmgr -o 0002,0000,2001,2002,2003
And that is, now you can reboot and check if everything is working.