GRUB detecting but not adding item to boot menu

Greetings,

I’d appreciate any experience anyone has similar to this issue and/or suggestions about which files to look into to track down the issue.

I have Manjaro installed with grub properly set up with windows detected and added to the boot menu.

I just installed Gentoo on another drive with the following layout
sda1: swap
sda2: gentoo-btrfs
- @ : Gentoo root partition
- @home : Gentoo home partition

I went through the process of installing the Gentoo base system, configuring and comping the kernel, and and setting up the system to be ready to boot into. I did all this by chrooting into the btrfs volume from Mnajaro. This is why I did not include a /boot/efi (efi system partition) in the Gentoo installation process, as would typically be required. I want to simply use the Mnajaro GRUB to launch into any of my, no 3, OS’s.

When I run update-grub on Manjaro,

Generating grub configuration file ...
Found theme: /usr/share/grub/themes/manjaro/theme.txt
Found linux image: /boot/vmlinuz-5.10-x86_64
Found initrd image: /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs-5.10-x86_64.img
Found initrd fallback image: /boot/initramfs-5.10-x86_64-fallback.img
Found linux image: /boot/vmlinuz-5.4-x86_64
Found initrd image: /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs-5.4-x86_64.img
Found initrd fallback image: /boot/initramfs-5.4-x86_64-fallback.img
Warning: os-prober will be executed to detect other bootable partitions.
It's output will be used to detect bootable binaries on them and create new boot entries.
Found Manjaro Linux on /dev/nvme0n1p3
Found Windows Boot Manager on /dev/nvme1n1p1@/efi/Microsoft/Boot/bootmgfw.efi
Found Gentoo/Linux on /dev/sda2
Adding boot menu entry for UEFI Firmware Settings ...
Detecting snapshots ...
Info: Separate boot partition not detected
Found snapshot: 2021-05-16 18:00:02 | timeshift-btrfs/snapshots/2021-05-16_18-00-02/@
===Additional output surpressed===
done

The output says it detected Gentoo on /dev/sda2, but when I reboot, it does not show this as a menu entry.
Contents of Gentoo’s /boot:

config-5.10.27-gentoo
System.map-5.10.27-gentoo
vmlinuz-5.10.27-gentoo

Thank you in advance for any ideas for tracking this down!

Grub lives on the MBR, or in the case of uEFI, the ESP partition. This is he vfat partition that you made to store the uEFI firmware/boot bins. When you update grub, you need o specify where the grub configuration lives. What is happening more than likely is that grub is writing to SDA2 but you ESP lives on your NVMe device.

See below for setup on uEFI systems.
https://wiki.archlinux.org/title/GRUB#UEFI_systems

In case anyone has a similar issue, heres a solution.

Based on a reply on the Gentoo forums I solved my issue by manually adding a menu entry by editing /boot/grub/custom.cfg. This file does Not get overwritten, like /boot/grub/grub.cfg whenever update-grub is executed.

Here’s my /boot/grub/custom.cfg

menuentry 'Gentoo' --class gnu-linux --class gnu --class os {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod btrfs
	search --no-floppy --fs-uuid --set=root 9df33159-a6d8-4cef-8cfa-6acc36ef6e48
	linux	/@/boot/vmlinuz-5.14.6-zen1 root=PARTUUID=4640ddda-08ce-44b3-bbdf-4c7f3a7a0d00 ro rootflags=subvol=@
#  quiet udev.log_priority=3
#	initrd	/@/boot/intel-ucode.img /@/boot/amd-ucode.img /@/boot/initramfs-5.10-x86_64.img
}

Replace the UUID after --set=root with the UUID of your root partition (or possibly boot partition if that is seperate).

I suppose I could automate this by making a script to do:

  1. make install for new kernel in Gentoo
  2. Find the most recent kernel in /boot with, eg, ls -rt /boot/vmlinuz* | tail -1
  3. Use sed to edit a custom.cfg.template file with the latest vmlinuz kernel file name

Another idea is to add another menu entry for the .old kernel for easier recovery in case of bad kernel config.

That is basically how it is done on Debian. The Debhelper scripts do it automagically.