Bug#860028: grub-common: grub-probe gives out of memory when cwd doesn't exist

Russell Coker russell at coker.com.au
Mon Apr 10 13:40:29 UTC 2017


Package: grub-common
Version: 2.02~beta3-5
Severity: normal

mkdir /tmp/foo
cd /tmp/foo
rmdir /tmp/foo
dpkg-reconfigure linux-image-4.9.0-2-amd64

After running the above commands I get lots of expected errors about getcwd,
but also get:
/usr/sbin/grub-probe: error: out of memory.
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1

While there are other issues I don't think it's reasonable for grub-probe to
have an error when the current directory doesn't exist.


-- Package-specific info:

*********************** BEGIN /proc/mounts
/dev/mapper/cryptroot / btrfs rw,seclabel,noatime,ssd,space_cache,subvolid=5,subvol=/ 0 0
*********************** END /proc/mounts

*********************** BEGIN /boot/grub/device.map
(hd0)	/dev/disk/by-id/raid-cryptroot
(hd1)	/dev/disk/by-id/raid-sda2_crypt
(hd2)	/dev/disk/by-id/ata-Samsung_SSD_850_EVO_500GB_S2R9NX0H610979N
*********************** 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 btrfs
set root='hd0'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint='hd0'  0adabe51-2e1c-4c62-a4c1-a72094b5ce94
else
  search --no-floppy --fs-uuid --set=root 0adabe51-2e1c-4c62-a4c1-a72094b5ce94
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=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 btrfs
set root='hd0'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint='hd0'  0adabe51-2e1c-4c62-a4c1-a72094b5ce94
else
  search --no-floppy --fs-uuid --set=root 0adabe51-2e1c-4c62-a4c1-a72094b5ce94
