Bug#838688: update-grub: backup kernels should be sorted after new kernels

Zack Weinberg zackw at panix.com
Fri Sep 23 16:41:37 UTC 2016


Package: grub2-common
Version: 2.02~beta2-36
Severity: normal
File: /usr/sbin/update-grub

When you upgrade a packaged Debian kernel, the old kernel and initrd are
preserved under names ending with `.bak`.  update-grub should sort these
after the new kernel when generating the menu (so the default is to boot
into the new kernel).  It used to do this, but quite recently it has
started sorting the backup kernels *first*, which is wrong.  Observe:

(Reading database ... 257654 files and directories currently installed.)
Preparing to unpack .../linux-image-4.7.0-1-amd64_4.7.4-2_amd64.deb ...
Unpacking linux-image-4.7.0-1-amd64 (4.7.4-2) over (4.7.2-1+s1) ...
Setting up linux-image-4.7.0-1-amd64 (4.7.4-2) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-4.7.0-1-amd64
/etc/kernel/postinst.d/zz-update-grub:
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-4.7.0-1-amd64.bak
Found initrd image: /boot/initrd.img-4.7.0-1-amd64.bak
Found linux image: /boot/vmlinuz-4.7.0-1-amd64
Found initrd image: /boot/initrd.img-4.7.0-1-amd64
Adding boot menu entry for EFI firmware configuration
done

And you will see in the grub.cfg below that the default kernel is
/boot/vmlinuz-4.7.0-1-amd64.bak instead of vmlinuz-4.7.0-1-amd64.

(Note: My configuration is slightly weird in that the EFI partition
is mounted at /boot, not /boot/EFI.)

zw

-- Package-specific info:

*********************** BEGIN /proc/mounts
/dev/sda2 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
/dev/sda1 /boot vfat rw,relatime,fmask=0033,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,tz=UTC,errors=remount-ro 0 0
/dev/bcache0 /home xfs rw,nosuid,nodev,relatime,attr2,inode64,sunit=1024,swidth=3072,noquota 0 0
/dev/bcache0 /var xfs rw,nosuid,nodev,relatime,attr2,inode64,sunit=1024,swidth=3072,noquota 0 0
*********************** END /proc/mounts

*********************** BEGIN /boot/grub/device.map
(hd0)	/dev/disk/by-id/ata-CT120BX100SSD1_1511F00440EA
(hd1)	/dev/disk/by-id/ata-TOSHIBA_DT01ACA300_256D4LUGS
(hd2)	/dev/disk/by-id/ata-TOSHIBA_DT01ACA300_256D4NPGS
*********************** 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_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 --hint='hd0,gpt2'  33486f1a-7abf-4d96-8a1f-8194594f6a92
else
  search --no-floppy --fs-uuid --set=root 33486f1a-7abf-4d96-8a1f-8194594f6a92
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_US
  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_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 --hint='hd0,gpt2'  33486f1a-7abf-4d96-8a1f-8194594f6a92
else
  search --no-floppy --fs-uuid --set=root 33486f1a-7abf-4d96-8a1f-8194594f6a92
