Bug#1094201: grub2-common: Grub does not expand $variable on cmdline when using a submenu (but does on main menus)
Yoann Congal
yoann.congal at smile.fr
Sat Jan 25 23:07:38 GMT 2025
Package: grub2-common
Version: 2.12-1~bpo12+1
Severity: important
X-Debbugs-Cc: yoann.congal at smile.fr
Dear Maintainer,
I've notice that using $variable expansion on kernel command line works
only when using the main menu but not on submenus.
For exemple, in my current grub.cfg (provided in full bellow by
reportbug):
set tuned_params="skew_tick=1 isolcpus=managed_irq,domain, intel_pstate=disable nosoftlockup tsc=reliable"
...
menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-67104532-64c9-4656-9ccd-23cf07fbe9b2' {
linux /vmlinuz-6.1.0-30-amd64 root=/dev/mapper/debian--vm--vg-root ro quiet $tuned_params
...
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-67104532-64c9-4656-9ccd-23cf07fbe9b2' {
menuentry 'Debian GNU/Linux, with Linux 6.1.0-30-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.1.0-30-amd64-advanced-67104532-64c9-4656-9ccd-23cf07fbe9b2' {
linux /vmlinuz-6.1.0-30-amd64 root=/dev/mapper/debian--vm--vg-root ro quiet $tuned_params
...
Notice how $tuned_params is present in both menuentry.
When booting the firt entry, I got the tuned parameters in my kernel cmdline.
But, when I boot the second option, in the submenu (which should be the same behavior), I don't have the tuned parameters in my kernel cmdline:
/proc/cmdline:"BOOT_IMAGE=/vmlinuz-6.1.0-30-amd64 root=/dev/mapper/debian--vm--vg-root ro quiet"
Note: I do not have variables defined in my grubenv.
I have tested this with stable and backports
-- Package-specific info:
*********************** BEGIN /proc/mounts
/dev/mapper/debian--vm--vg-root / ext4 rw,relatime,errors=remount-ro 0 0
/dev/vda1 /boot ext2 rw,relatime 0 0
*********************** END /proc/mounts
*********************** BEGIN /boot/grub/grub.cfg
#
# 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_msdos
insmod lvm
insmod ext2
set root='lvmid/fTfDi0-llcy-xIAW-katk-gwgc-1Vcv-lPrMp0/D2oH1c-9E1r-G0Hi-H9UP-Ti29-oID5-MZfXYC'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='lvmid/fTfDi0-llcy-xIAW-katk-gwgc-1Vcv-lPrMp0/D2oH1c-9E1r-G0Hi-H9UP-Ti29-oID5-MZfXYC' 67104532-64c9-4656-9ccd-23cf07fbe9b2
else
search --no-floppy --fs-uuid --set=root 67104532-64c9-4656-9ccd-23cf07fbe9b2
fi
font="/usr/share/grub/unicode.pf2"
fi
if loadfont $font ; then
set gfxmode=auto
load_video
insmod gfxterm
set locale_dir=$prefix/locale
set lang=fr_FR
insmod gettext
fi
terminal_output gfxterm
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/00_tuned ###
set tuned_params="skew_tick=1 isolcpus=managed_irq,domain, intel_pstate=disable nosoftlockup tsc=reliable"
set tuned_initrd=""
### END /etc/grub.d/00_tuned ###
### 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 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-67104532-64c9-4656-9ccd-23cf07fbe9b2' {
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
search --no-floppy --fs-uuid --set=root f3cf3b43-faa7-431d-8327-471212829b96
echo 'Loading Linux 6.1.0-30-amd64 ...'
linux /vmlinuz-6.1.0-30-amd64 root=/dev/mapper/debian--vm--vg-root ro quiet $tuned_params
echo 'Loading initial ramdisk ...'
initrd /initrd.img-6.1.0-30-amd64 $tuned_initrd
}
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-67104532-64c9-4656-9ccd-23cf07fbe9b2' {
menuentry 'Debian GNU/Linux, with Linux 6.1.0-30-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.1.0-30-amd64-advanced-67104532-64c9-4656-9ccd-23cf07fbe9b2' {
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
search --no-floppy --fs-uuid --set=root f3cf3b43-faa7-431d-8327-471212829b96
echo 'Loading Linux 6.1.0-30-amd64 ...'
linux /vmlinuz-6.1.0-30-amd64 root=/dev/mapper/debian--vm--vg-root ro quiet $tuned_params
echo 'Loading initial ramdisk ...'
initrd /initrd.img-6.1.0-30-amd64 $tuned_initrd
}
menuentry 'Debian GNU/Linux, with Linux 6.1.0-30-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.1.0-30-amd64-recovery-67104532-64c9-4656-9ccd-23cf07fbe9b2' {
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
search --no-floppy --fs-uuid --set=root f3cf3b43-faa7-431d-8327-471212829b96
echo 'Loading Linux 6.1.0-30-amd64 ...'
linux /vmlinuz-6.1.0-30-amd64 root=/dev/mapper/debian--vm--vg-root ro single single dis_ucode_ldr $tuned_params
echo 'Loading initial ramdisk ...'
initrd /initrd.img-6.1.0-30-amd64 $tuned_initrd
}
menuentry 'Debian GNU/Linux, with Linux 6.1.0-29-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.1.0-29-amd64-advanced-67104532-64c9-4656-9ccd-23cf07fbe9b2' {
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
search --no-floppy --fs-uuid --set=root f3cf3b43-faa7-431d-8327-471212829b96
echo 'Loading Linux 6.1.0-29-amd64 ...'
linux /vmlinuz-6.1.0-29-amd64 root=/dev/mapper/debian--vm--vg-root ro quiet $tuned_params
echo 'Loading initial ramdisk ...'
initrd /initrd.img-6.1.0-29-amd64 $tuned_initrd
}
menuentry 'Debian GNU/Linux, with Linux 6.1.0-29-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.1.0-29-amd64-recovery-67104532-64c9-4656-9ccd-23cf07fbe9b2' {
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
search --no-floppy --fs-uuid --set=root f3cf3b43-faa7-431d-8327-471212829b96
echo 'Loading Linux 6.1.0-29-amd64 ...'
linux /vmlinuz-6.1.0-29-amd64 root=/dev/mapper/debian--vm--vg-root ro single single dis_ucode_ldr $tuned_params
echo 'Loading initial ramdisk ...'
initrd /initrd.img-6.1.0-29-amd64 $tuned_initrd
}
}
### 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 ###
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/30_uefi-firmware ###
if [ "$grub_platform" = "efi" ]; then
fwsetup --is-supported
if [ "$?" = 0 ]; then
menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
fwsetup
}
fi
fi
### 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 ###
*********************** END /boot/grub/grub.cfg
*********************** BEGIN /proc/mdstat
cat: /proc/mdstat: No such file or directory
*********************** END /proc/mdstat
*********************** BEGIN LVM
--- Volume group ---
VG Name debian-vm-vg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size <19.52 GiB
PE Size 4.00 MiB
Total PE 4997
Alloc PE / Size 4997 / <19.52 GiB
Free PE / Size 0 / 0
VG UUID fTfDi0-llcy-xIAW-katk-gwgc-1Vcv-lPrMp0
--- Physical volume ---
PV Name /dev/vda5
VG Name debian-vm-vg
PV Size 19.52 GiB / not usable 2.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 4997
Free PE 0
Allocated PE 4997
PV UUID rqGQ7a-e6ZP-h2Ql-0v2F-A62i-QZs4-YmyFJb
--- Logical volume ---
LV Path /dev/debian-vm-vg/root
LV Name root
VG Name debian-vm-vg
LV UUID D2oH1c-9E1r-G0Hi-H9UP-Ti29-oID5-MZfXYC
LV Write Access read/write
LV Creation host, time debian-vm, 2025-01-25 22:47:44 +0100
LV Status available
# open 1
LV Size 18.56 GiB
Current LE 4752
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/debian-vm-vg/swap_1
LV Name swap_1
VG Name debian-vm-vg
LV UUID mVu1az-f8q1-aYvS-V1UM-Jmq2-Foh2-6Heyr7
LV Write Access read/write
LV Creation host, time debian-vm, 2025-01-25 22:47:44 +0100
LV Status available
# open 2
LV Size 980.00 MiB
Current LE 245
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
*********************** END LVM
*********************** BEGIN /dev/disk/by-id
total 0
lrwxrwxrwx 1 root root 9 Jan 25 23:36 ata-QEMU_DVD-ROM_QM00001 -> ../../sr0
lrwxrwxrwx 1 root root 10 Jan 25 23:36 dm-name-debian--vm--vg-root -> ../../dm-0
lrwxrwxrwx 1 root root 10 Jan 25 23:36 dm-name-debian--vm--vg-swap_1 -> ../../dm-1
lrwxrwxrwx 1 root root 10 Jan 25 23:36 dm-uuid-LVM-fTfDi0llcyxIAWkatkgwgc1VcvlPrMp0D2oH1c9E1rG0HiH9UPTi29oID5MZfXYC -> ../../dm-0
lrwxrwxrwx 1 root root 10 Jan 25 23:36 dm-uuid-LVM-fTfDi0llcyxIAWkatkgwgc1VcvlPrMp0mVu1azf8q1aYvSV1UMJmq2Foh26Heyr7 -> ../../dm-1
lrwxrwxrwx 1 root root 10 Jan 25 23:36 lvm-pv-uuid-rqGQ7a-e6ZP-h2Ql-0v2F-A62i-QZs4-YmyFJb -> ../../vda5
*********************** END /dev/disk/by-id
*********************** BEGIN /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 9 Jan 25 23:36 2025-01-11-10-58-01-00 -> ../../sr0
lrwxrwxrwx 1 root root 10 Jan 25 23:36 67104532-64c9-4656-9ccd-23cf07fbe9b2 -> ../../dm-0
lrwxrwxrwx 1 root root 10 Jan 25 23:36 e65c196c-4f27-47cd-85a3-73e78ae08c34 -> ../../dm-1
lrwxrwxrwx 1 root root 10 Jan 25 23:36 f3cf3b43-faa7-431d-8327-471212829b96 -> ../../vda1
*********************** END /dev/disk/by-uuid
-- System Information:
Debian Release: 12.9
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 6.1.0-30-amd64 (SMP w/2 CPU threads; PREEMPT)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages grub2-common depends on:
ii dpkg 1.21.22
ii grub-common 2.12-1~bpo12+1
ii libc6 2.36-9+deb12u9
ii libdevmapper1.02.1 2:1.02.185-2
ii libefiboot1 37-6
ii libefivar1 37-6
ii liblzma5 5.4.1-0.2
grub2-common recommends no packages.
grub2-common suggests no packages.
-- no debconf information
More information about the Pkg-grub-devel
mailing list