View previous topic :: View next topic |
Author |
Message |
_Nathanael_ n00b
Joined: 22 Jan 2019 Posts: 12
|
Posted: Thu Dec 02, 2021 2:02 pm Post subject: Grub setup |
|
|
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 |
|
|
Goverp Veteran
Joined: 07 Mar 2007 Posts: 1971
|
Posted: Thu Dec 02, 2021 3:14 pm Post subject: |
|
|
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 |
|
|
turtles Veteran
Joined: 31 Dec 2004 Posts: 1650
|
Posted: Thu Dec 02, 2021 3:24 pm Post subject: Re: Grub setup |
|
|
_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 |
|
|
_Nathanael_ n00b
Joined: 22 Jan 2019 Posts: 12
|
Posted: Thu Dec 02, 2021 4:15 pm Post subject: |
|
|
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 |
|
|
turtles Veteran
Joined: 31 Dec 2004 Posts: 1650
|
Posted: Thu Dec 02, 2021 5:36 pm Post subject: |
|
|
_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 |
|
|
_Nathanael_ n00b
Joined: 22 Jan 2019 Posts: 12
|
Posted: Fri Dec 03, 2021 9:06 am Post subject: |
|
|
@ turtles: exactly |
|
Back to top |
|
|
turtles Veteran
Joined: 31 Dec 2004 Posts: 1650
|
Posted: Fri Dec 03, 2021 4:52 pm Post subject: Re: Grub setup |
|
|
_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 |
|
|
pietinger Moderator
Joined: 17 Oct 2006 Posts: 3996 Location: Bavaria
|
Posted: Sat Dec 04, 2021 1:21 am Post subject: |
|
|
_Nathanael_ wrote: | @ turtles: exactly |
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 |
|
|
_Nathanael_ n00b
Joined: 22 Jan 2019 Posts: 12
|
|
Back to top |
|
|
|