Bug#803995: grub-common: Caching background image conceals original filename when updating

Julian Calaby julian.calaby at gmail.com
Wed Nov 4 02:01:36 UTC 2015


Package: grub-common
Version: 2.02~beta2-29
Severity: minor
Tags: patch

Dear Maintainer,

I use grub to boot Debian off an encrypted disk and as grub doesn't understand LUKS encrypted volumes, 05_debian_theme caches the background image in /boot/grub. It then prints the name of the background image, however the caching mechanism overwrites the first argument of set_background_image(), so it emits:

Found background image: .background_cache.png

instead of

Found background image: /usr/share/images/desktop-base/desktop-grub.png

Which is obviously wrong.

The first patch adds a new variable in Step #5 of set_background_image() to store the original name of the background file and uses it in Step #7.

I thought that appending " (cached)" to the filename when the image is cached would be handy, so a second patch is attached which does this.

These patches have only been lightly tested, so feel free to change them as needed.

Thanks,

Julian Calaby


-- Package-specific info:

*********************** BEGIN /proc/mounts
/dev/dm-0 / ext4 rw,noatime,errors=remount-ro,commit=360,data=ordered 0 0
/dev/sdb1 /boot ext4 rw,noatime,errors=remount-ro,commit=360 0 0
*********************** END /proc/mounts

*********************** BEGIN /boot/grub/device.map
(hd0)	/dev/disk/by-id/ata-SAMSUNG_HD160JJ_P_S0VRJ1KP612297
(hd1)	/dev/disk/by-id/usb-SanDisk_Cruzer_4054900C4EA1DA5C-0:0
(hd2)	/dev/disk/by-id/usb-__7FA11900C306000A-0:0
*********************** END /boot/grub/device.map

*********************** 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 ext2
set root='hd1,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  ebbd7d5e-7a29-4913-ab70-26373caf11bf
else
  search --no-floppy --fs-uuid --set=root ebbd7d5e-7a29-4913-ab70-26373caf11bf
fi
    font="/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_AU
  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/05_debian_theme ###
insmod part_msdos
insmod ext2
set root='hd1,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  ebbd7d5e-7a29-4913-ab70-26373caf11bf
else
  search --no-floppy --fs-uuid --set=root ebbd7d5e-7a29-4913-ab70-26373caf11bf
fi
insmod png
if background_image /grub/.background_cache.png; then
  set color_normal=white/black
  set color_highlight=black/white
else
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi
### 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-035a1c3b-f47f-4c6e-a498-e2dc2adf3505' {
	load_video
	insmod gzio
	if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
	insmod part_msdos
	insmod ext2
	set root='hd1,msdos1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  ebbd7d5e-7a29-4913-ab70-26373caf11bf
	else
	  search --no-floppy --fs-uuid --set=root ebbd7d5e-7a29-4913-ab70-26373caf11bf
	fi
	echo	'Loading Linux 4.2.0-1-686-pae ...'
	linux	/vmlinuz-4.2.0-1-686-pae root=UUID=035a1c3b-f47f-4c6e-a498-e2dc2adf3505 ro rootdelay=10 elevator=deadline quiet
	echo	'Loading initial ramdisk ...'
	initrd	/initrd.img-4.2.0-1-686-pae
}
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-035a1c3b-f47f-4c6e-a498-e2dc2adf3505' {
	menuentry 'Debian GNU/Linux, with Linux 4.2.0-1-686-pae' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.2.0-1-686-pae-advanced-035a1c3b-f47f-4c6e-a498-e2dc2adf3505' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_msdos
		insmod ext2
		set root='hd1,msdos1'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  ebbd7d5e-7a29-4913-ab70-26373caf11bf
		else
		  search --no-floppy --fs-uuid --set=root ebbd7d5e-7a29-4913-ab70-26373caf11bf
		fi
		echo	'Loading Linux 4.2.0-1-686-pae ...'
		linux	/vmlinuz-4.2.0-1-686-pae root=UUID=035a1c3b-f47f-4c6e-a498-e2dc2adf3505 ro rootdelay=10 elevator=deadline quiet
		echo	'Loading initial ramdisk ...'
		initrd	/initrd.img-4.2.0-1-686-pae
	}
	menuentry 'Debian GNU/Linux, with Linux 4.2.0-1-686-pae (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.2.0-1-686-pae-recovery-035a1c3b-f47f-4c6e-a498-e2dc2adf3505' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_msdos
		insmod ext2
		set root='hd1,msdos1'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  ebbd7d5e-7a29-4913-ab70-26373caf11bf
		else
		  search --no-floppy --fs-uuid --set=root ebbd7d5e-7a29-4913-ab70-26373caf11bf
		fi
		echo	'Loading Linux 4.2.0-1-686-pae ...'
		linux	/vmlinuz-4.2.0-1-686-pae root=UUID=035a1c3b-f47f-4c6e-a498-e2dc2adf3505 ro single rootdelay=10 elevator=deadline
		echo	'Loading initial ramdisk ...'
		initrd	/initrd.img-4.2.0-1-686-pae
	}
}

