Jump to content
EnriqueV

Avoiding EFI Multiboot Problems With GRUB2 and Linux/MacOS/Windows

Recommended Posts

Avoiding EFI Multiboot Problems With GRUB2 and Linux/MacOS/Windows

Note that not every combination of installed and otherwise boot capable devices (spinning rust, SSD, NVMe) will be selectively recognized by the BIOS as bootable.  BIOS and/or hardware and/or firmware limitations may determine which devices can be used together.  Operating system contraints can also be a factor.  

So do the research first for hardware and software compatibility, and make sure that the BIOS and firmwares are up to date.

Create a FAT32 ESP (suggest 400 MB) on your intended boot device, and verify that the BIOS is configured to boot from that device.  

For those who have multiple SSD devices, each with an installed operating system, including at least one drive with linux installed, and complaining that the linux bootloader, GRUB2, overwrites the ESP, the following information may be of help in resolving your issues.

Note that if you are not using GRUB2 as your main bootloader, it does not need to be installed on the ESP.  This is a choice for you to make when you are installing linux.   

If, however, you wish to use GRUB2 as your main bootloader, you can avoid multiboot problems by installing both linux and GRUB2 to the same partition.  

Once installed, open a linux terminal session and create an efi directory (if one does not already exist):

sudo mkdir /boot/efi

next, mount your ESP to the efi directory:

sudo mount /dev/sda1 /boot/efi (verify your FAT32 ESP partition number with "sudo fdisk -l")

next, install GRUB2 boot parameters to the ESP:

sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Linux --recheck --no-floppy --debug

note that the parameter --bootloader-id=Linux will produce an ESP entry named Linux.  You can change the name to suit your taste.

There should be an ESP linux file tree entry that includes grub.cfg.

Within grub.cfg, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx is the partition UUID of the linux installation, and in this example, hd0 and gpt2 are the GRUB2 hard drive number and partition number, respectively, pertaining to the linux installation:

search.fs_uuid xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx root hd0,gpt2
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

if no installation errors were reported, you can now unmount the ESP: sudo umount -l /dev/sda1

Once you have installed GRUB2 parameters to the ESP using this method, designating GRUB2 as your main bootloader, the GRUB2 boot menu will be located in the linux partition file tree as follows:  

boot/grub/grub.cfg

Note that now, when updating the GRUB2 boot menu for your linux installation (for example, by installing a new kernel or manually updating with update-grub), the updated boot menu is written to the linux partition, and not the ESP.  

This means that even if you are not using GRUB2 as your main boot loader, linux updates should not overwrite the ESP.  

Alternatively, if you are using Open Core as your main boot loader you can create a custom boot menu entry to chainload the GRUB2 bootloader:

 <key>Entries</key>
            <array>
                <dict>
                    <key>Arguments</key>
                    <string></string>
                    <key>Auxiliary</key>
                    <false/>
                    <key>Comment</key>
                    <string></string>
                    <key>Enabled</key>
                    <true/>
                    <key>Name</key>
                    <string>GRUB2</string>
                    <key>Path</key>
                    <string>the PciRoot data for your configuration goes here</string>
                    <key>TextMode</key>
                    <false/>
                </dict>
               </array>

If, however, you do decide to use GRUB2 as your main boot loader, you can add custom entries to boot linux, macOS, and windows following the instructions here:

https://www.olarila.com/topic/15309-updated-big-surmonterey-tipsobservations/

 

Edited by EnriqueV
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.





×
  • Create New...