Grub os-prober: /dev and not UUID?

I have a multiboot setup using Grub managed by Manjaro. Three Linux versions are on two nvme drives. The ‘bios’ of my pc gives out nvme0 and nvme1 -names in a unpredictable way. That should not be a problem when using the UUID to identify boot partitions.

With ‘sudo update-grub’ /boot/grub/grub.cfg is updated. I have enabled the use of os-prober. This results in something strange: for linux Mint the UUID is used, for Arch /dev/nvme0n1p3. Sometimes this works, sometimes not.

So my question is Why this /dev/nvme0n1p3 and not the UUID for Arch?

The generated grub.cfg: see line 167

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="${saved_entry}"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

set menu_color_normal=light-gray/black
set menu_color_highlight=green/black

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root adcda0b2-d3e3-4d08-a9bd-802191d2faf3
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=1920x1440x32
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root adcda0b2-d3e3-4d08-a9bd-802191d2faf3
insmod gfxmenu
loadfont ($root)/usr/share/grub/themes/manjaro/dejavu_sans_12.pf2
loadfont ($root)/usr/share/grub/themes/manjaro/dejavu_sans_14.pf2
loadfont ($root)/usr/share/grub/themes/manjaro/dejavu_sans_16.pf2
loadfont ($root)/usr/share/grub/themes/manjaro/dejavu_sans_24.pf2
loadfont ($root)/usr/share/grub/themes/manjaro/dejavu_sans_48.pf2
loadfont ($root)/usr/share/grub/themes/manjaro/dejavu_sans_bold_16.pf2
loadfont ($root)/usr/share/grub/themes/manjaro/dejavu_sans_mono_12.pf2
loadfont ($root)/usr/share/grub/themes/manjaro/terminus-12.pf2
loadfont ($root)/usr/share/grub/themes/manjaro/terminus-14.pf2
loadfont ($root)/usr/share/grub/themes/manjaro/terminus-16.pf2
loadfont ($root)/usr/share/grub/themes/manjaro/terminus-18.pf2
loadfont ($root)/usr/share/grub/themes/manjaro/terminus-b12.pf2
loadfont ($root)/usr/share/grub/themes/manjaro/terminus-b14.pf2
loadfont ($root)/usr/share/grub/themes/manjaro/terminus-b16.pf2
loadfont ($root)/usr/share/grub/themes/manjaro/terminus-b18.pf2
insmod png
set theme=($root)/usr/share/grub/themes/manjaro/theme.txt
export theme
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=hidden
  set timeout=9
# Fallback hidden-timeout code in case the timeout_style feature is
# unavailable.
elif sleep --interruptible 9 ; then
  set timeout=0
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Manjaro Linux' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-adcda0b2-d3e3-4d08-a9bd-802191d2faf3' {
	savedefault
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod ext2
	search --no-floppy --fs-uuid --set=root adcda0b2-d3e3-4d08-a9bd-802191d2faf3
	linux	/boot/vmlinuz-6.6-x86_64 root=UUID=adcda0b2-d3e3-4d08-a9bd-802191d2faf3 ro  nowatchdog quiet apparmor=1 security=apparmor udev.log_priority=3
	initrd	/boot/intel-ucode.img /boot/initramfs-6.6-x86_64.img
}
submenu 'Advanced options for Manjaro Linux' $menuentry_id_option 'gnulinux-advanced-adcda0b2-d3e3-4d08-a9bd-802191d2faf3' {
	menuentry 'Manjaro Linux (Kernel: 6.6.44-1-MANJARO x64)' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.6.44-1-MANJARO x64-advanced-adcda0b2-d3e3-4d08-a9bd-802191d2faf3' {
	savedefault
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod ext2
		search --no-floppy --fs-uuid --set=root adcda0b2-d3e3-4d08-a9bd-802191d2faf3
		linux	/boot/vmlinuz-6.6-x86_64 root=UUID=adcda0b2-d3e3-4d08-a9bd-802191d2faf3 ro  nowatchdog quiet apparmor=1 security=apparmor udev.log_priority=3
		initrd	/boot/intel-ucode.img /boot/initramfs-6.6-x86_64.img
	}
	menuentry 'Manjaro Linux (Kernel: 6.6.44-1-MANJARO x64 - fallback initramfs)' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.6.44-1-MANJARO x64-fallback-adcda0b2-d3e3-4d08-a9bd-802191d2faf3' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod ext2
		search --no-floppy --fs-uuid --set=root adcda0b2-d3e3-4d08-a9bd-802191d2faf3
		linux	/boot/vmlinuz-6.6-x86_64 root=UUID=adcda0b2-d3e3-4d08-a9bd-802191d2faf3 ro  nowatchdog quiet apparmor=1 security=apparmor udev.log_priority=3
		initrd	/boot/initramfs-6.6-x86_64-fallback.img
	}
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/25_bli ###
if [ "$grub_platform" = "efi" ]; then
  insmod bli
