Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Grub setup
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: Thu Dec 02, 2021 2:02 pm    Post subject: Grub setup Reply with quote

Hi,

I have a complex disk(*) and grub structure which is shipped from previous installation: Windows, dual-boot,... Today I m only using Gentoo and I would like to clean/remove unneeded partitions.

Actually in order to add a new Gentoo kernel to grub I need to run:
Code:
grub-mkconfig -o /boot/efi/EFI/gentoo/grub.cfg

Then manually edit (notice "fedora"):
Code:
nano -w /boot/efi/EFI/fedora/grub.cfg

Copy the menu from generated file + add various option as I m using LVM + RAID.

From my bios option I could choose between Fedora and Gentoo and the only working choice is Fedora. Selecting Gentoo give me access to a grub prompt without any menu.

My goal is to remove unneeded partition and simplify the add of new kernel in grub menu.
Hope someone could help me with this topic !

(*) There is 3 partition used by Grub here is the truncated result of lsblk -f :
Code:

NAME                FSTYPE      LABEL UUID                                   FSAVAIL FSUSE% MOUNTPOINT
 ...................
sdf                                                                                         
├─sdf1              vfat              C5C3-C9A5                                  91M     9% /boot/efi
├─sdf
 ...................
├─sdf3              xfs               a44dcf1f-827a-425b-b597-61e3c79bf52b     99.8M    75% /boot
 ...................
├─sdf5              xfs               466495ee-0a04-4997-8fa7-157a04db8781    192.5M    61% /bootFedora



And here is the result of tree inside /sdf1, my EFI System Partition (ESP):
Code:

efi
|-- 21ec0d474dc24067b091f644d23b1c9a
|   |-- 4.11.11-300.fc26.x86_64
|   |-- ....
|   `-- 4.17.19-100.fc27.x86_64
|-- EFI
|   |-- BOOT
|   |   |-- BOOTX64.EFI
|   |   |-- fallback.efi
|   |   `-- fbx64.efi
|   |-- fedora
|   |   |-- BOOT.CSV
|   |   |-- BOOTX64.CSV
|   |   |-- cp_grub.cfg
|   |   |-- fonts
|   |   |-- grub.cfg
|   |   |-- grubenv
|   |   |-- grubx64.efi
|   |   |-- loader
|   |   |   `-- entries
|   |   |-- mmx64.efi
|   |   |-- MokManager.efi
|   |   |-- shim.efi
|   |   |-- shimx64.efi
|   |   `-- shimx64-fedora.efi
|   `-- gentoo
|       |-- grub.cfg
|       `-- grubx64.efi
|-- mach_kernel
`-- System
   `-- Library
       `-- CoreServices
           `-- SystemVersion.plist


Inside /sdf3:
Code:

|-- config-4.14.83-gentoo
|-- config-5.10.76-gentoo-r1
|-- efi -> mount point of sdf5
|-- grub
|   |-- fonts
|   |   `-- unicode.pf2
|   |-- grubenv
|   |-- locale
|   |   `-- fr.mo
|   |-- themes
|   |   `-- starfield
|   |       |-- blob_w.png
|   |       `-- ....
|   `-- x86_64-efi
|       |-- acpi.mod
|       |-- ....
|-- initramfs-4.19.97-gentoo.img
|-- initramfs-5.10.76-gentoo-r1.img
|-- System.map-4.14.83-gentoo
|-- System.map-5.10.76-gentoo-r1.old
|-- vmlinuz-4.14.83-gentoo
|-- vmlinuz-5.10.76-gentoo-r1.old


Inside /sdf5:
Code:

|-- config-4.17.19-100.fc27.x86_64
|-- config-4.19.8-200.fc28.x86_64
|-- e0fe8eafa71f44d5a3f11ae6386ee37c
|   `-- 4.11.8-300.fc26.x86_64
|-- efi
|-- elf-memtest86+-5.01
|-- extlinux
|   |-- .....
|-- grub2
|   |-- grub.cfg
|   |-- grubenv -> ../efi/EFI/fedora/grubenv
|   `-- themes
|       `-- system
|           |-- background.png
|           `-- fireworks.png
|-- initramfs-0-rescue-21ec0d474dc24067b091f644d23b1c9a.img
|-- initramfs-4.17.19-100.fc27.x86_64.img
|-- initramfs-4.19.8-200.fc28.x86_64.img
|-- loader
|   `-- entries
|       `-- 21ec0d474dc24067b091f644d23b1c9a-0-rescue.conf
|-- memtest86+-5.01
|-- System.map-4.17.19-100.fc27.x86_64
|-- System.map-4.19.8-200.fc28.x86_64
|-- vmlinuz-0-rescue-21ec0d474dc24067b091f644d23b1c9a
|-- vmlinuz-4.17.19-100.fc27.x86_64
`-- vmlinuz-4.19.8-200.fc28.x86_64
Back to top
View user's profile Send private message
Goverp
Veteran
Veteran