### 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+ ###
menuentry "Memory test (memtest86+)" {
	insmod part_msdos
	insmod ext2
	set root='hd1,msdos1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  ebbd7d5e-7a29-4913-ab70-26373caf11bf
	else
	  search --no-floppy --fs-uuid --set=root ebbd7d5e-7a29-4913-ab70-26373caf11bf
	fi
	linux16	/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
	insmod part_msdos
	insmod ext2
	set root='hd1,msdos1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  ebbd7d5e-7a29-4913-ab70-26373caf11bf
	else
	  search --no-floppy --fs-uuid --set=root ebbd7d5e-7a29-4913-ab70-26373caf11bf
	fi
	linux16	/memtest86+.bin console=ttyS0,115200n8
}
menuentry "Memory test (memtest86+, experimental multiboot)" {
	insmod part_msdos
	insmod ext2
	set root='hd1,msdos1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  ebbd7d5e-7a29-4913-ab70-26373caf11bf
	else
	  search --no-floppy --fs-uuid --set=root ebbd7d5e-7a29-4913-ab70-26373caf11bf
	fi
	multiboot	/memtest86+_multiboot.bin
}
menuentry "Memory test (memtest86+, serial console 115200, experimental multiboot)" {
	insmod part_msdos
	insmod ext2
	set root='hd1,msdos1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  ebbd7d5e-7a29-4913-ab70-26373caf11bf
	else
	  search --no-floppy --fs-uuid --set=root ebbd7d5e-7a29-4913-ab70-26373caf11bf
	fi
	multiboot	/memtest86+_multiboot.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
### 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 /dev/disk/by-id
total 0
lrwxrwxrwx 1 root root  9 Nov  4 09:08 ata-PIONEER_DVD-RW_DVR-115D -> ../../sr0
lrwxrwxrwx 1 root root  9 Nov  4 09:08 ata-WDC_WD3200AAKS-00TMA0_WD-WCAS60007067 -> ../../sda
lrwxrwxrwx 1 root root 10 Nov  4 09:08 ata-WDC_WD3200AAKS-00TMA0_WD-WCAS60007067-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Nov  4 09:08 ata-WDC_WD3200AAKS-00TMA0_WD-WCAS60007067-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Nov  4 09:08 ata-WDC_WD3200AAKS-00TMA0_WD-WCAS60007067-part5 -> ../../sda5
lrwxrwxrwx 1 root root 10 Nov  4 09:08 dm-name-root -> ../../dm-0
lrwxrwxrwx 1 root root 10 Nov  4 09:08 dm-uuid-CRYPT-LUKS1-5ce1613777314a29b99d136aa1ab14b1-root -> ../../dm-0
lrwxrwxrwx 1 root root  9 Nov  4 09:08 usb-SanDisk_Ultra_4C530001160704115471-0:0 -> ../../sdb
lrwxrwxrwx 1 root root 10 Nov  4 09:08 usb-SanDisk_Ultra_4C530001160704115471-0:0-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Nov  4 09:08 usb-SanDisk_Ultra_4C530001160704115471-0:0-part2 -> ../../sdb2
lrwxrwxrwx 1 root root  9 Nov  4 09:08 wwn-0x50014ee100338ecb -> ../../sda
lrwxrwxrwx 1 root root 10 Nov  4 09:08 wwn-0x50014ee100338ecb-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Nov  4 09:08 wwn-0x50014ee100338ecb-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Nov  4 09:08 wwn-0x50014ee100338ecb-part5 -> ../../sda5
*********************** END /dev/disk/by-id

*********************** BEGIN /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 10 Nov  4 09:08 035a1c3b-f47f-4c6e-a498-e2dc2adf3505 -> ../../dm-0
lrwxrwxrwx 1 root root 10 Nov  4 09:08 5ce16137-7731-4a29-b99d-136aa1ab14b1 -> ../../sdb2
lrwxrwxrwx 1 root root 10 Nov  4 09:08 9EB41DC0B41D9BB9 -> ../../sda1
lrwxrwxrwx 1 root root 10 Nov  4 09:08 ebbd7d5e-7a29-4913-ab70-26373caf11bf -> ../../sdb1
lrwxrwxrwx 1 root root 10 Nov  4 09:08 f4c409bb-92b9-4ffc-87d0-afffcad4857a -> ../../sda5
*********************** END /dev/disk/by-uuid

-- System Information:
Debian Release: stretch/sid
  APT prefers testing-proposed-updates
  APT policy: (500, 'testing-proposed-updates'), (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 4.2.0-1-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_AU.utf8, LC_CTYPE=en_AU.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages grub-common depends on:
ii  gettext-base        0.19.6-1
ii  libc6               2.19-22
ii  libdevmapper1.02.1  2:1.02.104-1
ii  libfreetype6        2.6-2
ii  libfuse2            2.9.4-1
ii  liblzma5            5.1.1alpha+20120614-2.1

Versions of packages grub-common recommends:
pn  os-prober  <none>

Versions of packages grub-common suggests:
ii  console-setup  1.134
ii  desktop-base   8.0.2
pn  grub-emu       <none>
pn  multiboot-doc  <none>
pn  xorriso        <none>

-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-background-caching-overwriting-image-name.patch
Type: text/x-diff
Size: 1275 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20151104/41657ea6/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Inform-user-when-background-images-are-cached.patch
Type: text/x-diff
Size: 757 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20151104/41657ea6/attachment-0001.patch>


More information about the Pkg-grub-devel mailing list