fi
### END /etc/grub.d/25_bli ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Arch Linux (rolling) (on /dev/nvme0n1p3)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-f8a20f45-b2f8-4887-8a38-cf0442ad21ac' {
	savedefault
	insmod part_gpt
	insmod ext2
	search --no-floppy --fs-uuid --set=root f8a20f45-b2f8-4887-8a38-cf0442ad21ac
	linux /boot/vmlinuz-linux-lts root=/dev/nvme0n1p3
	initrd /boot/initramfs-linux-lts.img
}
submenu 'Advanced options for Arch Linux (rolling) (on /dev/nvme0n1p3)' $menuentry_id_option 'osprober-gnulinux-advanced-f8a20f45-b2f8-4887-8a38-cf0442ad21ac' {
	menuentry 'Arch Linux (rolling) (on /dev/nvme0n1p3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-linux-lts--f8a20f45-b2f8-4887-8a38-cf0442ad21ac' {
		savedefault
		insmod part_gpt
		insmod ext2
		search --no-floppy --fs-uuid --set=root f8a20f45-b2f8-4887-8a38-cf0442ad21ac
		linux /boot/vmlinuz-linux-lts root=/dev/nvme0n1p3
		initrd /boot/initramfs-linux-lts.img
	}
}

menuentry 'Linux Mint 22 Wilma (22) (on /dev/nvme0n1p5)' --class linuxmint --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-c22c6ba2-5463-40a1-b24f-6aab8e7ae8d7' {
	savedefault
	insmod part_gpt
	insmod ext2
	search --no-floppy --fs-uuid --set=root c22c6ba2-5463-40a1-b24f-6aab8e7ae8d7
	linux /boot/vmlinuz-6.8.0-39-generic root=UUID=c22c6ba2-5463-40a1-b24f-6aab8e7ae8d7 ro quiet splash
	initrd /boot/initrd.img-6.8.0-39-generic
}
submenu 'Advanced options for Linux Mint 22 Wilma (22) (on /dev/nvme0n1p5)' $menuentry_id_option 'osprober-gnulinux-advanced-c22c6ba2-5463-40a1-b24f-6aab8e7ae8d7' {
	menuentry 'Linux Mint 22 Cinnamon (on /dev/nvme0n1p5)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-6.8.0-39-generic--c22c6ba2-5463-40a1-b24f-6aab8e7ae8d7' {
		savedefault
		insmod part_gpt
		insmod ext2
		search --no-floppy --fs-uuid --set=root c22c6ba2-5463-40a1-b24f-6aab8e7ae8d7
		linux /boot/vmlinuz-6.8.0-39-generic root=UUID=c22c6ba2-5463-40a1-b24f-6aab8e7ae8d7 ro quiet splash
		initrd /boot/initrd.img-6.8.0-39-generic
	}
	menuentry 'Linux Mint 22 Cinnamon, with Linux 6.8.0-39-generic (on /dev/nvme0n1p5)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-6.8.0-39-generic--c22c6ba2-5463-40a1-b24f-6aab8e7ae8d7' {
		savedefault
		insmod part_gpt
		insmod ext2
		search --no-floppy --fs-uuid --set=root c22c6ba2-5463-40a1-b24f-6aab8e7ae8d7
		linux /boot/vmlinuz-6.8.0-39-generic root=UUID=c22c6ba2-5463-40a1-b24f-6aab8e7ae8d7 ro quiet splash
		initrd /boot/initrd.img-6.8.0-39-generic
	}
	menuentry 'Linux Mint 22 Cinnamon, with Linux 6.8.0-39-generic (recovery mode) (on /dev/nvme0n1p5)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-6.8.0-39-generic--c22c6ba2-5463-40a1-b24f-6aab8e7ae8d7' {
		savedefault
		insmod part_gpt
		insmod ext2
		search --no-floppy --fs-uuid --set=root c22c6ba2-5463-40a1-b24f-6aab8e7ae8d7
		linux /boot/vmlinuz-6.8.0-39-generic root=UUID=c22c6ba2-5463-40a1-b24f-6aab8e7ae8d7 ro recovery nomodeset dis_ucode_ldr
		initrd /boot/initrd.img-6.8.0-39-generic
	}
}

set timeout_style=menu
if [ "${timeout}" = 0 ]; then
  set timeout=10
fi
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
if [ "$grub_platform" = "efi" ]; then
	menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
		fwsetup
		}
fi
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/35_fwupd ###
### END /etc/grub.d/35_fwupd ###

### BEGIN /etc/grub.d/40_custom ###
# 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 'Arch Linux fixed' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-f8a20f45-b2f8-4887-8a38-cf0442ad21ac' {
	savedefault
	insmod part_gpt
	insmod ext2
	search --no-floppy --fs-uuid --set=root f8a20f45-b2f8-4887-8a38-cf0442ad21ac
	linux /boot/vmlinuz-linux-lts root=UUID=f8a20f45-b2f8-4887-8a38-cf0442ad21ac rw nowatchdog quiet splash
	initrd /boot/initramfs-linux-lts.img
}
menuentry "OpenCore" {
	insmod fat
	insmod chain
	search --no-floppy --set=root --fs-uuid A7F1-FC7C
	chainloader /EFI/BOOT/BOOTx64.efi
}
menuentry 'FoxClone' --class linuxmint --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-12aeee6a-3d72-4b97-9f1a-ff94be2c75f7' {
	insmod part_msdos
	insmod ext2
	set root='hd0,msdos5'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  12aeee6a-3d72-4b97-9f1a-ff94be2c75f7
	else
	  search --no-floppy --fs-uuid --set=root 12aeee6a-3d72-4b97-9f1a-ff94be2c75f7
	fi
	linux /boot/vmlinuz-5.15.0-53-generic root=UUID=12aeee6a-3d72-4b97-9f1a-ff94be2c75f7 ro quiet splash
	initrd /boot/initrd.img-5.15.0-53-generic
}
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg
fi
### END /etc/grub.d/41_custom ###

### BEGIN /etc/grub.d/60_memtest86+ ###
if [ "${grub_platform}" == "pc" ]; then
    menuentry "Memory Tester (memtest86+)" --class memtest86 --class gnu --class tool {
        search --fs-uuid --no-floppy --set=root  adcda0b2-d3e3-4d08-a9bd-802191d2faf3
        linux16 /boot/memtest86+/memtest.bin 
    }
fi
### END /etc/grub.d/60_memtest86+ ###

Thanks!

Rather than attempt to understand and answer your question, I’ll offer this as an alternative to manage booting of all three available OS instances:


The rEFInd UEFI Bootloader

Adding the rEFInd Bootloader to the mix does no harm to existing bootloaders. Each OS is effectively chainloaded from rEFInd and boot as normal. rEFInd assumes the role of the prime bootloader for your system.

