Subject: bug#893: grub-efi-amd64: output of cmdpath environment variable is empty

From: Paul Geraedts <[email-masked]>
Date: Sat, 31 May 2025 14:36:23 +0200

Package: grub-efi-amd64
Version: 2.12-1~bpo12+1
Severity: normal
X-Debbugs-Cc: [email-masked]

Dear Maintainer,

As bootloader I use GRUB standalone (from memdisk) portable. To reach the (1st)
grub.cfg file I use the cmdpath environment variable that GRUB offers [1].
Before, in case of GRUB 2.06-13+deb12u1, its output was as expected:
I expect "(hd0,gpt1)/EFI/BOOT". Now, in case of GRUB 2.12-1~bpo12+1,
its output is empty. I regard this as a regression.
I can confirm that the latest compiled GRUB source from git (GRUB 2.13)
works as expected. Thank you in advance for your time.

[1] https://www.gnu.org/software/grub/manual/grub/html_node/cmdpath.html

*********************** BEGIN grub-early.cfg
configfile $cmdpath/../../boot/grub/grub.cfg
*********************** END grub-early.cfg

*********************** BEGIN grub.sh
grub-mkstandalone -o bootx64.efi -O x86_64-efi --compress=xz --modules="part_gpt part_msdos all_video" -v "/boot/grub/grub.cfg=./grub-early.cfg"
*********************** END grub.sh

*********************** BEGIN /boot/grub/grub.cfg _[1st on (hd0,gpt1)]_
set default=1
if [ "${recordfail}" = 1 ] ; then
  set timeout=30
else
  if [ x$feature_timeout_style = xy ] ; then
    set timeout_style=hidden
    set timeout=1
  # Fallback hidden-timeout code in case the timeout_style feature is
  # unavailable.
  elif sleep --interruptible 1 ; then
    set timeout=0
  fi
fi

menuentry "UEFI Shell" {
	set root='hd0,gpt1'
	chainloader /boot/edk2-shell/x64/Shell_Full.efi
}
menuentry "Devuan GNU/Linux @ root1" {
	search --label --set=root --no-floppy root1
	configfile /@/boot/grub/grub.cfg
}
menuentry "Devuan GNU/Linux @ root2" {
	search --label --set=root --no-floppy root2
	configfile /@/boot/grub/grub.cfg
}
menuentry "iPXE" {
	set root='hd0,gpt1'
	chainloader /boot/ipxe/ipxe.efi
}
menuentry "Memtest86+" {
	set root='hd0,gpt1'
	chainloader /boot/memtest86+/memtest64.efi
}
menuentry "Exit GNU GRUB" {
	exit
}
menuentry "Reboot" {
	echo "System rebooting..."
	reboot
}
menuentry "Shutdown" {
	echo "System shutting down..."
	halt
}
menuentry "System setup" {
	fwsetup
}
*********************** END grub.cfg

-- Package-specific info:

*********************** BEGIN /proc/mounts
/dev/nvme0n1p5 / btrfs rw,noatime,nodiratime,ssd,discard=async,space_cache=v2,subvolid=256,subvol=/@ 0 0
/dev/nvme0n1p1 /boot/efi vfat rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/nvme0n1p7 /home btrfs rw,noatime,nodiratime,ssd,discard=async,space_cache=v2,subvolid=256,subvol=/@home 0 0
/dev/nvme0n1p7 /local btrfs rw,noatime,nodiratime,ssd,discard=async,space_cache=v2,subvolid=258,subvol=/@local 0 0
*********************** END /proc/mounts

*********************** BEGIN /boot/grub/grub.cfg _[2nd on (hd0,gpt5)]_
#
# 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
}

terminal_input console
terminal_output console
if [ "${recordfail}" = 1 ] ; then
  set timeout=30
else
  if [ x$feature_timeout_style = xy ] ; then
    set timeout_style=hidden
    set timeout=1
  # Fallback hidden-timeout code in case the timeout_style feature is
  # unavailable.
  elif sleep --interruptible 1 ; then
    set timeout=0
  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=800x1280
