Ubuntu – UEFI boot menu items for Ubuntu and Linux Mint both launch Ubuntu

dual-bootgrub-efigrub2mintuefi

I tried installing Ubuntu 16.04 and Linux Mint 18 on separate partitions of a hard drive, with two other partitions to be mounted as /boot (one for each). The idea was to have the two systems completely independent and to select between them through the laptop's UEFI boot menu. I was also hoping to be able to make each boot loader see the other one. In the future I planned to add yet another distribution.

The first thing that seems to be out of order is that the installers of both Ubuntu and Mint asked me where to install the boot loaders, despite that Ubuntu's community documentation says:

Note that in a UEFI-mode installation, Ubuntu will not ask you where to install the boot loader. If it does, or if it complains about the lack of a BIOS Boot Partition, you've probably accidentally booted in BIOS/CSM/legacy mode.

(I am pretty sure that I was booted in UEFI-mode: "Launch CSM" was disabled in UEFI setup, and at the end the installed systems were mounting EFI system partition under /boot/efi.)

As I had to choose where to install the boot loaders, I selected them to be installed to respective /boot partitions.

After installing Ubuntu, it showed up in UEFI boot menu. Inspecting the ESP (EFI system partition), I found that a directory /EFI/ubuntu was created. With help of efibootmgr, I determined that the startup file for Ubuntu was \EFI\UBUNTU\SHIMX64.EFI. (In fact, the first time I tried installing Ubuntu, I selected "do not use this partition" for ESP, but it was used nonetheless.)

Afterwards I installed Mint, and what happened was that "ubuntu" item in UEFI boot menu started launching Mint's GRUB instead of Ubuntu's GRUB, and I found no way to start Ubuntu anymore. It turned out that Mint had overwritten the /EFI/ubuntu directory on ESP with its own files.

My main problem is still ahead.

I have figured out that if I reinstall Mint's GRUB with the following command

sudo grub-install --efi-directory=/boot/efi --bootloader-id=linux-mint

it will create a EFI/linux-mint directory with its startup "kernels." Here is the contents of this directory after the above operation:

$ sudo ls -l /boot/efi/EFI/linux-mint
total 3546
-rwx------ 1 root root     121 juil. 28 22:05 grub.cfg
-rwx------ 1 root root 1067896 juil. 28 22:05 grubx64.efi
-rwx------ 1 root root 1271672 juil. 28 22:05 MokManager.efi
-rwx------ 1 root root 1289424 juil. 28 22:05 shimx64.efi

Through UEFI setup, I added "linux-mint" boot option pointing to /EFI/linux-mint/shimx64.efi, and it worked.
(I regret now not having removed /EFI/ubuntu directory first for a cleaner experiment).

I reinstalled Ubuntu, and it recreated its /EFI/ubuntu:

$ sudo ls -l /boot/efi/EFI/ubuntu
total 3610
drwx------ 2 root root    1024 juil. 28 22:23 fw
-rwx------ 1 root root   64352 juil. 28 22:23 fwupx64.efi
-rwx------ 1 root root     121 juil. 28 22:25 grub.cfg
-rwx------ 1 root root 1067896 juil. 28 22:25 grubx64.efi
-rwx------ 1 root root 1271672 juil. 28 22:25 MokManager.efi
-rwx------ 1 root root 1289424 juil. 28 22:25 shimx64.efi

In UEFI boot menu, "ubuntu" entry appeared automatically together with the "manually" created before "linux-mint". The "ubuntu" entry launched Ubuntu's GRUB, as expected. I inspected the UEFI boot menu with efibootmgr -v and checked that "ubuntu" was pointing to \EFI\UBUNTU\SHIMX64.EFI and "linux-mint" was pointing to \EFI\LINUX-MINT\SHIMX64.EFI:

$ sudo efibootmgr -v
BootCurrent: 0001
Timeout: 1 seconds
BootOrder: 0001,0003,0000,0005
Boot0000* Windows Boot Manager  HD(1,GPT,e430ad60-82d4-4bbf-93df-dc0690541c64,0x800,0x32000)/File(\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}...1................
Boot0001* ubuntu    HD(1,GPT,e430ad60-82d4-4bbf-93df-dc0690541c64,0x800,0x32000)/File(\EFI\UBUNTU\SHIMX64.EFI)
Boot0003* linux-mint    HD(1,GPT,e430ad60-82d4-4bbf-93df-dc0690541c64,0x800,0x32000)/File(\EFI\LINUX-MINT\SHIMX64.EFI)
Boot0005* Hard Drive    BBS(HD,,0x0)..GO..NO........o.H.G.S.T. .H.T.S.5.4.1.0.1.0.A.7.E.6.3.0....................A...........................>..Gd-.;.A..MQ..L. . . . . . .0.S.0.0.1.0.S.S.T.H.3.1.F.Y........BO..NO........o.H.F.S.1.2.8.G.3.9.M.N.C.-.2.3.0.0.A....................A...........................>..Gd-.;.A..MQ..L.I.E.9.5.0.N.7.5.1.2.7.0.9.0.5.I. .P. . ........BO

I selected "linux-mint" from UEFI boot menu, and it launched Ubuntu's GRUB. Please help me.

Best Answer

first boot to your Ubuntu live CD and:

  1. do whatever you want then
  2. install Ubuntu adn when you reach the partitioning area:
  3. make partition for Ubuntu root (/) and:
  4. partition for boot (/boot) MAKE SURE IT'S FORMATTED AS FAT32 and:
  5. set "install boot-loader to" (the partition you made for boot (/boot) and:
  6. finish the installation and boot to your UEFI settings. by pressing (F2) or (DEL) or (F12) -depends on you computer manufacturer and:
  7. add an entry for Ubuntu navigate to Ubuntu's boot partition then select grubx64.efi file.
  8. select that entry every time when you boot up to use ubuntu
  9. do the same for linux mint