fi
insmod png
if background_image /usr/share/images/desktop-base/lines-grub-1920x1080.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-33486f1a-7abf-4d96-8a1f-8194594f6a92' {
	load_video
	insmod gzio
	if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
	insmod part_gpt
	insmod fat
	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 --hint='hd0,gpt1'  71EA-3F49
	else
	  search --no-floppy --fs-uuid --set=root 71EA-3F49
	fi
	echo	'Loading Linux 4.7.0-1-amd64.bak ...'
	linux	/vmlinuz-4.7.0-1-amd64.bak root=UUID=33486f1a-7abf-4d96-8a1f-8194594f6a92 ro  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/initrd.img-4.7.0-1-amd64.bak
}
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-33486f1a-7abf-4d96-8a1f-8194594f6a92' {
	menuentry 'Debian GNU/Linux, with Linux 4.7.0-1-amd64.bak' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.7.0-1-amd64.bak-advanced-33486f1a-7abf-4d96-8a1f-8194594f6a92' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_gpt
		insmod fat
		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 --hint='hd0,gpt1'  71EA-3F49
		else
		  search --no-floppy --fs-uuid --set=root 71EA-3F49
		fi
		echo	'Loading Linux 4.7.0-1-amd64.bak ...'
		linux	/vmlinuz-4.7.0-1-amd64.bak root=UUID=33486f1a-7abf-4d96-8a1f-8194594f6a92 ro  quiet
		echo	'Loading initial ramdisk ...'
		initrd	/initrd.img-4.7.0-1-amd64.bak
	}
	menuentry 'Debian GNU/Linux, with Linux 4.7.0-1-amd64.bak (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.7.0-1-amd64.bak-recovery-33486f1a-7abf-4d96-8a1f-8194594f6a92' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_gpt
		insmod fat
		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 --hint='hd0,gpt1'  71EA-3F49
		else
		  search --no-floppy --fs-uuid --set=root 71EA-3F49
		fi
		echo	'Loading Linux 4.7.0-1-amd64.bak ...'
		linux	/vmlinuz-4.7.0-1-amd64.bak root=UUID=33486f1a-7abf-4d96-8a1f-8194594f6a92 ro single 
		echo	'Loading initial ramdisk ...'
		initrd	/initrd.img-4.7.0-1-amd64.bak
	}
	menuentry 'Debian GNU/Linux, with Linux 4.7.0-1-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.7.0-1-amd64-advanced-33486f1a-7abf-4d96-8a1f-8194594f6a92' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_gpt
		insmod fat
		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 --hint='hd0,gpt1'  71EA-3F49
		else
		  search --no-floppy --fs-uuid --set=root 71EA-3F49
		fi
		echo	'Loading Linux 4.7.0-1-amd64 ...'
		linux	/vmlinuz-4.7.0-1-amd64 root=UUID=33486f1a-7abf-4d96-8a1f-8194594f6a92 ro  quiet
		echo	'Loading initial ramdisk ...'
		initrd	/initrd.img-4.7.0-1-amd64
	}
	menuentry 'Debian GNU/Linux, with Linux 4.7.0-1-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.7.0-1-amd64-recovery-33486f1a-7abf-4d96-8a1f-8194594f6a92' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_gpt
		insmod fat
		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 --hint='hd0,gpt1'  71EA-3F49
		else
		  search --no-floppy --fs-uuid --set=root 71EA-3F49
		fi
		echo	'Loading Linux 4.7.0-1-amd64 ...'
		linux	/vmlinuz-4.7.0-1-amd64 root=UUID=33486f1a-7abf-4d96-8a1f-8194594f6a92 ro single 
		echo	'Loading initial ramdisk ...'
		initrd	/initrd.img-4.7.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/30_os-prober ###
### 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 ###
*********************** END /boot/grub/grub.cfg

*********************** BEGIN /proc/mdstat
Personalities : [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid1] [raid10] 
md0 : active raid5 sdc2[1] sdb2[0] sde2[4] sdd2[3]
      8589075456 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/4] [UUUU]
      bitmap: 5/22 pages [20KB], 65536KB chunk

unused devices: <none>
*********************** END /proc/mdstat