export linux_gfx_mode
menuentry 'Devuan GNU/Linux' --class devuan --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-cf1b7843-392f-413c-ab2f-fa8bfa5d90e7' {
	load_video
	gfxmode $linux_gfx_mode
	insmod gzio
	if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
	insmod part_gpt
	insmod btrfs
	search --no-floppy --fs-uuid --set=root cf1b7843-392f-413c-ab2f-fa8bfa5d90e7
	linux	/@/boot/vmlinuz-6.12.22+bpo-amd64 root=UUID=cf1b7843-392f-413c-ab2f-fa8bfa5d90e7 ro rootflags=subvol=@ fbcon=rotate:1 
	initrd	/@/boot/initrd.img-6.12.22+bpo-amd64
}
submenu 'Advanced options for Devuan GNU/Linux' $menuentry_id_option 'gnulinux-advanced-cf1b7843-392f-413c-ab2f-fa8bfa5d90e7' {
	menuentry 'Devuan GNU/Linux, with Linux 6.12.22+bpo-amd64' --class devuan --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.12.22+bpo-amd64-advanced-cf1b7843-392f-413c-ab2f-fa8bfa5d90e7' {
		load_video
		gfxmode $linux_gfx_mode
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_gpt
		insmod btrfs
		search --no-floppy --fs-uuid --set=root cf1b7843-392f-413c-ab2f-fa8bfa5d90e7
		echo	'Loading Linux 6.12.22+bpo-amd64 ...'
		linux	/@/boot/vmlinuz-6.12.22+bpo-amd64 root=UUID=cf1b7843-392f-413c-ab2f-fa8bfa5d90e7 ro rootflags=subvol=@ fbcon=rotate:1 
		echo	'Loading initial ramdisk ...'
		initrd	/@/boot/initrd.img-6.12.22+bpo-amd64
	}
	menuentry 'Devuan GNU/Linux, with Linux 6.12.22+bpo-amd64 (recovery mode)' --class devuan --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.12.22+bpo-amd64-recovery-cf1b7843-392f-413c-ab2f-fa8bfa5d90e7' {
		load_video
		gfxmode $linux_gfx_mode
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_gpt
		insmod btrfs
		search --no-floppy --fs-uuid --set=root cf1b7843-392f-413c-ab2f-fa8bfa5d90e7
		echo	'Loading Linux 6.12.22+bpo-amd64 ...'
		linux	/@/boot/vmlinuz-6.12.22+bpo-amd64 root=UUID=cf1b7843-392f-413c-ab2f-fa8bfa5d90e7 ro single single dis_ucode_ldr rootflags=subvol=@ fbcon=rotate:1
		echo	'Loading initial ramdisk ...'
		initrd	/@/boot/initrd.img-6.12.22+bpo-amd64
	}
	menuentry 'Devuan GNU/Linux, with Linux 6.12.12+bpo-amd64' --class devuan --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.12.12+bpo-amd64-advanced-cf1b7843-392f-413c-ab2f-fa8bfa5d90e7' {
		load_video
		gfxmode $linux_gfx_mode
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_gpt
		insmod btrfs
		search --no-floppy --fs-uuid --set=root cf1b7843-392f-413c-ab2f-fa8bfa5d90e7
		echo	'Loading Linux 6.12.12+bpo-amd64 ...'
		linux	/@/boot/vmlinuz-6.12.12+bpo-amd64 root=UUID=cf1b7843-392f-413c-ab2f-fa8bfa5d90e7 ro rootflags=subvol=@ fbcon=rotate:1 
		echo	'Loading initial ramdisk ...'
		initrd	/@/boot/initrd.img-6.12.12+bpo-amd64
	}
	menuentry 'Devuan GNU/Linux, with Linux 6.12.12+bpo-amd64 (recovery mode)' --class devuan --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.12.12+bpo-amd64-recovery-cf1b7843-392f-413c-ab2f-fa8bfa5d90e7' {
		load_video
		gfxmode $linux_gfx_mode
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_gpt
		insmod btrfs
		search --no-floppy --fs-uuid --set=root cf1b7843-392f-413c-ab2f-fa8bfa5d90e7
		echo	'Loading Linux 6.12.12+bpo-amd64 ...'
		linux	/@/boot/vmlinuz-6.12.12+bpo-amd64 root=UUID=cf1b7843-392f-413c-ab2f-fa8bfa5d90e7 ro single single dis_ucode_ldr rootflags=subvol=@ fbcon=rotate:1
		echo	'Loading initial ramdisk ...'
		initrd	/@/boot/initrd.img-6.12.12+bpo-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/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/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 ###
*********************** END /boot/grub/grub.cfg

*********************** BEGIN /proc/mdstat
cat: /proc/mdstat: No such file or directory
*********************** END /proc/mdstat