fi
insmod png
if background_image /usr/share/desktop-base/softwaves-theme/grub/grub-4x3.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-0adabe51-2e1c-4c62-a4c1-a72094b5ce94' {
	load_video
	insmod gzio
	if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
	insmod btrfs
	set root='hd0'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint='hd0'  0adabe51-2e1c-4c62-a4c1-a72094b5ce94
	else
	  search --no-floppy --fs-uuid --set=root 0adabe51-2e1c-4c62-a4c1-a72094b5ce94
	fi
	echo	'Loading Linux 4.9.0-2-amd64 ...'
	linux	/boot/vmlinuz-4.9.0-2-amd64 root=UUID=0adabe51-2e1c-4c62-a4c1-a72094b5ce94 ro pcie_aspm=force init=/bin/systemd security=selinux 
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-4.9.0-2-amd64
}
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-0adabe51-2e1c-4c62-a4c1-a72094b5ce94' {
	menuentry 'Debian GNU/Linux, with Linux 4.9.0-2-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.0-2-amd64-advanced-0adabe51-2e1c-4c62-a4c1-a72094b5ce94' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod btrfs
		set root='hd0'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint='hd0'  0adabe51-2e1c-4c62-a4c1-a72094b5ce94
		else
		  search --no-floppy --fs-uuid --set=root 0adabe51-2e1c-4c62-a4c1-a72094b5ce94
		fi
		echo	'Loading Linux 4.9.0-2-amd64 ...'
		linux	/boot/vmlinuz-4.9.0-2-amd64 root=UUID=0adabe51-2e1c-4c62-a4c1-a72094b5ce94 ro pcie_aspm=force init=/bin/systemd security=selinux 
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-4.9.0-2-amd64
	}
	menuentry 'Debian GNU/Linux, with Linux 4.9.0-2-amd64 (sysvinit)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.0-2-amd64-init-sysvinit-0adabe51-2e1c-4c62-a4c1-a72094b5ce94' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod btrfs
		set root='hd0'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint='hd0'  0adabe51-2e1c-4c62-a4c1-a72094b5ce94
		else
		  search --no-floppy --fs-uuid --set=root 0adabe51-2e1c-4c62-a4c1-a72094b5ce94
		fi
		echo	'Loading Linux 4.9.0-2-amd64 ...'
		linux	/boot/vmlinuz-4.9.0-2-amd64 root=UUID=0adabe51-2e1c-4c62-a4c1-a72094b5ce94 ro pcie_aspm=force init=/bin/systemd security=selinux  init=/lib/sysvinit/init
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-4.9.0-2-amd64
	}
	menuentry 'Debian GNU/Linux, with Linux 4.9.0-2-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.0-2-amd64-recovery-0adabe51-2e1c-4c62-a4c1-a72094b5ce94' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod btrfs
		set root='hd0'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint='hd0'  0adabe51-2e1c-4c62-a4c1-a72094b5ce94
		else
		  search --no-floppy --fs-uuid --set=root 0adabe51-2e1c-4c62-a4c1-a72094b5ce94
		fi
		echo	'Loading Linux 4.9.0-2-amd64 ...'
		linux	/boot/vmlinuz-4.9.0-2-amd64 root=UUID=0adabe51-2e1c-4c62-a4c1-a72094b5ce94 ro single pcie_aspm=force init=/bin/systemd security=selinux
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-4.9.0-2-amd64
	}
	menuentry 'Debian GNU/Linux, with Linux 4.9.0-1-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.0-1-amd64-advanced-0adabe51-2e1c-4c62-a4c1-a72094b5ce94' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod btrfs
		set root='hd0'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint='hd0'  0adabe51-2e1c-4c62-a4c1-a72094b5ce94
		else
		  search --no-floppy --fs-uuid --set=root 0adabe51-2e1c-4c62-a4c1-a72094b5ce94
		fi
		echo	'Loading Linux 4.9.0-1-amd64 ...'
		linux	/boot/vmlinuz-4.9.0-1-amd64 root=UUID=0adabe51-2e1c-4c62-a4c1-a72094b5ce94 ro pcie_aspm=force init=/bin/systemd security=selinux 
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-4.9.0-1-amd64
	}
	menuentry 'Debian GNU/Linux, with Linux 4.9.0-1-amd64 (sysvinit)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.0-1-amd64-init-sysvinit-0adabe51-2e1c-4c62-a4c1-a72094b5ce94' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod btrfs
		set root='hd0'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint='hd0'  0adabe51-2e1c-4c62-a4c1-a72094b5ce94
		else
		  search --no-floppy --fs-uuid --set=root 0adabe51-2e1c-4c62-a4c1-a72094b5ce94
		fi
		echo	'Loading Linux 4.9.0-1-amd64 ...'
		linux	/boot/vmlinuz-4.9.0-1-amd64 root=UUID=0adabe51-2e1c-4c62-a4c1-a72094b5ce94 ro pcie_aspm=force init=/bin/systemd security=selinux  init=/lib/sysvinit/init
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-4.9.0-1-amd64
	}
	menuentry 'Debian GNU/Linux, with Linux 4.9.0-1-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.0-1-amd64-recovery-0adabe51-2e1c-4c62-a4c1-a72094b5ce94' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod btrfs
		set root='hd0'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint='hd0'  0adabe51-2e1c-4c62-a4c1-a72094b5ce94
		else
		  search --no-floppy --fs-uuid --set=root 0adabe51-2e1c-4c62-a4c1-a72094b5ce94
		fi
		echo	'Loading Linux 4.9.0-1-amd64 ...'
		linux	/boot/vmlinuz-4.9.0-1-amd64 root=UUID=0adabe51-2e1c-4c62-a4c1-a72094b5ce94 ro single pcie_aspm=force init=/bin/systemd security=selinux
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-4.9.0-1-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+ ###
menuentry "Memory test (memtest86+)" {
	insmod btrfs
	set root='hd0'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint='hd0'  0adabe51-2e1c-4c62-a4c1-a72094b5ce94
	else
	  search --no-floppy --fs-uuid --set=root 0adabe51-2e1c-4c62-a4c1-a72094b5ce94
	fi
	linux16	/boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
	insmod btrfs
	set root='hd0'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint='hd0'  0adabe51-2e1c-4c62-a4c1-a72094b5ce94
	else
	  search --no-floppy --fs-uuid --set=root 0adabe51-2e1c-4c62-a4c1-a72094b5ce94
	fi
	linux16	/boot/memtest86+.bin console=ttyS0,115200n8
}
menuentry "Memory test (memtest86+, experimental multiboot)" {
	insmod btrfs
	set root='hd0'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint='hd0'  0adabe51-2e1c-4c62-a4c1-a72094b5ce94
	else
	  search --no-floppy --fs-uuid --set=root 0adabe51-2e1c-4c62-a4c1-a72094b5ce94
	fi
	multiboot	/boot/memtest86+_multiboot.bin
}
menuentry "Memory test (memtest86+, serial console 115200, experimental multiboot)" {
	insmod btrfs
	set root='hd0'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint='hd0'  0adabe51-2e1c-4c62-a4c1-a72094b5ce94
	else
	  search --no-floppy --fs-uuid --set=root 0adabe51-2e1c-4c62-a4c1-a72094b5ce94
	fi
	multiboot	/boot/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 Mar 20 21:51 ata-Samsung_SSD_850_EVO_500GB_S2R9NX0H610979N -> ../../sda
lrwxrwxrwx. 1 root root 10 Mar 20 21:51 ata-Samsung_SSD_850_EVO_500GB_S2R9NX0H610979N-part1 -> ../../sda1
lrwxrwxrwx. 1 root root 10 Mar 20 21:51 ata-Samsung_SSD_850_EVO_500GB_S2R9NX0H610979N-part2 -> ../../sda2
lrwxrwxrwx. 1 root root 10 Mar 20 21:51 ata-Samsung_SSD_850_EVO_500GB_S2R9NX0H610979N-part3 -> ../../sda3
lrwxrwxrwx. 1 root root 10 Mar 20 21:51 dm-name-cryptroot -> ../../dm-0
lrwxrwxrwx. 1 root root 10 Mar 20 21:51 dm-name-sda2_crypt -> ../../dm-1
lrwxrwxrwx. 1 root root 10 Mar 20 21:51 dm-uuid-CRYPT-LUKS1-d216212659964c67ada3eede9093a7c0-cryptroot -> ../../dm-0
lrwxrwxrwx. 1 root root 10 Mar 20 21:51 dm-uuid-CRYPT-PLAIN-sda2_crypt -> ../../dm-1
lrwxrwxrwx. 1 root root 10 Mar 20 21:51 raid-cryptroot -> ../../dm-0
lrwxrwxrwx. 1 root root 10 Mar 20 21:51 raid-sda2_crypt -> ../../dm-1
lrwxrwxrwx. 1 root root  9 Mar 20 21:51 wwn-0x5002538d40ffb8ed -> ../../sda
lrwxrwxrwx. 1 root root 10 Mar 20 21:51 wwn-0x5002538d40ffb8ed-part1 -> ../../sda1
lrwxrwxrwx. 1 root root 10 Mar 20 21:51 wwn-0x5002538d40ffb8ed-part2 -> ../../sda2
lrwxrwxrwx. 1 root root 10 Mar 20 21:51 wwn-0x5002538d40ffb8ed-part3 -> ../../sda3
*********************** END /dev/disk/by-id

*********************** BEGIN /dev/disk/by-uuid
total 0
lrwxrwxrwx. 1 root root 10 Mar 20 21:51 0adabe51-2e1c-4c62-a4c1-a72094b5ce94 -> ../../dm-0
lrwxrwxrwx. 1 root root 10 Mar 20 21:51 8d6dbf11-2cac-47f2-84bf-06da5ee03432 -> ../../sda1
lrwxrwxrwx. 1 root root 10 Mar 20 21:51 d2162126-5996-4c67-ada3-eede9093a7c0 -> ../../sda3
lrwxrwxrwx. 1 root root 10 Mar 20 21:51 d8505065-cc5f-4ac2-b7b0-2dc980193f36 -> ../../dm-1
*********************** END /dev/disk/by-uuid

-- System Information:
Debian Release: 9.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)

Versions of packages grub-common depends on:
ii  gettext-base        0.19.8.1-2
ii  libc6               2.24-9
ii  libdevmapper1.02.1  2:1.02.137-2
ii  libfreetype6        2.6.3-3.1
ii  libfuse2            2.9.7-1
ii  liblzma5            5.2.2-1.2+b1

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

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

-- no debconf information



More information about the Pkg-grub-devel mailing list