Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Multiboot Fedora-Gentoo grub2-mkconfig howto?
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
_Nathanael_
n00b
n00b


Joined: 22 Jan 2019
Posts: 12

PostPosted: Tue Jan 22, 2019 2:14 pm    Post subject: Multiboot Fedora-Gentoo grub2-mkconfig howto? Reply with quote

Hello,

New user I try Gentoo from Fedora (Chroot). Maybe with a lots of mistakes (hard to follow handbook with all variants: xfs, lvm, EFI, nvidia,...) I finally get a system which boot and give me login prompt - I will see for x later -.

My problem concern grub.cfg which need to be manually tuned in order to boot.
Running from Fedora
Code:

root@ClusterUx:/home/Nat16 grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
root@ClusterUx:/home/Nat16 cat /boot/efi/EFI/fedora/grub.cfg
... - Select only Gentoo menu entry -
menuentry 'Gentoo/Linux (on /dev/mapper/cl_clusterux-gentooRoot)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-5d6073a4-0896-4eb0-a281-162b338c38cb' {
   insmod part_gpt
   insmod xfs
   set root='hd5,gpt3'
   if [ x$feature_platform_search_hint = xy ]; then
     search --no-floppy --fs-uuid --set=root --hint-bios=hd5,gpt3 --hint-efi=hd5,gpt3 --hint-baremetal=ahci5,gpt3  a44dcf1f-827a-425b-b597-61e3c79bf52b
   else
     search --no-floppy --fs-uuid --set=root a44dcf1f-827a-425b-b597-61e3c79bf52b
   fi
   linuxefi /vmlinuz-4.14.83-gentoo root=/dev/dm-6
   initrdefi /initramfs-genkernel-x86_64-4.14.83-gentoo
}
...

Running from Gentoo (chroot)
Code:

(chroot) ClusterUx / # grub-mkconfig -o /boot/efi/EFI/gentoo/grub.cfg
(chroot) ClusterUx / # cat /boot/efi/EFI/gentoo/grub.cfg
... - Select only Gentoo menu entry -
menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-5d6073a4-0896-4eb0-a281-162b338c38cb' {
   load_video
   if [ "x$grub_platform" = xefi ]; then
      set gfxpayload=keep
   fi
   insmod gzio
   insmod part_gpt
   insmod xfs
   set root='hd5,gpt3'
   if [ x$feature_platform_search_hint = xy ]; then
     search --no-floppy --fs-uuid --set=root --hint-bios=hd5,gpt3 --hint-efi=hd5,gpt3 --hint-baremetal=ahci5,gpt3  a44dcf1f-827a-425b-b597-61e3c79bf52b
   else
     search --no-floppy --fs-uuid --set=root a44dcf1f-827a-425b-b597-61e3c79bf52b
   fi
   echo   'Loading Linux 4.14.83-gentoo ...'
   linux   /vmlinuz-4.14.83-gentoo root=/dev/mapper/cl_clusterux-gentooRoot ro  dolvm rootfstype=xfs
   echo   'Loading initial ramdisk ...'
   initrd   /initramfs-genkernel-x86_64-4.14.83-gentoo
}
...

I have two entry in my bios where I can can choose between Fedora and Gentoo (not really usefull as I need to hit f2 during bios and navigate in menu). If my understanding is correct choosing Gentoo in bios means the grub installed with Gentoo will be used (and /boot/efi/EFI/gentoo/grub.cfg), choosing Fedora means using grub installed with Fedora -long time ago- will be used (and /boot/efi/EFI/fedora/grub.cfg).
This is the command I enter for installing Grub in Gentoo:
Code:
(chroot) ClusterUx / # grub-install -target=x86_64-efi --efi-directory=/boot/efi


Trying to copy Gento menu entry from Gentoo grub.cfg to Fendora grub.cfg did not work, but copy menu entry + change linux command to linuxefi and initrd to initrdefi did the trick. So main question is: Is there a way to create grub.cfg useable for Fedora and Gentoo from Fedora and the same from Gentoo?

Thanks in advance for your help!

Nathanaël.
Back to top
View user's profile Send private message
Syl20
l33t
l33t


Joined: 04 Aug 2005
Posts: 619
Location: France

PostPosted: Wed Jan 30, 2019 4:14 pm    Post subject: Reply with quote

If I understand well, you have a multiboot (Fedora + Gentoo) linux system on your machine. With EFI boot.

If you already need to choose which distro you want via EFI, then... perhaps you don't need grub at all. You already have a bootloader : the EFI one. Be sure to have an EFI compatible kernel, it has the .efi extension, and it is into /boot/efi/EFI/, and perhaps the EFI bootloader will directly see it.
That said, I don't know how Fedora installs its kernels into the EFI FS...

Considering the original request, I don't understand why you need two different grub configs. I suppose /boot/efi/EFI contains two grub instances (the Fedora one, and the Gentoo one), and that is one too many. I think you shoud choose which distro will keep its grub instance, and uninstall the other one. Then you could maintain a unique set of grub scripts (have a look on /etc/grub.d) to customize the grub-mkconfig output.
Back to top
View user's profile Send private message
Maitreya
Guru
Guru


Joined: 11 Jan 2006
Posts: 441

PostPosted: Wed Jan 30, 2019 6:05 pm    Post subject: Reply with quote

The last section of Syl20 is particularly good advice.

And he/she is right about the fact, you wont need grub if you can utilize EFI.

So concluding, choose which setup you want to use, BIOS or EFI and stick with it.
In case of BIOS, grub gets installed on the boot sector and its config and kernel in the boot partition. Let ONE OS take care of it.
In case of EFI, any OS can add a entry (but also replace) and is somewhat less sensitive to those grub config files conflicts.
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