What I wanted to do (which was so easy with grub-legacy) was to chainload (instead of directly loading) other distributions from the one installed on my mbr.
First of all with Uefi/gpt machines you need a separate boot partition (fat32). A working uefi installer should supply this automatically (if you use an automatic install like 'Alongside Windows or 'Whole Disk' but you will need to do it manually if you use manual partitioning). I will assume you have this already, if you don't the rest of the tutorial will be a waste of time for you.
On my Ubuntu install (at the time I installed Mint its Uefi capabilities were not functioning). It provided me with a /boot partition on /dev/sda1 with a mount point of /boot/efi - this is important as you will see later. I had problems with this, but that is another story, once I had fixed them I installed both Manjaro and Mint on separate partitions, installing grub to the partition in both cases. As mentioned Mint did not install an efi boot loader, but Manjaro did and my goal was to chainload Manjaro from the Ubuntu grub. This is how it goes.
First look in the /boot/efi/ folder. You will see a /EFI folder and inside that you should see a folder relevant to the distro you are trying to chainload, in my case it was called /manjaro_grub. Inside this is the file you are looking for and in my case it was called grubx64.efi. So you have now found the file which will actually carry out the chainload for you. Make a note its address.
Now run:
Code: Select all
sudo blkid -c /dev/null
Code: Select all
sudo blkid -c /dev/null
/dev/sda1: LABEL="BOOT" UUID="DDE9-FCDA" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="aa549ca7-3738-4dc6-a3c9-b1ab69525f24"
Code: Select all
menuentry Manjaro {
search --fs-uuid --no-floppy --set=root DDE9-FCDA
chainloader (${root})/EFI/manjaro_grub/grubx64.efi
}
So now you have got an entry what do you do with it?
The best place for it is in /etc/grub.d/40_custom, just paste it in there and it will appear in the grub menu when you update grub. More importantly it won't be overwritten by later grub updates.
If you have only one other distro then you could now disable /etc/grub.d/30_os-prober with:
Code: Select all
sudo chmod -x /etc/grub.d/30_os-prober
BTW the same technique should work for a Windows chainload although the folder address will be different it will have /Microsoft in it somewhere.
I told you it was fun
PART 2 How to install an efi based boot loader when Mint has wrongly installed a non-efi version.
This was the situation I found myself in with regard to Mint after I initially installed it. At the time I installed Mint its efi implementation was broken and it did not install an efi based grub, thus I was unable to chainload it. This is how I fixed it. You will need a second working linux distro already installed, I haven't tried this from a live cd, the procedure would be similar but not identical so I don't feel confident in writing it down. The reason Mint's installation was not efi was that it installed the wrong version of grub. It installed grub-pc and what it should have installed was grub-efi-amd64. So the first thing to do is to install that package. This automatically removes grub-pc. At this time I suppose it would have been quite possible to run
Code: Select all
sudo grub-install /dev/sda
Boot into another distro. Make sure that the partition on which Mint is installed is mounted. My Mint partition is already mounted by fstab so I didn't have to do that, if that is not the case, (and assuming Mint is on /dev/sda5), do this:
Code: Select all
sudo mount /dev/sda5 /mnt
Code: Select all
sudo grub-install --root-directory=/mnt /dev/sda5
In your Mint installation you will now find a file called /boot/grub/grub.efi - copy this file. Now, in the distribution you are running from, create a new folder called 'mint' in the location /boot/efi/EFI. Open folder /boot/efi/EFI/mint and drop the grub.efi file inside this folder. You can now create your menuentry in /etc/grub.d/40_custom as above
Code: Select all
menuentry Mint {
search --fs-uuid --no-floppy --set=root DDE9-FCDA
chainloader (${root})/EFI/mint/grub.efi
}
Code: Select all
sudo update-grub
Phew!!