Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to chainload two EFI partitions with grub2 ?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
LegionOfHell
Apprentice
Apprentice


Joined: 16 Mar 2019
Posts: 249
Location: Toronto, Canada

PostPosted: Sun Jun 21, 2020 10:11 pm    Post subject: How to chainload two EFI partitions with grub2 ? Reply with quote

I have gentoo installed on /dev/sda :

Code:
/dev/sda1 EFI/grub2/vfat
/dev/sda2 rootfs ext4



and void linux installed on /dev/nvme0n1 :

Code:
/dev/nvme0n1p1 EFI/grub2/vfat
/dev/nvme0n1p2 rootfs ext4


Both disks use gpt scheme!!

Should my menu entry for Void's grub in /etc/grub.d/40_custom look like this:

Code:
menuentry "Gentoo-grub" {
   insmod
   set root=(hd0,1)
   linux /boot/vmlinuz
   initrd /boot/initrd.img
}


or this:

Code:
menuentry "Gentoo-grub" {
     insmod part_gpt
     insmod chain
     chainloader (hd0,1)+1
}

Also, for the insmod line, Do I need to load any grub modules for this to work ? what modules do I need for this setup ?

And what if i don't decide to chainload and want Gentoo to load straight from Void's grub menu ?
Back to top
View user's profile Send private message
GDH-gentoo
Guru
Guru


Joined: 20 Jul 2019
Posts: 531
Location: South America

PostPosted: Mon Jun 22, 2020 2:36 am    Post subject: Reply with quote

You mean the UEFI firmware starts the GRUB installed by Void in /dev/nvme0n1p1? And you want to chain load a GRUB installed by Gentoo in /dev/sda1?

If you want to do that, which I don't find very useful except for testing, I believe it should be something like:
Code:
menuentry 'GRUB in Gentoo's disk' {
        insmod part_gpt # probably not needed
        insmod fat # probably not needed either
        insmod chain
        search --no-floppy --fs-uuid --set=root <the filesystem UUID of /dev/sda1>
        echo "Chain loading GRUB in Gentoo's disk..."
        chainloader /EFI/gentoo/grubx64.efi # Use the correct pathname!
}

If you want to start Gentoo directly from the GRUB installed in /dev/nvme0n1p1, you could probably copy the relevant menuentry { ... } and submenu { ... } blocks from Gentoo's grub.cfg to Void's /etc/grub.d/40_custom, assuming they contain a search --fs-uuid command specifying the filesystem UUID of /dev/sda2. Temporarily mount the partition that contains Gentoo's /boot/grub from Void to do that easily.

EDIT: Changing the argument of the echo command to double quotes, because it contains a single quote.


Last edited by GDH-gentoo on Mon Jun 22, 2020 1:02 pm; edited 1 time in total
Back to top
View user's profile Send private message
LegionOfHell
Apprentice
Apprentice


Joined: 16 Mar 2019
Posts: 249
Location: Toronto, Canada

PostPosted: Mon Jun 22, 2020 3:23 am    Post subject: Reply with quote

GDH-gentoo wrote:
You mean the UEFI firmware starts the GRUB installed by Void in /dev/nvme0n1p1? And you want to chain load a GRUB installed by Gentoo in /dev/sda1?

If you want to do that, which I don't find very useful except for testing, I believe it should be something like:
Code:
menuentry 'GRUB in Gentoo's disk' {
        insmod part_gpt # probably not needed
        insmod fat # probably not needed either
        insmod chain
        search --no-floppy --fs-uuid --set=root <the filesystem UUID of /dev/sda1>
        echo 'Chain loading GRUB in Gentoo's disk...'
        chainloader /EFI/gentoo/grubx64.efi # Use the correct pathname!
}

If you want to start Gentoo directly from the GRUB installed in /dev/nvme0n1p1, you could probably copy the relevant menuentry { ... } and submenu { ... } blocks from Gentoo's grub.cfg to Void's /etc/grub.d/40_custom, assuming they contain a search --fs-uuid command specifying the filesystem UUID of /dev/sda2. Temporarily mount the partition that contains Gentoo's /boot/grub from Void to do that easily.


thanks alot.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum