update-grub sets wrong kernel root upon second execution

Message
Author
calm-steam
Posts: 6
Joined: Tue Apr 22, 2025 9:19 pm

update-grub sets wrong kernel root upon second execution

#1 Post by calm-steam »

My system looks like this:

Code: Select all

    NAME                    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
    sda                       8:0    0 931.5G  0 disk
    ├─sda1                    8:1    0   500M  0 part  /boot
    ├─sda2                    8:2    0   500M  0 part
    ├─sda3                    8:3    0    32M  0 part
    └─sda4                    8:4    0 930.5G  0 part
      └─sda4_crypt          254:0    0 930.5G  0 crypt
        ├─govinda-swap      254:1    0  15.6G  0 lvm   [SWAP]
        ├─govinda-avlinux   254:2    0  97.7G  0 lvm   /
        ├─govinda-home      254:3    0 488.3G  0 lvm   /home
        └─govinda-mx--linux 254:4    0    93G  0 lvm
    zram0                   253:0    0   256M  0 disk  [SWAP]
Currently I am in govinda-avlinux. My /etc/default/grub looks like this:

Code: Select all

    # If you change this file, run 'update-grub' afterwards to update
    # /boot/grub/grub.cfg.
    # For full documentation of the options in this file, see:
    #   info -f grub -n 'Simple configuration'
    
    GRUB_DEFAULT="0"
    GRUB_TIMEOUT=5
    GRUB_DISTRIBUTOR="$(unset PRETTY_NAME; (. /etc/lsb-release; echo ${PRETTY_NAME:?}) 2>/dev/null || echo Debian)"
    GRUB_CMDLINE_LINUX_DEFAULT="quiet threadirqs nosplash"
    GRUB_CMDLINE_LINUX=""
    GRUB_ENABLE_CRYPTODISK=y
    
    # Uncomment to enable BadRAM filtering, modify to suit your needs
    # This works with Linux (no patch required) and with any kernel that obtains
    # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
    #GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
    
    # Uncomment to disable graphical terminal (grub-pc only)
    #GRUB_TERMINAL=console
    
    # The resolution used on graphical terminal
    # note that you can use only modes which your graphic card supports via VBE
    # you can see them in real GRUB with the command `vbeinfo'
    GRUB_GFXMODE=1024x768
    
    # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
    #GRUB_DISABLE_LINUX_UUID=true
    
    # Uncomment to disable generation of recovery mode menu entries
    GRUB_DISABLE_RECOVERY="true"
    
    # Uncomment to get a beep at grub start
    #GRUB_INIT_TUNE="480 440 1"
    
    GRUB_DISABLE_OS_PROBER=false
    #export GRUB_MENU_PICTURE="/usr/share/backgrounds/MXLinux/grub/linen-gradientblu-grub.png"
    #export GRUB_MENU_PICTURE="/usr/share/backgrounds/MX18ALPHAWALL.png"
    
    GRUB_THEME="/boot/grub/themes/AVL-MXe/theme.txt"
For comparison, the contents of /etc/default/grub in govinda-mx--linux:

Code: Select all

    # If you change this file, run 'update-grub' afterwards to update
    # /boot/grub/grub.cfg.
    # For full documentation of the options in this file, see:
    #   info -f grub -n 'Simple configuration'
    
    #GRUB_DEFAULT=saved
    #GRUB_SAVEDEFAULT=true
    GRUB_TIMEOUT=10
    GRUB_DISTRIBUTOR="$(unset PRETTY_NAME; (. /etc/lsb-release; echo ${PRETTY_NAME:?}) 2>/dev/null || echo Debian)"
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
    GRUB_CMDLINE_LINUX=""
    #GRUB_ENABLE_CRYPTODISK=y
    
    # Uncomment to enable BadRAM filtering, modify to suit your needs
    # This works with Linux (no patch required) and with any kernel that obtains
    # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
    #GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
    
    # Uncomment to disable graphical terminal (grub-pc only)
    #GRUB_TERMINAL=console
    
    # The resolution used on graphical terminal
    # note that you can use only modes which your graphic card supports via VBE
    # you can see them in real GRUB with the command `vbeinfo'
    GRUB_GFXMODE=1024x768
    
    # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
    #GRUB_DISABLE_LINUX_UUID=true
    
    # Uncomment to disable generation of recovery mode menu entries
    GRUB_DISABLE_RECOVERY="true"
    
    # Uncomment to get a beep at grub start
    #GRUB_INIT_TUNE="480 440 1"
    
    #run dpkg-reconfigure grub-pc to allow toggle of os-prober
    GRUB_DISABLE_OS_PROBER=true
    
    if [ -e /etc/default/grub.mx-defaults ]; then
    .  /etc/default/grub.mx-defaults
    fi
    
    GRUB_THEME="/boot/grub/themes/AVL-MXe/theme.txt"

Currently, these are the contents of /boot/grub/grub.cfg:

Code: Select all

    #
    # 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 ###
    if [ -s $prefix/grubenv ]; then
      set have_grubenv=true
      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="0"
    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
    }
    
    if [ x$feature_default_font_path = xy ] ; then
       font=unicode
    else
    insmod part_gpt
    insmod ext2
    set root='hd0,gpt1'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    else
      search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    fi
        font="/grub/unicode.pf2"
    fi
    
    if loadfont $font ; then
      set gfxmode=1024x768
      load_video
      insmod gfxterm
      set locale_dir=$prefix/locale
      set lang=en_US
      insmod gettext
    fi
    terminal_output gfxterm
    insmod part_gpt
    insmod ext2
    set root='hd0,gpt1'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    else
      search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    fi
    insmod gfxmenu
    loadfont ($root)/grub/themes/AVL-MXe/terminus-12.pf2
    loadfont ($root)/grub/themes/AVL-MXe/terminus-14.pf2
    loadfont ($root)/grub/themes/AVL-MXe/terminus-16.pf2
    loadfont ($root)/grub/themes/AVL-MXe/terminus-18.pf2
    loadfont ($root)/grub/themes/AVL-MXe/ubuntu_regular_17.pf2
    loadfont ($root)/grub/themes/AVL-MXe/ubuntu_regular_20.pf2
    insmod png
    set theme=($root)/grub/themes/AVL-MXe/theme.txt
    export theme
    if [ "${recordfail}" = 1 ] ; then
      set timeout=30
    else
      if [ x$feature_timeout_style = xy ] ; then
        set timeout_style=menu
        set timeout=10
      # Fallback normal timeout code in case the timeout_style feature is
      # unavailable.
      else
        set timeout=10
      fi
    fi
    ### END /etc/grub.d/00_header ###
    
    ### BEGIN /etc/grub.d/05_debian_theme ###
    set menu_color_normal=cyan/blue
    set menu_color_highlight=white/blue
    ### END /etc/grub.d/05_debian_theme ###
    
    ### BEGIN /etc/grub.d/10_linux ###
    function gfxmode {
    	set gfxpayload="${1}"
    }
    set linux_gfx_mode=
    export linux_gfx_mode
    menuentry 'MX 23.6 Libretto' --class mx --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-c925e8d5-5b64-4176-8702-9fae954356e4' {
    	load_video
    	insmod gzio
    	if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
    	insmod part_gpt
    	insmod ext2
    	set root='hd0,gpt1'
    	if [ x$feature_platform_search_hint = xy ]; then
    	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    	else
    	  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    	fi
    	echo	'Loading Linux 6.12.8-1-liquorix-amd64 ...'
    	linux	/vmlinuz-6.12.8-1-liquorix-amd64 root=/dev/mapper/govinda-mx--linux ro  quiet splash
    	echo	'Loading initial ramdisk ...'
    	initrd	/initrd.img-6.12.8-1-liquorix-amd64
    }
    submenu 'Advanced options for MX 23.6 Libretto' $menuentry_id_option 'gnulinux-advanced-c925e8d5-5b64-4176-8702-9fae954356e4' {
    	menuentry 'MX 23.6 Libretto, with Linux 6.12.8-1-liquorix-amd64' --class mx --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.12.8-1-liquorix-amd64-advanced-c925e8d5-5b64-4176-8702-9fae954356e4' {
    		load_video
    		insmod gzio
    		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt1'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    		else
    		  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    		fi
    		echo	'Loading Linux 6.12.8-1-liquorix-amd64 ...'
    		linux	/vmlinuz-6.12.8-1-liquorix-amd64 root=/dev/mapper/govinda-mx--linux ro  quiet splash
    		echo	'Loading initial ramdisk ...'
    		initrd	/initrd.img-6.12.8-1-liquorix-amd64
    	}
    	menuentry 'MX 23.6 Libretto, with Linux 6.12.8-1-liquorix-amd64 (systemd)' --class mx --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.12.8-1-liquorix-amd64-init-systemd-c925e8d5-5b64-4176-8702-9fae954356e4' {
    		load_video
    		insmod gzio
    		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt1'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    		else
    		  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    		fi
    		echo	'Loading Linux 6.12.8-1-liquorix-amd64 ...'
    		linux	/vmlinuz-6.12.8-1-liquorix-amd64 root=/dev/mapper/govinda-mx--linux ro  quiet splash init=/lib/systemd/systemd
    		echo	'Loading initial ramdisk ...'
    		initrd	/initrd.img-6.12.8-1-liquorix-amd64
    	}
    	menuentry 'MX 23.6 Libretto, with Linux 6.6.12-1-liquorix-amd64' --class mx --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.6.12-1-liquorix-amd64-advanced-c925e8d5-5b64-4176-8702-9fae954356e4' {
    		load_video
    		insmod gzio
    		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt1'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    		else
    		  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    		fi
    		echo	'Loading Linux 6.6.12-1-liquorix-amd64 ...'
    		linux	/vmlinuz-6.6.12-1-liquorix-amd64 root=/dev/mapper/govinda-mx--linux ro  quiet splash
    		echo	'Loading initial ramdisk ...'
    		initrd	/initrd.img-6.6.12-1-liquorix-amd64
    	}
    	menuentry 'MX 23.6 Libretto, with Linux 6.6.12-1-liquorix-amd64 (systemd)' --class mx --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.6.12-1-liquorix-amd64-init-systemd-c925e8d5-5b64-4176-8702-9fae954356e4' {
    		load_video
    		insmod gzio
    		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt1'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    		else
    		  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    		fi
    		echo	'Loading Linux 6.6.12-1-liquorix-amd64 ...'
    		linux	/vmlinuz-6.6.12-1-liquorix-amd64 root=/dev/mapper/govinda-mx--linux ro  quiet splash init=/lib/systemd/systemd
    		echo	'Loading initial ramdisk ...'
    		initrd	/initrd.img-6.6.12-1-liquorix-amd64
    	}
    }
    
    ### END /etc/grub.d/10_linux ###
    
    ### BEGIN /etc/grub.d/20_linux_xen ###
    
    ### END /etc/grub.d/20_linux_xen ###
    
    ### BEGIN /etc/grub.d/20_memtest86+ ###
    ### END /etc/grub.d/20_memtest86+ ###
    
    ### BEGIN /etc/grub.d/30_os-prober ###
    menuentry 'AVL-MXe-Base 23.5 (23.6) (on /dev/mapper/govinda-avlinux)' --class avl_mxe_base --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-cce89aee-6e99-48f8-8fe1-aff0c08619d0' {
    	insmod part_gpt
    	insmod ext2
    	set root='hd0,gpt1'
    	if [ x$feature_platform_search_hint = xy ]; then
    	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    	else
    	  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    	fi
    	linux /vmlinuz-6.12.8-1-liquorix-amd64 root=/dev/mapper/govinda-mx--linux ro quiet splash
    	initrd /initrd.img-6.12.8-1-liquorix-amd64
    }
    submenu 'Advanced options for AVL-MXe-Base 23.5 (23.6) (on /dev/mapper/govinda-avlinux)' $menuentry_id_option 'osprober-gnulinux-advanced-cce89aee-6e99-48f8-8fe1-aff0c08619d0' {
    	menuentry 'MX 23.6 Libretto (on /dev/mapper/govinda-avlinux)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-6.12.8-1-liquorix-amd64--cce89aee-6e99-48f8-8fe1-aff0c08619d0' {
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt1'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    		else
    		  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    		fi
    		linux /vmlinuz-6.12.8-1-liquorix-amd64 root=/dev/mapper/govinda-mx--linux ro quiet splash
    		initrd /initrd.img-6.12.8-1-liquorix-amd64
    	}
    	menuentry 'MX 23.6 Libretto, with Linux 6.12.8-1-liquorix-amd64 (on /dev/mapper/govinda-avlinux)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-6.12.8-1-liquorix-amd64--cce89aee-6e99-48f8-8fe1-aff0c08619d0' {
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt1'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    		else
    		  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    		fi
    		linux /vmlinuz-6.12.8-1-liquorix-amd64 root=/dev/mapper/govinda-mx--linux ro quiet splash
    		initrd /initrd.img-6.12.8-1-liquorix-amd64
    	}
    	menuentry 'MX 23.6 Libretto, with Linux 6.12.8-1-liquorix-amd64 (systemd) (on /dev/mapper/govinda-avlinux)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-6.12.8-1-liquorix-amd64--cce89aee-6e99-48f8-8fe1-aff0c08619d0' {
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt1'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    		else
    		  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    		fi
    		linux /vmlinuz-6.12.8-1-liquorix-amd64 root=/dev/mapper/govinda-mx--linux ro quiet splash init=/lib/systemd/systemd
    		initrd /initrd.img-6.12.8-1-liquorix-amd64
    	}
    	menuentry 'MX 23.6 Libretto, with Linux 6.6.12-1-liquorix-amd64 (on /dev/mapper/govinda-avlinux)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-6.6.12-1-liquorix-amd64--cce89aee-6e99-48f8-8fe1-aff0c08619d0' {
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt1'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    		else
    		  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    		fi
    		linux /vmlinuz-6.6.12-1-liquorix-amd64 root=/dev/mapper/govinda-mx--linux ro quiet splash
    		initrd /initrd.img-6.6.12-1-liquorix-amd64
    	}
    	menuentry 'MX 23.6 Libretto, with Linux 6.6.12-1-liquorix-amd64 (systemd) (on /dev/mapper/govinda-avlinux)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-6.6.12-1-liquorix-amd64--cce89aee-6e99-48f8-8fe1-aff0c08619d0' {
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt1'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    		else
    		  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    		fi
    		linux /vmlinuz-6.6.12-1-liquorix-amd64 root=/dev/mapper/govinda-mx--linux ro quiet splash init=/lib/systemd/systemd
    		initrd /initrd.img-6.6.12-1-liquorix-amd64
    	}
    }
    
    ### END /etc/grub.d/30_os-prober ###
    
    ### BEGIN /etc/grub.d/30_uefi-firmware ###
    menuentry 'System setup' $menuentry_id_option 'uefi-firmware' {
    	fwsetup
    }
    ### 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.
    ### 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 ###
Notice that the menu entries from os_prober are just a repetition of the ones from 10_linux. This happened because I updated two times from govinda-mx--linux.

I proceed to update-grub, and the contents of the previous file change to:

Code: Select all

    #
    # 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 ###
    if [ -s $prefix/grubenv ]; then
      set have_grubenv=true
      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="0"
    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
    }
    
    if [ x$feature_default_font_path = xy ] ; then
       font=unicode
    else
    insmod part_gpt
    insmod cryptodisk
    insmod luks2
    insmod gcry_rijndael
    insmod gcry_rijndael
    insmod gcry_sha256
    insmod lvm
    insmod ext2
    cryptomount -u e5fa1237ea61492db62cf252e69e1653
    set root='lvmid/ccL3Iu-zGYY-xRAV-yL52-gnUo-D0KR-MWzVnv/fiFgv8-R9A5-Fj3Q-rSWc-6Pmf-JV9V-iWfCDy'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint='lvmid/ccL3Iu-zGYY-xRAV-yL52-gnUo-D0KR-MWzVnv/fiFgv8-R9A5-Fj3Q-rSWc-6Pmf-JV9V-iWfCDy'  cce89aee-6e99-48f8-8fe1-aff0c08619d0
    else
      search --no-floppy --fs-uuid --set=root cce89aee-6e99-48f8-8fe1-aff0c08619d0
    fi
        font="/usr/share/grub/unicode.pf2"
    fi
    
    if loadfont $font ; then
      set gfxmode=1024x768
      load_video
      insmod gfxterm
      set locale_dir=$prefix/locale
      set lang=en_US
      insmod gettext
    fi
    terminal_output gfxterm
    insmod part_gpt
    insmod ext2
    set root='hd0,gpt1'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    else
      search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    fi
    insmod gfxmenu
    loadfont ($root)/grub/themes/AVL-MXe/terminus-12.pf2
    loadfont ($root)/grub/themes/AVL-MXe/terminus-14.pf2
    loadfont ($root)/grub/themes/AVL-MXe/terminus-16.pf2
    loadfont ($root)/grub/themes/AVL-MXe/terminus-18.pf2
    loadfont ($root)/grub/themes/AVL-MXe/ubuntu_regular_17.pf2
    loadfont ($root)/grub/themes/AVL-MXe/ubuntu_regular_20.pf2
    insmod png
    set theme=($root)/grub/themes/AVL-MXe/theme.txt
    export theme
    if [ "${recordfail}" = 1 ] ; then
      set timeout=30
    else
      if [ x$feature_timeout_style = xy ] ; then
        set timeout_style=menu
        set timeout=5
      # Fallback normal timeout code in case the timeout_style feature is
      # unavailable.
      else
        set timeout=5
      fi
    fi
    ### END /etc/grub.d/00_header ###
    
    ### BEGIN /etc/grub.d/05_debian_theme ###
    set menu_color_normal=cyan/blue
    set menu_color_highlight=white/blue
    ### END /etc/grub.d/05_debian_theme ###
    
    ### BEGIN /etc/grub.d/10_linux ###
    function gfxmode {
    	set gfxpayload="${1}"
    }
    set linux_gfx_mode=
    export linux_gfx_mode
    menuentry 'AVL MXe Greatest Hits' --class avl --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-cce89aee-6e99-48f8-8fe1-aff0c08619d0' {
    	load_video
    	insmod gzio
    	if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
    	insmod part_gpt
    	insmod ext2
    	set root='hd0,gpt1'
    	if [ x$feature_platform_search_hint = xy ]; then
    	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    	else
    	  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    	fi
    	echo	'Loading Linux 6.12.8-1-liquorix-amd64 ...'
    	linux	/vmlinuz-6.12.8-1-liquorix-amd64 root=/dev/mapper/govinda-avlinux ro  quiet threadirqs nosplash
    	echo	'Loading initial ramdisk ...'
    	initrd	/initrd.img-6.12.8-1-liquorix-amd64
    }
    submenu 'Advanced options for AVL MXe Greatest Hits' $menuentry_id_option 'gnulinux-advanced-cce89aee-6e99-48f8-8fe1-aff0c08619d0' {
    	menuentry 'AVL MXe Greatest Hits, with Linux 6.12.8-1-liquorix-amd64' --class avl --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.12.8-1-liquorix-amd64-advanced-cce89aee-6e99-48f8-8fe1-aff0c08619d0' {
    		load_video
    		insmod gzio
    		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt1'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    		else
    		  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    		fi
    		echo	'Loading Linux 6.12.8-1-liquorix-amd64 ...'
    		linux	/vmlinuz-6.12.8-1-liquorix-amd64 root=/dev/mapper/govinda-avlinux ro  quiet threadirqs nosplash
    		echo	'Loading initial ramdisk ...'
    		initrd	/initrd.img-6.12.8-1-liquorix-amd64
    	}
    	menuentry 'AVL MXe Greatest Hits, with Linux 6.6.12-1-liquorix-amd64' --class avl --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.6.12-1-liquorix-amd64-advanced-cce89aee-6e99-48f8-8fe1-aff0c08619d0' {
    		load_video
    		insmod gzio
    		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt1'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    		else
    		  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    		fi
    		echo	'Loading Linux 6.6.12-1-liquorix-amd64 ...'
    		linux	/vmlinuz-6.6.12-1-liquorix-amd64 root=/dev/mapper/govinda-avlinux ro  quiet threadirqs nosplash
    		echo	'Loading initial ramdisk ...'
    		initrd	/initrd.img-6.6.12-1-liquorix-amd64
    	}
    }
    
    ### END /etc/grub.d/10_linux ###
    
    ### BEGIN /etc/grub.d/20_linux_xen ###
    
    ### END /etc/grub.d/20_linux_xen ###
    
    ### BEGIN /etc/grub.d/20_memtest86+ ###
    ### END /etc/grub.d/20_memtest86+ ###
    
    ### BEGIN /etc/grub.d/30_os-prober ###
    menuentry 'MX 23.6 Libretto (23.6) (on /dev/mapper/govinda-mx--linux)' --class mx --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-c925e8d5-5b64-4176-8702-9fae954356e4' {
    	insmod part_gpt
    	insmod ext2
    	set root='hd0,gpt1'
    	if [ x$feature_platform_search_hint = xy ]; then
    	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    	else
    	  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    	fi
    	linux /vmlinuz-6.12.8-1-liquorix-amd64 root=/dev/mapper/govinda-mx--linux ro quiet splash
    	initrd /initrd.img-6.12.8-1-liquorix-amd64
    }
    submenu 'Advanced options for MX 23.6 Libretto (23.6) (on /dev/mapper/govinda-mx--linux)' $menuentry_id_option 'osprober-gnulinux-advanced-c925e8d5-5b64-4176-8702-9fae954356e4' {
    	menuentry 'MX 23.6 Libretto (on /dev/mapper/govinda-mx--linux)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-6.12.8-1-liquorix-amd64--c925e8d5-5b64-4176-8702-9fae954356e4' {
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt1'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    		else
    		  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    		fi
    		linux /vmlinuz-6.12.8-1-liquorix-amd64 root=/dev/mapper/govinda-mx--linux ro quiet splash
    		initrd /initrd.img-6.12.8-1-liquorix-amd64
    	}
    	menuentry 'MX 23.6 Libretto, with Linux 6.12.8-1-liquorix-amd64 (on /dev/mapper/govinda-mx--linux)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-6.12.8-1-liquorix-amd64--c925e8d5-5b64-4176-8702-9fae954356e4' {
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt1'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    		else
    		  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    		fi
    		linux /vmlinuz-6.12.8-1-liquorix-amd64 root=/dev/mapper/govinda-mx--linux ro quiet splash
    		initrd /initrd.img-6.12.8-1-liquorix-amd64
    	}
    	menuentry 'MX 23.6 Libretto, with Linux 6.12.8-1-liquorix-amd64 (systemd) (on /dev/mapper/govinda-mx--linux)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-6.12.8-1-liquorix-amd64--c925e8d5-5b64-4176-8702-9fae954356e4' {
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt1'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    		else
    		  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    		fi
    		linux /vmlinuz-6.12.8-1-liquorix-amd64 root=/dev/mapper/govinda-mx--linux ro quiet splash init=/lib/systemd/systemd
    		initrd /initrd.img-6.12.8-1-liquorix-amd64
    	}
    	menuentry 'MX 23.6 Libretto, with Linux 6.6.12-1-liquorix-amd64 (on /dev/mapper/govinda-mx--linux)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-6.6.12-1-liquorix-amd64--c925e8d5-5b64-4176-8702-9fae954356e4' {
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt1'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    		else
    		  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    		fi
    		linux /vmlinuz-6.6.12-1-liquorix-amd64 root=/dev/mapper/govinda-mx--linux ro quiet splash
    		initrd /initrd.img-6.6.12-1-liquorix-amd64
    	}
    	menuentry 'MX 23.6 Libretto, with Linux 6.6.12-1-liquorix-amd64 (systemd) (on /dev/mapper/govinda-mx--linux)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-6.6.12-1-liquorix-amd64--c925e8d5-5b64-4176-8702-9fae954356e4' {
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt1'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    		else
    		  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    		fi
    		linux /vmlinuz-6.6.12-1-liquorix-amd64 root=/dev/mapper/govinda-mx--linux ro quiet splash init=/lib/systemd/systemd
    		initrd /initrd.img-6.6.12-1-liquorix-amd64
    	}
    }
    
    ### END /etc/grub.d/30_os-prober ###
    
    ### BEGIN /etc/grub.d/30_uefi-firmware ###
    menuentry 'System setup' $menuentry_id_option 'uefi-firmware' {
    	fwsetup
    }
    ### END /etc/grub.d/30_uefi-firmware ###
    
    ### 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.
    ### 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 ###
Notice that everything is as expected and the root in all menu entries is correct.

I update a second time:

Code: Select all

    #
    # 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 ###
    if [ -s $prefix/grubenv ]; then
      set have_grubenv=true
      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="0"
    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
    }
    
    if [ x$feature_default_font_path = xy ] ; then
       font=unicode
    else
    insmod part_gpt
    insmod cryptodisk
    insmod luks2
    insmod gcry_rijndael
    insmod gcry_rijndael
    insmod gcry_sha256
    insmod lvm
    insmod ext2
    cryptomount -u e5fa1237ea61492db62cf252e69e1653
    set root='lvmid/ccL3Iu-zGYY-xRAV-yL52-gnUo-D0KR-MWzVnv/fiFgv8-R9A5-Fj3Q-rSWc-6Pmf-JV9V-iWfCDy'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint='lvmid/ccL3Iu-zGYY-xRAV-yL52-gnUo-D0KR-MWzVnv/fiFgv8-R9A5-Fj3Q-rSWc-6Pmf-JV9V-iWfCDy'  cce89aee-6e99-48f8-8fe1-aff0c08619d0
    else
      search --no-floppy --fs-uuid --set=root cce89aee-6e99-48f8-8fe1-aff0c08619d0
    fi
        font="/usr/share/grub/unicode.pf2"
    fi
    
    if loadfont $font ; then
      set gfxmode=1024x768
      load_video
      insmod gfxterm
      set locale_dir=$prefix/locale
      set lang=en_US
      insmod gettext
    fi
    terminal_output gfxterm
    insmod part_gpt
    insmod ext2
    set root='hd0,gpt1'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    else
      search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    fi
    insmod gfxmenu
    loadfont ($root)/grub/themes/AVL-MXe/terminus-12.pf2
    loadfont ($root)/grub/themes/AVL-MXe/terminus-14.pf2
    loadfont ($root)/grub/themes/AVL-MXe/terminus-16.pf2
    loadfont ($root)/grub/themes/AVL-MXe/terminus-18.pf2
    loadfont ($root)/grub/themes/AVL-MXe/ubuntu_regular_17.pf2
    loadfont ($root)/grub/themes/AVL-MXe/ubuntu_regular_20.pf2
    insmod png
    set theme=($root)/grub/themes/AVL-MXe/theme.txt
    export theme
    if [ "${recordfail}" = 1 ] ; then
      set timeout=30
    else
      if [ x$feature_timeout_style = xy ] ; then
        set timeout_style=menu
        set timeout=5
      # Fallback normal timeout code in case the timeout_style feature is
      # unavailable.
      else
        set timeout=5
      fi
    fi
    ### END /etc/grub.d/00_header ###
    
    ### BEGIN /etc/grub.d/05_debian_theme ###
    set menu_color_normal=cyan/blue
    set menu_color_highlight=white/blue
    ### END /etc/grub.d/05_debian_theme ###
    
    ### BEGIN /etc/grub.d/10_linux ###
    function gfxmode {
    	set gfxpayload="${1}"
    }
    set linux_gfx_mode=
    export linux_gfx_mode
    menuentry 'AVL MXe Greatest Hits' --class avl --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-cce89aee-6e99-48f8-8fe1-aff0c08619d0' {
    	load_video
    	insmod gzio
    	if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
    	insmod part_gpt
    	insmod ext2
    	set root='hd0,gpt1'
    	if [ x$feature_platform_search_hint = xy ]; then
    	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    	else
    	  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    	fi
    	echo	'Loading Linux 6.12.8-1-liquorix-amd64 ...'
    	linux	/vmlinuz-6.12.8-1-liquorix-amd64 root=/dev/mapper/govinda-avlinux ro  quiet threadirqs nosplash
    	echo	'Loading initial ramdisk ...'
    	initrd	/initrd.img-6.12.8-1-liquorix-amd64
    }
    submenu 'Advanced options for AVL MXe Greatest Hits' $menuentry_id_option 'gnulinux-advanced-cce89aee-6e99-48f8-8fe1-aff0c08619d0' {
    	menuentry 'AVL MXe Greatest Hits, with Linux 6.12.8-1-liquorix-amd64' --class avl --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.12.8-1-liquorix-amd64-advanced-cce89aee-6e99-48f8-8fe1-aff0c08619d0' {
    		load_video
    		insmod gzio
    		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt1'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    		else
    		  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    		fi
    		echo	'Loading Linux 6.12.8-1-liquorix-amd64 ...'
    		linux	/vmlinuz-6.12.8-1-liquorix-amd64 root=/dev/mapper/govinda-avlinux ro  quiet threadirqs nosplash
    		echo	'Loading initial ramdisk ...'
    		initrd	/initrd.img-6.12.8-1-liquorix-amd64
    	}
    	menuentry 'AVL MXe Greatest Hits, with Linux 6.6.12-1-liquorix-amd64' --class avl --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.6.12-1-liquorix-amd64-advanced-cce89aee-6e99-48f8-8fe1-aff0c08619d0' {
    		load_video
    		insmod gzio
    		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt1'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    		else
    		  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    		fi
    		echo	'Loading Linux 6.6.12-1-liquorix-amd64 ...'
    		linux	/vmlinuz-6.6.12-1-liquorix-amd64 root=/dev/mapper/govinda-avlinux ro  quiet threadirqs nosplash
    		echo	'Loading initial ramdisk ...'
    		initrd	/initrd.img-6.6.12-1-liquorix-amd64
    	}
    }
    
    ### END /etc/grub.d/10_linux ###
    
    ### BEGIN /etc/grub.d/20_linux_xen ###
    
    ### END /etc/grub.d/20_linux_xen ###
    
    ### BEGIN /etc/grub.d/20_memtest86+ ###
    ### END /etc/grub.d/20_memtest86+ ###
    
    ### BEGIN /etc/grub.d/30_os-prober ###
    menuentry 'MX 23.6 Libretto (23.6) (on /dev/mapper/govinda-mx--linux)' --class mx --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-c925e8d5-5b64-4176-8702-9fae954356e4' {
    	insmod part_gpt
    	insmod ext2
    	set root='hd0,gpt1'
    	if [ x$feature_platform_search_hint = xy ]; then
    	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    	else
    	  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    	fi
    	linux /vmlinuz-6.12.8-1-liquorix-amd64 root=/dev/mapper/govinda-avlinux ro quiet threadirqs nosplash
    	initrd /initrd.img-6.12.8-1-liquorix-amd64
    }
    submenu 'Advanced options for MX 23.6 Libretto (23.6) (on /dev/mapper/govinda-mx--linux)' $menuentry_id_option 'osprober-gnulinux-advanced-c925e8d5-5b64-4176-8702-9fae954356e4' {
    	menuentry 'AVL MXe Greatest Hits (on /dev/mapper/govinda-mx--linux)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-6.12.8-1-liquorix-amd64--c925e8d5-5b64-4176-8702-9fae954356e4' {
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt1'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    		else
    		  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    		fi
    		linux /vmlinuz-6.12.8-1-liquorix-amd64 root=/dev/mapper/govinda-avlinux ro quiet threadirqs nosplash
    		initrd /initrd.img-6.12.8-1-liquorix-amd64
    	}
    	menuentry 'AVL MXe Greatest Hits, with Linux 6.12.8-1-liquorix-amd64 (on /dev/mapper/govinda-mx--linux)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-6.12.8-1-liquorix-amd64--c925e8d5-5b64-4176-8702-9fae954356e4' {
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt1'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    		else
    		  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    		fi
    		linux /vmlinuz-6.12.8-1-liquorix-amd64 root=/dev/mapper/govinda-avlinux ro quiet threadirqs nosplash
    		initrd /initrd.img-6.12.8-1-liquorix-amd64
    	}
    	menuentry 'AVL MXe Greatest Hits, with Linux 6.6.12-1-liquorix-amd64 (on /dev/mapper/govinda-mx--linux)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-6.6.12-1-liquorix-amd64--c925e8d5-5b64-4176-8702-9fae954356e4' {
    		insmod part_gpt
    		insmod ext2
    		set root='hd0,gpt1'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  3ea98d19-ac3f-4f06-a357-420dbab68af8
    		else
    		  search --no-floppy --fs-uuid --set=root 3ea98d19-ac3f-4f06-a357-420dbab68af8
    		fi
    		linux /vmlinuz-6.6.12-1-liquorix-amd64 root=/dev/mapper/govinda-avlinux ro quiet threadirqs nosplash
    		initrd /initrd.img-6.6.12-1-liquorix-amd64
    	}
    }
    
    ### END /etc/grub.d/30_os-prober ###
    
    ### BEGIN /etc/grub.d/30_uefi-firmware ###
    menuentry 'System setup' $menuentry_id_option 'uefi-firmware' {
    	fwsetup
    }
    ### END /etc/grub.d/30_uefi-firmware ###
    
    ### 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.
    ### 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 ###
Notice that the result now is similar to the situation at the beginning. Booting to govinda-mx--linux and repeating the operations lays similar results.

The only references I could find to similar issues are these bugs in Ubuntu:
https://bugs.launchpad.net/ubuntu/+sour ... ug/1065196
https://bugs.launchpad.net/ubuntu/+sour ... bug/554307

Why is this happening? How can I solve it? Is it a bug in os-prober?

User avatar
j2mcgreg
Global Moderator
Posts: 7064
Joined: Tue Oct 23, 2007 12:04 pm

Re: update-grub sets wrong kernel root upon second execution

#2 Post by j2mcgreg »

Please post the output of:

Code: Select all

inxi -Fxxxrza
Last edited by j2mcgreg on Sat May 03, 2025 12:57 pm, edited 1 time in total.
Reason: typo
HP 15; ryzen 3 5300U APU; 500 Gb SSD; 8GB ram
HP 17; ryzen 3 3200; 500 GB SSD; 12 GB ram
Idea Center 3; 12 gen i5; 256 GB ssd;

In Linux, newer isn't always better. The best solution is the one that works.

calm-steam
Posts: 6
Joined: Tue Apr 22, 2025 9:19 pm

Re: update-grub sets wrong kernel root upon second execution

#3 Post by calm-steam »

Code: Select all

System:
  Kernel: 6.12.8-1-liquorix-amd64 arch: x86_64 bits: 64 compiler: gcc
    v: 12.2.0 parameters: audit=0 intel_pstate=disable amd_pstate=disable
    BOOT_IMAGE=/vmlinuz-6.12.8-1-liquorix-amd64
    root=/dev/mapper/govinda-avlinux ro quiet threadirqs nosplash
  Desktop: Enlightenment v: 0.25.4 vt: 7 dm: LightDM v: 1.32.0
    Distro: AVL_MXE_BASE-23.5_x64 Greatest Hits October 2024 base: Debian
    GNU/Linux 12 (bookworm)
Machine:
  Type: Laptop System: Acer product: Aspire V3-572G v: V1.32
    serial: <superuser required> Chassis: type: 10 serial: <superuser required>
  Mobo: Acer model: EA50_HB v: V1.32 serial: <superuser required>
    UEFI: Insyde v: 1.32 date: 09/15/2015
Battery:
  ID-1: BAT1 charge: 49.0 Wh (100.0%) condition: 49.0/48.8 Wh (100.2%)
    volts: 12.4 min: 11.1 model: SANYO 0x32334134314C41 type: Li-ion
    serial: <filter> status: full
CPU:
  Info: model: Intel Core i5-4210U bits: 64 type: MT MCP arch: Haswell
    gen: core 4 level: v3 note: check built: 2013-15 process: Intel 22nm
    family: 6 model-id: 0x45 (69) stepping: 1 microcode: 0x26
  Topology: cpus: 1x cores: 2 tpc: 2 threads: 4 smt: enabled cache:
    L1: 128 KiB desc: d-2x32 KiB; i-2x32 KiB L2: 512 KiB desc: 2x256 KiB
    L3: 3 MiB desc: 1x3 MiB
  Speed (MHz): avg: 2395 high: 2396 min/max: 768/2401 boost: enabled
    scaling: driver: acpi-cpufreq governor: performance cores: 1: 2395 2: 2395
    3: 2395 4: 2396 bogomips: 19156
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities:
  Type: gather_data_sampling status: Not affected
  Type: itlb_multihit status: KVM: Split huge pages
  Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT
    vulnerable
  Type: mds mitigation: Clear CPU buffers; SMT vulnerable
  Type: meltdown mitigation: PTI
  Type: mmio_stale_data status: Unknown: No mitigations
  Type: reg_file_data_sampling status: Not affected
  Type: retbleed status: Not affected
  Type: spec_rstack_overflow status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: Retpolines; IBPB: conditional; IBRS_FW;
    STIBP: conditional; RSB filling; PBRSB-eIBRS: Not affected; BHI: Not
    affected
  Type: srbds mitigation: Microcode
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: Intel Haswell-ULT Integrated Graphics
    vendor: Acer Incorporated ALI driver: i915 v: kernel arch: Gen-7.5
    process: Intel 22nm built: 2013 ports: active: eDP-1
    empty: DP-1,HDMI-A-1,HDMI-A-2 bus-ID: 00:02.0 chip-ID: 8086:0a16
    class-ID: 0300
  Device-2: NVIDIA GM108M [GeForce 840M] vendor: Acer Incorporated ALI
    driver: N/A alternate: nouveau non-free: 530.xx+
    status: current (as of 2023-03) arch: Maxwell code: GMxxx
    process: TSMC 28nm built: 2014-19 pcie: gen: 2 speed: 5 GT/s lanes: 4
    link-max: gen: 3 speed: 8 GT/s bus-ID: 03:00.0 chip-ID: 10de:1341
    class-ID: 0302
  Device-3: Sunplus Innovation Laptop Integrated WebCam HD type: USB
    driver: uvcvideo bus-ID: 1-7:3 chip-ID: 1bcf:2c6e class-ID: 0e02
  Display: x11 server: X.Org v: 1.21.1.7 compositor: enlightenment driver:
    X: loaded: modesetting unloaded: fbdev,vesa dri: crocus gpu: i915
    display-ID: :0.0 screens: 1
  Screen-1: 0 s-res: 1366x768 s-dpi: 96 s-size: 361x203mm (14.21x7.99")
    s-diag: 414mm (16.31")
  Monitor-1: eDP-1 model: LG Display 0x0456 built: 2014 res: 1366x768 hz: 60
    dpi: 101 gamma: 1.2 size: 344x194mm (13.54x7.64") diag: 395mm (15.5")
    ratio: 16:9 modes: 1366x768
  API: OpenGL v: 4.6 Mesa 24.2.8-1mx23ahs renderer: Mesa Intel HD Graphics
    4400 (HSW GT2) direct-render: Yes
Audio:
  Device-1: Intel Haswell-ULT HD Audio vendor: Acer Incorporated ALI
    driver: snd_hda_intel v: kernel bus-ID: 00:03.0 chip-ID: 8086:0a0c
    class-ID: 0403
  Device-2: Intel 8 Series HD Audio vendor: Acer Incorporated ALI 8
    driver: snd_hda_intel v: kernel bus-ID: 00:1b.0 chip-ID: 8086:9c20
    class-ID: 0403
  API: ALSA v: k6.12.8-1-liquorix-amd64 status: kernel-api
    tools: alsamixer,amixer
  Server-1: PipeWire v: 1.0.0 status: active with: 1: pipewire-pulse
    status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
    4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Realtek RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet
    vendor: Acer Incorporated ALI RTL8111/8168/8411 driver: r8169 v: kernel
    pcie: gen: 1 speed: 2.5 GT/s lanes: 1 port: 4000 bus-ID: 01:00.1
    chip-ID: 10ec:8168 class-ID: 0200
  IF: eth0 state: down mac: <filter>
  Device-2: Broadcom BCM43228 802.11a/b/g/n vendor: Foxconn driver: wl
    v: kernel modules: bcma pcie: gen: 1 speed: 2.5 GT/s lanes: 1
    bus-ID: 02:00.0 chip-ID: 14e4:4359 class-ID: 0280
  IF: wlan0 state: up mac: <filter>
Bluetooth:
  Device-1: Foxconn / Hon Hai BCM20702A0 type: USB driver: btusb v: 0.8
    bus-ID: 1-5:2 chip-ID: 0489:e046 class-ID: fe01 serial: <filter>
  Report: hciconfig ID: hci0 rfk-id: 3 state: down
    bt-service: enabled,running rfk-block: hardware: no software: yes
    address: <filter>
  Info: acl-mtu: 1021:8 sco-mtu: 64:1 link-policy: rswitch sniff
    link-mode: peripheral accept
Drives:
  Local Storage: total: 931.51 GiB used: 252.83 GiB (27.1%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/sda maj-min: 8:0 vendor: Samsung model: SSD 860 EVO 1TB
    size: 931.51 GiB block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s
    type: SSD serial: <filter> rev: 3B6Q scheme: GPT
Partition:
  ID-1: / raw-size: 97.66 GiB size: 95.56 GiB (97.86%) used: 10.1 GiB (10.6%)
    fs: ext4 dev: /dev/dm-2 maj-min: 254:2 mapped: govinda-avlinux
  ID-2: /boot raw-size: 500 MiB size: 458.3 MiB (91.67%)
    used: 277.3 MiB (60.5%) fs: ext4 dev: /dev/sda1 maj-min: 8:1
  ID-3: /home raw-size: 488.28 GiB size: 479.55 GiB (98.21%)
    used: 242.46 GiB (50.6%) fs: ext4 dev: /dev/dm-3 maj-min: 254:3
    mapped: govinda-home
Swap:
  Kernel: swappiness: 10 (default 60) cache-pressure: 100 (default)
  ID-1: swap-1 type: partition size: 15.62 GiB used: 0 KiB (0.0%)
    priority: -2 dev: /dev/dm-1 maj-min: 254:1 mapped: govinda-swap
  ID-2: swap-2 type: zram size: 256 MiB used: 0 KiB (0.0%) priority: 100
    dev: /dev/zram0
Sensors:
  System Temperatures: cpu: 43.0 C mobo: N/A
  Fan Speeds (RPM): N/A
Repos:
  Packages: pm: dpkg pkgs: 2382 libs: 1402 tools: apt,apt-get,aptitude pm: rpm
    pkgs: 0 pm: flatpak pkgs: 0
  No active apt repos in: /etc/apt/sources.list
  Active apt repos in: /etc/apt/sources.list.d/debian-stable-updates.list
    1: deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
  Active apt repos in: /etc/apt/sources.list.d/debian.list
    1: deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
    2: deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
  Active apt repos in: /etc/apt/sources.list.d/mx.list
    1: deb https://mirror.kku.ac.th/mx-packages/mx/repo/ bookworm main non-free
    2: deb https://mirror.kku.ac.th/mx-packages/mx/repo/ bookworm ahs
Info:
  Processes: 219 Uptime: 14m wakeups: 1 Memory: 15.55 GiB
  used: 1.48 GiB (9.5%) Init: systemd v: 252 target: graphical (5)
  default: graphical tool: systemctl Compilers: gcc: 12.2.0 alt: 12 Shell: Zsh
  v: 5.9 running-in: terminology inxi: 3.3.26

User avatar
dolphin_oracle
Developer
Posts: 22562
Joined: Sun Dec 16, 2007 12:17 pm

Re: update-grub sets wrong kernel root upon second execution

#4 Post by dolphin_oracle »

those update-grub operations were from the same installed system? no system package updates in between?

might be worth posting the /etc/grub.d/30_os-prober file.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.
Live system help document: https://mxlinux.org/wiki/help-antix-live-usb-system/

calm-steam
Posts: 6
Joined: Tue Apr 22, 2025 9:19 pm

Re: update-grub sets wrong kernel root upon second execution

#5 Post by calm-steam »

dolphin_oracle wrote: Sat May 03, 2025 2:07 pm those update-grub operations were from the same installed system?

might be worth posting the /etc/grub.d/30_os-prober file.
Yes, they were.

/etc/grub.d/30_os-prober:

Code: Select all

#! /bin/sh

#tag for mx-system update
#mx-system 20.11.02+4

export LVM_SUPPRESS_FD_WARNINGS=true

set -e


# grub-mkconfig helper script.
# Copyright (C) 2006,2007,2008,2009  Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.

prefix="/usr"
exec_prefix="/usr"
datarootdir="/usr/share"
quick_boot="0"

export TEXTDOMAIN=grub
export TEXTDOMAINDIR="${datarootdir}/locale"

. "$pkgdatadir/grub-mkconfig_lib"

found_other_os=

adjust_timeout () {
  if [ "$quick_boot" = 1 ] && [ "x${found_other_os}" != "x" ]; then
    cat << EOF
set timeout_style=menu
if [ "\${timeout}" = 0 ]; then
  set timeout=10
fi
EOF
  fi
}

if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
  exit 0
fi

if [ -z "`which os-prober 2> /dev/null`" ] || [ -z "`which linux-boot-prober 2> /dev/null`" ] ; then
  # missing os-prober and/or linux-boot-prober
  exit 0
fi

OSPROBED="`os-prober | tr ' ' '^' | paste -s -d ' '`"
if [ -z "${OSPROBED}" ] ; then
  # empty os-prober output, nothing doing
  exit 0
fi

osx_entry() {
    found_other_os=1
    if [ x$2 = x32 ]; then
        # TRANSLATORS: it refers to kernel architecture (32-bit)
	bitstr="$(gettext "(32-bit)")"
    else
        # TRANSLATORS: it refers to kernel architecture (64-bit)
	bitstr="$(gettext "(64-bit)")"
    fi
    # TRANSLATORS: it refers on the OS residing on device %s
    onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
        cat << EOF
menuentry '$(echo "${LONGNAME} $bitstr $onstr" | grub_quote)' --class osx --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(grub_get_device_id "${DEVICE}")'  {
EOF
	save_default_entry | grub_add_tab
	prepare_grub_to_access_device ${DEVICE} | grub_add_tab
	cat << EOF
        load_video
        set do_resume=0
        if [ /var/vm/sleepimage -nt10 / ]; then
           if xnu_resume /var/vm/sleepimage; then
             set do_resume=1
           fi
        fi
        if [ \$do_resume = 0 ]; then
           xnu_uuid ${OSXUUID} uuid
           if [ -f /Extra/DSDT.aml ]; then
              acpi -e /Extra/DSDT.aml
           fi
           if [ /kernelcache -nt /System/Library/Extensions ]; then
              $1 /kernelcache boot-uuid=\${uuid} rd=*uuid
           elif [ -f /System/Library/Kernels/kernel ]; then
              $1 /System/Library/Kernels/kernel boot-uuid=\${uuid} rd=*uuid
              xnu_kextdir /System/Library/Extensions
           else
              $1 /mach_kernel boot-uuid=\${uuid} rd=*uuid
              if [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then
                xnu_mkext /System/Library/Extensions.mkext
              else
                xnu_kextdir /System/Library/Extensions
              fi
           fi
           if [ -f /Extra/Extensions.mkext ]; then
              xnu_mkext /Extra/Extensions.mkext
           fi
           if [ -d /Extra/Extensions ]; then
              xnu_kextdir /Extra/Extensions
           fi
           if [ -f /Extra/devprop.bin ]; then
              xnu_devprop_load /Extra/devprop.bin
           fi
           if [ -f /Extra/splash.jpg ]; then
              insmod jpeg
              xnu_splash /Extra/splash.jpg
           fi
           if [ -f /Extra/splash.png ]; then
              insmod png
              xnu_splash /Extra/splash.png
           fi
           if [ -f /Extra/splash.tga ]; then
              insmod tga
              xnu_splash /Extra/splash.tga
           fi
        fi
}
EOF
}

used_osprober_linux_ids=

wubi=

for OS in ${OSPROBED} ; do
  DEVICE="`echo ${OS} | cut -d ':' -f 1`"
  LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
  LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
  BOOT="`echo ${OS} | cut -d ':' -f 4`"
  if UUID="`${grub_probe} --target=fs_uuid --device ${DEVICE%@*}`"; then
    EXPUUID="$UUID"

    if [ x"${DEVICE#*@}" != x ] ; then
      EXPUUID="${EXPUUID}@${DEVICE#*@}"
    fi

    if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" ] && [ "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then
      echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2
      continue
    fi
  fi

  BTRFS="`echo ${OS} | cut -d ':' -f 5`"
  if [ "x$BTRFS" = "xbtrfs" ]; then
	BTRFSuuid="`echo ${OS} | cut -d ':' -f 6`"
	BTRFSsubvol="`echo ${OS} | cut -d ':' -f 7`"
  fi

  if [ -z "${LONGNAME}" ] ; then
    LONGNAME="${LABEL}"
  fi

  # os-prober returns text string followed by optional counter
  CLASS="--class $(echo "${LABEL}" | LC_ALL=C sed 's,[[:digit:]]*$,,' | cut -d' ' -f1 | tr 'A-Z' 'a-z' | LC_ALL=C sed 's,[^[:alnum:]_],_,g')"

  gettext_printf "Found %s on %s\n" "${LONGNAME}" "${DEVICE}" >&2

  case ${BOOT} in
    chain)

      case ${LONGNAME} in
	Windows*)
	  if [ -z "$wubi" ]; then
	    if [ -x /usr/share/lupin-support/grub-mkimage ] && \
	       /usr/share/lupin-support/grub-mkimage --test; then
	      wubi=yes
	    else
	      wubi=no
	    fi
	  fi
	  if [ "$wubi" = yes ]; then
	    echo "Skipping ${LONGNAME} on Wubi system" >&2
	    continue
	  fi
	  ;;
      esac

      found_other_os=1
	  onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
      cat << EOF
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
EOF
      save_default_entry | grub_add_tab
      prepare_grub_to_access_device ${DEVICE} | grub_add_tab

      if [ x"`${grub_probe} --device ${DEVICE} --target=partmap`" = xmsdos ]; then
	  cat << EOF
	parttool \${root} hidden-
EOF
      fi

      case ${LONGNAME} in
	Windows\ Vista*|Windows\ 7*|Windows\ Server\ 2008*)
	;;
	*)
	  cat << EOF
	drivemap -s (hd0) \${root}
EOF
	;;
      esac

      cat <<EOF
	chainloader +1
}
EOF
    ;;
    efi)

	found_other_os=1
	EFIPATH=${DEVICE#*@}
	DEVICE=${DEVICE%@*}
	onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
      cat << EOF
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-efi-$(grub_get_device_id "${DEVICE}")' {
EOF
      save_default_entry | sed -e "s/^/\t/"
      prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"

      cat <<EOF
	chainloader ${EFIPATH}
}
EOF
    ;;
    linux)
      if [ "x$BTRFS" = "xbtrfs" ]; then
         LINUXPROBED="`linux-boot-prober btrfs ${BTRFSuuid} ${BTRFSsubvol}  2> /dev/null | tr ' ' '^' | paste -s -d ' '`"
      else
         LINUXPROBED="`linux-boot-prober ${DEVICE} 2> /dev/null | tr ' ' '^' | paste -s -d ' '`"
      fi
      prepare_boot_cache=
      boot_device_id=
      is_top_level=true
      title_correction_code=
      OS="${LONGNAME}"

      for LINUX in ${LINUXPROBED} ; do
        LROOT="`echo ${LINUX} | cut -d ':' -f 1`"
        LBOOT="`echo ${LINUX} | cut -d ':' -f 2`"
        LLABEL="`echo ${LINUX} | cut -d ':' -f 3 | tr '^' ' '`"
        LKERNEL="`echo ${LINUX} | cut -d ':' -f 4`"
        LINITRD="`echo ${LINUX} | cut -d ':' -f 5  | tr '^' ' '`"
        LPARAMS="`echo ${LINUX} | cut -d ':' -f 6- | tr '^' ' '`"

        if [ -z "${LLABEL}" ] ; then
          LLABEL="${LONGNAME}"
        fi

	if [ "${LROOT}" != "${LBOOT}" ]; then
	  LKERNEL="${LKERNEL#/boot}"
	  LINITRD="${LINITRD#/boot}"
	fi

	if [ -z "${prepare_boot_cache}" ]; then
	  prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | grub_add_tab)"
	  [ "${prepare_boot_cache}" ] || continue
	fi

	found_other_os=1
	onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
	recovery_params="$(echo "${LPARAMS}" | grep 'single\|recovery')" || true
	counter=1
	while echo "$used_osprober_linux_ids" | grep 'osprober-gnulinux-$LKERNEL-${recovery_params}-$counter-$boot_device_id' > /dev/null; do
	    counter=$((counter+1));
	done
	if [ -z "$boot_device_id" ]; then
	    boot_device_id="$(grub_get_device_id "${DEVICE}")"
	fi
	used_osprober_linux_ids="$used_osprober_linux_ids 'osprober-gnulinux-$LKERNEL-${recovery_params}-$counter-$boot_device_id'"

	if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
            cat << EOF
menuentry '$(echo "$OS $onstr" | grub_quote)' $CLASS --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$boot_device_id' {
EOF
	    save_default_entry | grub_add_tab
	    printf '%s\n' "${prepare_boot_cache}"
	    cat <<  EOF
	linux ${LKERNEL} ${LPARAMS}
EOF
            if [ -n "${LINITRD}" ] ; then
          cat << EOF
	initrd ${LINITRD}
EOF
            fi
        cat << EOF
}
EOF
	    echo "submenu '$(gettext_printf "Advanced options for %s" "${OS} $onstr" | grub_quote)' \$menuentry_id_option 'osprober-gnulinux-advanced-$boot_device_id' {"
	    is_top_level=false
	fi
	title="${LLABEL} $onstr"
        cat << EOF
	menuentry '$(echo "$title" | grub_quote)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-$LKERNEL-${recovery_params}-$boot_device_id' {
EOF
	save_default_entry | sed -e "s/^/$grub_tab$grub_tab/"
	printf '%s\n' "${prepare_boot_cache}" | grub_add_tab
	cat <<  EOF
		linux ${LKERNEL} ${LPARAMS}
EOF
        if [ -n "${LINITRD}" ] ; then
            cat << EOF
		initrd ${LINITRD}
EOF
        fi
        cat << EOF
	}
EOF
	if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then
	    replacement_title="$(echo "Advanced options for ${OS} $onstr" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')"
	    quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)"
	    title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;"
	    grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")"
	fi
      done
      if [ x"$is_top_level" != xtrue ]; then
	  echo '}'
      fi
      echo "$title_correction_code"
    ;;
    macosx)
      if [ "${UUID}" ]; then
	OSXUUID="${UUID}"
	osx_entry xnu_kernel 32
	osx_entry xnu_kernel64 64
      fi
    ;;
    hurd)
      found_other_os=1
      onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
      cat << EOF
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' {
EOF
      save_default_entry | grub_add_tab
      prepare_grub_to_access_device ${DEVICE} | grub_add_tab
      grub_device="`${grub_probe} --device ${DEVICE} --target=drive`"
      mach_device="`echo "${grub_device}" | sed -e 's/(\(hd.*\),msdos\(.*\))/\1s\2/'`"
      grub_fs="`${grub_probe} --device ${DEVICE} --target=fs`"
      case "${grub_fs}" in
	*fs)	hurd_fs="${grub_fs}" ;;
	*)	hurd_fs="${grub_fs}fs" ;;
      esac
      cat << EOF
	multiboot /boot/gnumach.gz root=device:${mach_device}
	module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\
			--multiboot-command-line='\${kernel-command-line}' \\
			--host-priv-port='\${host-port}' \\
			--device-master-port='\${device-port}' \\
			--exec-server-task='\${exec-task}' -T typed '\${root}' \\
			'\$(task-create)' '\$(task-resume)'
	module /lib/ld.so.1 exec /hurd/exec '\$(exec-task=task-create)'
}
EOF
    ;;
    minix)
	  cat << EOF
menuentry "${LONGNAME} (on ${DEVICE}, Multiboot)" {
EOF
         save_default_entry | sed -e "s/^/\t/"
         prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
	 cat << EOF
	multiboot /boot/image_latest
}
EOF
    ;;
    *)
      # TRANSLATORS: %s is replaced by OS name.
      gettext_printf "%s is not yet supported by grub-mkconfig.\n" "  ${LONGNAME}" >&2
    ;;
  esac
done

adjust_timeout

User avatar
fehlix
Developer
Posts: 12838
Joined: Wed Apr 11, 2018 5:09 pm

Re: update-grub sets wrong kernel root upon second execution

#6 Post by fehlix »

If I understand correctly, you have two mx-linux based installations in an encrypted container on lvm.
And you have a /boot partition that is shared by both installations.
It sounds like this configuration is confusing os-prober and probably you as well.
The first menu entry generated by os-prober + update-grub libs is probably correct.
All other grub menu entries under advanced are generated by update-grub/os-prober,
by analyzing the existing grub.cfg under /boot->/grub/grub.cfg.
However, since both installations use the same grub.cfg, you will find the entries under advanced
that were created within the existing advanced submenu.
Depending on which run the grub.cfg was installed from, the second run will simply repeat the entry from the first run.
This can be a little confusing if you have different kernels installed on both Linux installations, as os-prober could be
further confused and a wrong entry appears in the menu, with a non-existent kernel
which is not present in this installation. But I admit, I always have a separate boot partition for installations
that need an additional boot partition, to avoid this kind of situation.

calm-steam
Posts: 6
Joined: Tue Apr 22, 2025 9:19 pm

Re: update-grub sets wrong kernel root upon second execution

#7 Post by calm-steam »

fehlix wrote: Sat May 03, 2025 3:11 pm If I understand correctly, you have two mx-linux based installations in an encrypted container on lvm.
And you have a /boot partition that is shared by both installations.
It sounds like this configuration is confusing os-prober and probably you as well.
The first menu entry generated by os-prober + update-grub libs is probably correct.
All other grub menu entries under advanced are generated by update-grub/os-prober,
by analyzing the existing grub.cfg under /boot->/grub/grub.cfg.
However, since both installations use the same grub.cfg, you will find the entries under advanced
that were created within the existing advanced submenu.
Depending on which run the grub.cfg was installed from, the second run will simply repeat the entry from the first run.
This can be a little confusing if you have different kernels installed on both Linux installations, as os-prober could be
further confused and a wrong entry appears in the menu, with a non-existent kernel
which is not present in this installation. But I admit, I always have a separate boot partition for installations
that need an additional boot partition, to avoid this kind of situation.
The first menu entry generated by os_prober is not correct on the second run.

I use the same kernels on both installations, but this is irrelevant. I am aware of these issues and the situation of having one single boot partition. I am looking for a solution for this setup.

If I have understood correctly, this still doesn't answer why os_prober is made to behaved in this way. Why is os_prober repeating the entry from the first run? I would rather change it, since it is not correctly identifying and retrieving the information available.

User avatar
fehlix
Developer
Posts: 12838
Joined: Wed Apr 11, 2018 5:09 pm

Re: update-grub sets wrong kernel root upon second execution

#8 Post by fehlix »

calm-steam wrote: Sat May 03, 2025 3:35 pm If I have understood correctly, this still doesn't answer why os_prober is made to behaved in this way. Why is os_prober repeating the entry from the first run? I would rather change it, since it is not correctly identifying and retrieving the information available.
b/c when os prober generates entries for the "other" install, os-prober genrates entries based on the existing grub.cfg, found for the "other install".
Now b/c there is only one grub.cfg, for both, os-prober does not know this, and assume that the grub.cfg, is specific for the "other" install.
Now you got confused, as os-probe too, b/c of this the menu entry confusing.
Suggest create a new /boot partition and use two separate /boot partitions to avoid the menu-entry mess.

calm-steam
Posts: 6
Joined: Tue Apr 22, 2025 9:19 pm

Re: update-grub sets wrong kernel root upon second execution

#9 Post by calm-steam »

fehlix wrote: Sat May 03, 2025 3:58 pm
calm-steam wrote: Sat May 03, 2025 3:35 pm If I have understood correctly, this still doesn't answer why os_prober is made to behaved in this way. Why is os_prober repeating the entry from the first run? I would rather change it, since it is not correctly identifying and retrieving the information available.
b/c when os prober generates entries for the "other" install, os-prober genrates entries based on the existing grub.cfg, found for the "other install".
Now b/c there is only one grub.cfg, for both, os-prober does not know this, and assume that the grub.cfg, is specific for the "other" install.
Now you got confused, as os-probe too, b/c of this the menu entry confusing.
Suggest create a new /boot partition and use two separate /boot partitions to avoid the menu-entry mess.
I would rather not adapt to a bug, and solve it. I think you have not understood correctly.

On the second run, os-prober generates an entry for the second OS with the root of the first OS. Did you see this? This is clearly not how os-prober should behave, right? If it is "copying" the name right, why is it not copying also the path to root?

And rather than installing a new boot partition, I would rather edit a few characters on the menu entry to boot to the other OS when needed. That's what I do now :p

User avatar
fehlix
Developer
Posts: 12838
Joined: Wed Apr 11, 2018 5:09 pm

Re: update-grub sets wrong kernel root upon second execution

#10 Post by fehlix »

calm-steam wrote: Sat May 03, 2025 4:17 pm On the second run, os-prober generates an entry for the second OS with the root of the first OS. Did you see this? This is clearly not how os-prober should behave, right? If it is "copying" the name right, why is it not copying also the path to root?
It takes the grub.cfg for the 2nd os (which is actually for the 1st os, and assumes the grub.cfg is correct build for the 2nd os).
I think os-prober is not prepared for the constellation you setup the partitions with luks+lvm with two os on one shared /boot.
I'm not sure I can help you further. The only advice I can give you try separate /boot, which may help.

Post Reply

Return to “General”