Triple boot Grub menu os-prober problem

On my triple boot laptop (Windows11, Fedora37, AlmaLinux9.1)
default /etc/grub.d/30_os-prober produces Grub2 menu:

| Fedora Linux (6.0.16-300.fc37.x86_64) 37 (Workstation Edition)
| Fedora Linux (6.0.15-300.fc37.x86_64) 37 (Workstation Edition)
| Fedora Linux (6.0.15-200.fc36.x86_64) 36 (Workstation Edition)
| Fedora Linux (0-rescue-*****) 36 (Workstation Edition)
| Windows Boot Manager (on /dev/nvme0n1p1)
| AlmaLinux 9.1 (Lime Lynx) (on /dev/nvme0n1p7)
| AlmaLinux 9.1 (Lime Lynx) (on /dev/nvme0n1p7)
| UEFI Firmware Settings

This works quite well, but AlmaLinux entries are identical
and only by grepping for menuentries in Fedora’s grub.cfg
one can find which kernels these entries correspond to.
In fact, they appear to be in reverse order: the first one is
‘0-rescue’ and the last one is for the current AlmaLinux kernel.

I could try to somehow hack 30_os-prober script to produce
a customized version which would actually include kernel versions
for all subsequent AlmaLinux entries in correct order?

However, there has been some discussion that os-prober
should be deprecated ‘soon’ for various unrelated reasons.
Perhaps it would be wiser for me not to rely on os-prober at all
but to ‘manufacture’ a bunch of /etc/grub.d/40_custom scripts
to provide a user-friendlier Grub menu?

Any advice would be appreciated.

I ran into what I believe is the same problem. It seems that os-prober could find other Linux distros, but when you booted those distros it wasn’t honoring the kernel parameters I put in grub. The solution I found was to disable os-prober and instead have grub on my main distro that I booted to chain load the grub config file for the other distro. I did this in 40_custom as you said.

Here is my 40_custom as an example:

#!/usr/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry "Rocky Linux on hd1,gpt1"  {
            insmod part_gpt
            insmod xfs
            set root='hd1,gpt1'
            configfile /efi/rocky/grub.cfg
}
menuentry "Windows 10 on hd4,gpt1"  {
            insmod part_gpt
            insmod fat
            insmod chain
            chainloader (hd4,gpt1)/EFI/Microsoft/Boot/bootmgfw.efi
}

To figure out which hard drive is which, boot to your main grub and hit the key to go to a grub command prompt. In my case my UEFI BIOS was set to boot to my Fedora grub first. Then use the “ls” command to to figure out which drive is which. I believe the syntax was something like ls (hd4,gpt1)/. Then list sub-directories to find the right drive. In my case I had 3 OS’s installed on 3 separate drives. I believe the path was something like “ls (hd4,gpt1)/efi/EFI/fedora” where fedora would be which OS is installed on that drive so it might be alma, rocky, Microsoft, etc.

Hopefully Fedora Linux (and other distros) switch to sd-boot someday. It solves this problem by letting each distro add/delete their own line in the bootmenu simply by adding/deleting their own drop-in configuration snippet in a unique file under the /boot/loader/entries directory. The bootloader then just scans all the existing files and displays them one-by-one as boot entries. There is no need for a “grand” boot configuration process to parse them beforehand and try to merge them into a single config file.