*********************** BEGIN /dev/disk/by-id
total 0
lrwxrwxrwx 1 root root  9 Sep 16 12:22 ata-CT120BX100SSD1_1511F00440EA -> ../../sda
lrwxrwxrwx 1 root root 10 Sep 16 12:22 ata-CT120BX100SSD1_1511F00440EA-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Sep 16 12:22 ata-CT120BX100SSD1_1511F00440EA-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Sep 16 12:22 ata-CT120BX100SSD1_1511F00440EA-part3 -> ../../sda3
lrwxrwxrwx 1 root root  9 Sep 16 12:22 ata-HL-DT-ST_DVDRAM_GH24NSC0_KBEF1TG1908 -> ../../sr0
lrwxrwxrwx 1 root root  9 Sep 16 12:22 ata-TOSHIBA_DT01ACA300_16SULL2KS -> ../../sdd
lrwxrwxrwx 1 root root 10 Sep 16 12:22 ata-TOSHIBA_DT01ACA300_16SULL2KS-part1 -> ../../sdd1
lrwxrwxrwx 1 root root 10 Sep 16 12:22 ata-TOSHIBA_DT01ACA300_16SULL2KS-part2 -> ../../sdd2
lrwxrwxrwx 1 root root  9 Sep 16 12:22 ata-TOSHIBA_DT01ACA300_16SUPJXKS -> ../../sde
lrwxrwxrwx 1 root root 10 Sep 16 12:22 ata-TOSHIBA_DT01ACA300_16SUPJXKS-part1 -> ../../sde1
lrwxrwxrwx 1 root root 10 Sep 16 12:22 ata-TOSHIBA_DT01ACA300_16SUPJXKS-part2 -> ../../sde2
lrwxrwxrwx 1 root root  9 Sep 16 12:22 ata-TOSHIBA_DT01ACA300_256D4LUGS -> ../../sdb
lrwxrwxrwx 1 root root 10 Sep 16 12:22 ata-TOSHIBA_DT01ACA300_256D4LUGS-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Sep 16 12:22 ata-TOSHIBA_DT01ACA300_256D4LUGS-part2 -> ../../sdb2
lrwxrwxrwx 1 root root  9 Sep 16 12:22 ata-TOSHIBA_DT01ACA300_256D4NPGS -> ../../sdc
lrwxrwxrwx 1 root root 10 Sep 16 12:22 ata-TOSHIBA_DT01ACA300_256D4NPGS-part1 -> ../../sdc1
lrwxrwxrwx 1 root root 10 Sep 16 12:22 ata-TOSHIBA_DT01ACA300_256D4NPGS-part2 -> ../../sdc2
lrwxrwxrwx 1 root root  9 Sep 16 12:22 md-name-kenaz:0 -> ../../md0
lrwxrwxrwx 1 root root  9 Sep 16 12:22 md-uuid-0da2f9c9:7facd71c:03a80f16:e7d9b084 -> ../../md0
lrwxrwxrwx 1 root root  9 Sep 16 12:22 wwn-0x5000039fe3cba309 -> ../../sdd
lrwxrwxrwx 1 root root 10 Sep 16 12:22 wwn-0x5000039fe3cba309-part1 -> ../../sdd1
lrwxrwxrwx 1 root root 10 Sep 16 12:22 wwn-0x5000039fe3cba309-part2 -> ../../sdd2
lrwxrwxrwx 1 root root  9 Sep 16 12:22 wwn-0x5000039fe3cbae28 -> ../../sde
lrwxrwxrwx 1 root root 10 Sep 16 12:22 wwn-0x5000039fe3cbae28-part1 -> ../../sde1
lrwxrwxrwx 1 root root 10 Sep 16 12:22 wwn-0x5000039fe3cbae28-part2 -> ../../sde2
lrwxrwxrwx 1 root root  9 Sep 16 12:22 wwn-0x5000039ff4efcc42 -> ../../sdb
lrwxrwxrwx 1 root root 10 Sep 16 12:22 wwn-0x5000039ff4efcc42-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Sep 16 12:22 wwn-0x5000039ff4efcc42-part2 -> ../../sdb2
lrwxrwxrwx 1 root root  9 Sep 16 12:22 wwn-0x5000039ff4efcc7c -> ../../sdc
lrwxrwxrwx 1 root root 10 Sep 16 12:22 wwn-0x5000039ff4efcc7c-part1 -> ../../sdc1
lrwxrwxrwx 1 root root 10 Sep 16 12:22 wwn-0x5000039ff4efcc7c-part2 -> ../../sdc2
lrwxrwxrwx 1 root root  9 Sep 16 12:22 wwn-0x5001480000000000 -> ../../sr0
lrwxrwxrwx 1 root root  9 Sep 16 12:22 wwn-0x500a0751f00440ea -> ../../sda
lrwxrwxrwx 1 root root 10 Sep 16 12:22 wwn-0x500a0751f00440ea-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Sep 16 12:22 wwn-0x500a0751f00440ea-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Sep 16 12:22 wwn-0x500a0751f00440ea-part3 -> ../../sda3
*********************** END /dev/disk/by-id

*********************** BEGIN /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 10 Sep 16 12:22 24ee64b6-37f6-4ef1-bfaa-3e71c0430f43 -> ../../sdc1
lrwxrwxrwx 1 root root 10 Sep 16 12:22 33486f1a-7abf-4d96-8a1f-8194594f6a92 -> ../../sda2
lrwxrwxrwx 1 root root 10 Sep 16 12:22 6244bbff-2f64-4b1d-a643-7e5f859d70c3 -> ../../sda3
lrwxrwxrwx 1 root root 13 Sep 16 12:22 68e3c691-bd3a-41e2-b237-c6617cbb0dab -> ../../bcache0
lrwxrwxrwx 1 root root 10 Sep 16 12:22 71EA-3F49 -> ../../sda1
lrwxrwxrwx 1 root root 10 Sep 16 12:22 7408e7c3-7d64-4257-91f9-22c28e17f7e0 -> ../../sde1
lrwxrwxrwx 1 root root 10 Sep 16 12:22 916597b1-14a4-4f9b-8b45-1a570723edb2 -> ../../sdb1
lrwxrwxrwx 1 root root  9 Sep 16 12:22 92d9d56c-6f5b-455b-905d-667b6ff47074 -> ../../md0
lrwxrwxrwx 1 root root 10 Sep 16 12:22 ec0840d0-89cb-4743-9419-376bcbe26c31 -> ../../sdd1
*********************** END /dev/disk/by-uuid

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.7.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages grub2-common depends on:
ii  dpkg                1.18.10
ii  grub-common         2.02~beta2-36
ii  libc6               2.24-3
ii  libdevmapper1.02.1  2:1.02.133-1
ii  liblzma5            5.1.1alpha+20120614-2.1

grub2-common recommends no packages.

grub2-common suggests no packages.

-- no debconf information



More information about the Pkg-grub-devel mailing list