Joined: 07 Mar 2007
Posts: 1971

PostPosted: Thu Dec 02, 2021 3:14 pm    Post subject: Reply with quote

Nathanael, One way is to learn the new grub command language and configure your own menu, rather than fight with grub-mkconfig. Look at "info grub" and follow the menu hierarchy to reach the various pages on grub commands. You might find my wiki page on a reusable GRUB menu useful. Thereagain, it might be one (or more) steps too far.
_________________
Greybeard
Back to top
View user's profile Send private message
turtles
Veteran
Veteran


Joined: 31 Dec 2004
Posts: 1650

PostPosted: Thu Dec 02, 2021 3:24 pm    Post subject: Re: Grub setup Reply with quote

_Nathanael_ wrote:
Hi,
From my bios option I could choose between Fedora and Gentoo and the only working choice is Fedora. Selecting Gentoo give me access to a grub prompt without any menu.



Nathanael, you have grub installed at least two times, once for Gentoo and once for Fedora.
One way you could accomplish this is to tell Gentoo to just use the grub install on /boot/efi/EFI/fedora
and just point it to:
/boot/efi/EFI/fedora/grub.cfg

I am not super up on modern EFI / UEFI / GPT systems, so this may be bad advice.
but I have run various linux distros for years the old legacy way , with just one grub.
It doesn't really matter which grub you use.
But all the distros should point to the same one and be aware of the other distros.

Check out these links
https://wiki.gentoo.org/wiki/GRUB2#UEFI_with_GPT
https://wiki.archlinux.org/title/GRUB#UEFI_systems
_________________
Donate to Gentoo
Back to top
View user's profile Send private message
_Nathanael_
n00b
n00b


Joined: 22 Jan 2019
Posts: 12

PostPosted: Thu Dec 02, 2021 4:15 pm    Post subject: Reply with quote

turtles

When you say "tell Gentoo to just use the grub install" you mean using:
Code:
grub-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

In place of:
Code:
grub-mkconfig -o /boot/efi/EFI/gentoo/grub.cfg

I would like to avoid that as the grub.cfg created is invalid and this grub is maintained by Fedora which is removed from my computer.

The legacy way is quite appealing for me... I just need to find a good way to switch.

Goverp

If my understanding is correct your proposal is a grub.cfg which behave like a script in order to find available kernels and propose related menu. This is really good for my system but I first need to switch from UEFI to legacy.
Back to top
View user's profile Send private message
turtles
Veteran
Veteran


Joined: 31 Dec 2004
Posts: 1650

PostPosted: Thu Dec 02, 2021 5:36 pm    Post subject: Reply with quote

_Nathanael_ wrote:
turtles
this grub is maintained by Fedora which is removed from my computer.

Oh ok gotit, so your not trying to dual boot fedora or windows or anyhting anymore?
Just gentoo?
_________________
Donate to Gentoo
Back to top
View user's profile Send private message
_Nathanael_
n00b
n00b


Joined: 22 Jan 2019
Posts: 12

PostPosted: Fri Dec 03, 2021 9:06 am    Post subject: Reply with quote

@ turtles: exactly :D
Back to top
View user's profile Send private message
turtles
Veteran
Veteran


Joined: 31 Dec 2004
Posts: 1650

PostPosted: Fri Dec 03, 2021 4:52 pm    Post subject: Re: Grub setup Reply with quote

_Nathanael_ wrote:
Hi,

I would like to clean/remove unneeded partitions.
../..
Selecting Gentoo give me access to a grub prompt without any menu.



I think we should fix the broken Gentoo grub first.
When you run grub-mkconfig it uses the files in /etc/grub.d/ to generate a config
I always tell grub to write a new config to a temp file then diff it with my existing grub to check for mistakes.

Code:
grub-mkconfig -o /tmp/grub.cfg

perhaps post your current grub.cfg on pastebin or somewhere we can look at it?
Goverp's suggestion looks quite interesting.
_________________
Donate to Gentoo
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 3996
Location: Bavaria

PostPosted: Sat Dec 04, 2021 1:21 am    Post subject: Reply with quote

_Nathanael_ wrote:
@ turtles: exactly :D

In that case I recommend to use UEFI for booting your gentoo kernel directly. You only have to make a stub kernel and dont need any bootmanager.
See more here:
https://wiki.gentoo.org/wiki/Efibootmgr
https://wiki.gentoo.org/wiki/EFI_Stub (I recommend not using a version on your stub kernels name; instead give your kernela name without a version, so you must not set a new kernel again with efibootmgr in your UEFI boot-table).
Back to top
View user's profile Send private message
_Nathanael_
n00b
n00b


Joined: 22 Jan 2019
Posts: 12

PostPosted: Mon Dec 06, 2021 8:35 am    Post subject: Reply with quote

I totally agree with this proposal!

Here you will find my grub.cfg https://pastebin.com/kg0eNiSz
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