*********************** BEGIN LVM
*********************** END LVM

*********************** BEGIN /dev/disk/by-id
total 0
lrwxrwxrwx 1 root root 13 May 31 13:50 nvme-TS512GMTE400S_I216680586 -> ../../nvme0n1
lrwxrwxrwx 1 root root 15 May 31 13:50 nvme-TS512GMTE400S_I216680586-part1 -> ../../nvme0n1p1
lrwxrwxrwx 1 root root 15 May 31 13:50 nvme-TS512GMTE400S_I216680586-part2 -> ../../nvme0n1p2
lrwxrwxrwx 1 root root 15 May 31 13:50 nvme-TS512GMTE400S_I216680586-part5 -> ../../nvme0n1p5
lrwxrwxrwx 1 root root 15 May 31 13:50 nvme-TS512GMTE400S_I216680586-part6 -> ../../nvme0n1p6
lrwxrwxrwx 1 root root 15 May 31 13:50 nvme-TS512GMTE400S_I216680586-part7 -> ../../nvme0n1p7
lrwxrwxrwx 1 root root 13 May 31 13:50 nvme-eui.00000000000000007c354852255b628a -> ../../nvme0n1
lrwxrwxrwx 1 root root 15 May 31 13:50 nvme-eui.00000000000000007c354852255b628a-part1 -> ../../nvme0n1p1
lrwxrwxrwx 1 root root 15 May 31 13:50 nvme-eui.00000000000000007c354852255b628a-part2 -> ../../nvme0n1p2
lrwxrwxrwx 1 root root 15 May 31 13:50 nvme-eui.00000000000000007c354852255b628a-part5 -> ../../nvme0n1p5
lrwxrwxrwx 1 root root 15 May 31 13:50 nvme-eui.00000000000000007c354852255b628a-part6 -> ../../nvme0n1p6
lrwxrwxrwx 1 root root 15 May 31 13:50 nvme-eui.00000000000000007c354852255b628a-part7 -> ../../nvme0n1p7
*********************** END /dev/disk/by-id

*********************** BEGIN /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 15 May 31 13:50 64755244-343e-475f-b01e-1054ebdbb5c5 -> ../../nvme0n1p2
lrwxrwxrwx 1 root root 15 May 31 13:50 A1B9-8EBD -> ../../nvme0n1p1
lrwxrwxrwx 1 root root 15 May 31 13:50 cf1b7843-392f-413c-ab2f-fa8bfa5d90e7 -> ../../nvme0n1p5
lrwxrwxrwx 1 root root 15 May 31 13:50 ed96bde7-6169-4447-a0ce-401411d4f6fc -> ../../nvme0n1p6
lrwxrwxrwx 1 root root 15 May 31 13:50 fef41de8-f490-49d7-89c9-01207b5b2272 -> ../../nvme0n1p7
*********************** END /dev/disk/by-uuid

-- System Information:
Distributor ID:	Devuan
Description:	Devuan GNU/Linux 5 (daedalus)
Release:	5
Codename:	daedalus
Architecture: x86_64

Kernel: Linux 6.12.22+bpo-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
LSM: AppArmor: enabled

Versions of packages grub-efi-amd64 depends on:
ii  debconf [debconf-2.0]  1.5.82
ii  grub-efi-amd64-bin     2.12-1~bpo12+1
ii  grub2-common           2.12-1~bpo12+1
ii  ucf                    3.0043+nmu1+deb12u1

grub-efi-amd64 recommends no packages.

grub-efi-amd64 suggests no packages.

-- debconf information:
  grub2/force_efi_extra_removable: false
  grub2/enable_os_prober: false
* grub2/linux_cmdline: fbcon=rotate:1
  grub2/kfreebsd_cmdline:
* grub2/gnumach_cmdline:
  grub2/kfreebsd_cmdline_default: quiet
  grub2/update_nvram: true
* grub2/linux_cmdline_default:

---

From: Mark Hindley <[email-masked]>
Date: Mon, 2 Jun 2025 07:34:59 +0100

Control: forwarded -1 https://bugs.debian.org/1099701
Control: tags -1 debian

Paul,

Thanks for this.

> Version: 2.12-1~bpo12+1

Devuan doesn't fork src:grub2 and uses Debian's packages directly without
recompilation. This issue appears to be the same as Debian #1099191. Please add
your voice there to get it resolved.

Thanks

Mark