If you enjoy customising the boot experience (themes) and like to have additional boot options (redundancy), then rEFInd is a worthwhile consideration.

rEFInd can bypass GRUB 2 and boot the kernel stub directly, which is handy in the event that GRUB 2 fails to boot - you are still able to then boot into Manjaro and fix the issue in relative comfort.

rEFInd comes with ‘sane defaults’ - everything typically works (OOTB).

Installing rEFInd with this Manjaro/Windows multiboot configuration will give the following boot choices by default (the naming may differ):

  • Boot Microsoft EFI boot from ESP
    This option boots Windows via the Microsoft bootloader (Windows disk).
  • Boot EFI\Manjaro\grubx64.efi from ESP
    This option boots Manjaro via GRUB 2.
  • Boot boot\vmlinuz-6.6-x86_64 from MANJARO
    This option boots Manjaro via the Kernel stub, bypassing GRUB 2.
Options display as icons; activate with keyboard/mouse

refind_1024

See also: rEFInd : Methods of Booting Linux.


The simplest way to see rEFInd in action is to install it;

Install rEFInd from the official Manjaro repo

sudo pacman -S refind

Use rEFInd’s own tool to setup the ESP directory

sudo refind-install
The ESP directory layout will be similar to:
$ESP
└─ EFI
    ├─ boot
    ├─ manjaro
    └─ refind
  • Reboot to begin using rEFInd.

See also: The rEFInd Boot Manager: Methods of Booting Linux.


Important:- I have found rEFInd to be generally trouble-free – however, the assumption is that each OS is installed to it’s own separate disk – and not on partitions of the same disk.


It’s not the BIOS/UEFI…it’s systemd. The drives are enumerated in the order they’re found, this is not always consistent as it’s done in parallel, however it often settles down into a consistent pattern.

What’s the contents of Arch’s /etc/fstab?

I would lean more towards Arch’s /etc/default/grub

2 Likes

Thanks!

# <file system> <mount point> <type> <options> <dump> <pass>

UUID=f8a20f45-b2f8-4887-8a38-cf0442ad21ac	/	ext4	rw,relatime	0	1
UUID=ddb97e0c-1737-48cd-b6bc-2bbb94e366da	/mnt/home_manj	ext4	defaults,noatime	1	2
UUID=73ee0977-b9bd-4123-885f-06b9f0ec03d0	/mnt/datadisk	ext4	defaults,noatime	1	2

So it’s not that then.

Have you checked /etc/default/grub, as @Takakage suggested?

Sometimes it’s easier easier to turn off os-prober and copy correct entries into /etc/grub.d/40_custom.

@Takakage There is no Arch /etc/default/grub, since I installed Arch without grub.

@Wollie Yes, I have done that as you can see in the grub.cfg of my opening post. I could do without os-prober for Arch but not for Mint since that OS includes the (updated) kernel version in the boot file names.
I have tried GRUB_OS_PROBER_SKIP_LIST= uuid of arch, but that does not seem to work.

If it was manjaro, i would have said to check that #GRUB_DISABLE_LINUX_UUID=true there is commented.
But since it is arch and grub menu is not regenerated on kernel change, you can just edit the cfg file.

1 Like

I have checked grub.cfg as generated by Linux Mint and also there all menu -entries use UUID except for the menu entry for Arch. That is the same as generated in Manjaro i.e. /dev/nvme etcetera.
So this looks like something in os-prober.

There is a bug-report in debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=614143 from 2011!
with proposed change(s). There is a remark from the developer: “os-prober presumably picked this kernel up from some other boot loader’s configuration file - perhaps /boot/grub/grub.conf in your system.”
Maybe the problem for os-prober in my situation is that my Arch installation does not have grub at all.
I have tested the first proposed change to /usr/share/os-prober/common.sh and that works.

I realize that this thread is in the twilight zone by now; thanks for reading.

1 Like