Bug#651512: grub-pc: debconf's 'grub/install_devices' refers to device IDs while debconf shows device names

Luca Capello luca at pca.it
Fri Dec 9 11:31:39 UTC 2011


Package: grub-pc
Version: 1.98+20100804-14+squeeze1
File: /etc/kernel/postinst.d/zz-update-grub
Severity: important
Usertags: pca.it-boot

Hi there!

This could be a duplicate of #650724, but given that the error shown is
different, I reported it as a new bug.

I changed both 500GB Samsung HDs with two 1TB Seagate HDs (in RAID1, LV
for /), in series: changed the first, rebuilt the RAID1, checked that
everything was OK, reconfigured grub-pc for the new disk and then
started again for the second, but it seems I missed the second
'dpkg-reconfigure grub-pc' step and the last kernel upgrade fails:
=====
tinello:/etc# apt-get update
[...]

tinello:/etc# apt-get upgrade
[...]
The following packages will be upgraded:
  linux-image-2.6.32-5-amd64
[...]
Preconfiguring packages ...
(Reading database ... 133332 files and directories currently installed.)
Preparing to replace linux-image-2.6.32-5-amd64 2.6.32-38 \
 (using .../linux-image-2.6.32-5-amd64_2.6.32-39_amd64.deb) ...
Unpacking replacement linux-image-2.6.32-5-amd64 ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 2.6.32-5-amd64 \
 /boot/vmlinuz-2.6.32-5-amd64
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 2.6.32-5-amd64 \
 /boot/vmlinuz-2.6.32-5-amd64
Setting up linux-image-2.6.32-5-amd64 (2.6.32-39) ...
Running depmod.
Running update-initramfs.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 2.6.32-5-amd64 \
 /boot/vmlinuz-2.6.32-5-amd64
update-initramfs: Generating /boot/initrd.img-2.6.32-5-amd64
run-parts: executing /etc/kernel/postinst.d/pm-utils 2.6.32-5-amd64 \
 /boot/vmlinuz-2.6.32-5-amd64
run-parts: executing /etc/kernel/postinst.d/update-notifier 2.6.32-5-amd64 \
 /boot/vmlinuz-2.6.32-5-amd64
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 2.6.32-5-amd64 \
 /boot/vmlinuz-2.6.32-5-amd64
Generating grub.cfg ...
/usr/sbin/grub-probe: error: no such disk.
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1
Failed to process /etc/kernel/postinst.d at \
 /var/lib/dpkg/info/linux-image-2.6.32-5-amd64.postinst line 799.
dpkg: error processing linux-image-2.6.32-5-amd64 (--configure):
 subprocess installed post-installation script returned error exit status 2
configured to not write apport reports
Errors were encountered while processing:
 linux-image-2.6.32-5-amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)

tinello:/etc# uname -a
Linux tinello 3.0.0-1-amd64 #1 SMP Sat Aug 27 16:21:11 UTC 2011 x86_64 GNU/Linux

tinello:/etc# dpkg-reconfigure grub-pc
[...]

  ┌─────────────────────┤ Configuring grub-pc ├─────────────────────┐
  │ The GRUB boot loader was previously installed to a disk that is │
  │ no longer present, or whose unique identifier has changed for   │
  │ some reason. [...]                                              │
[...]
  │ GRUB install devices:                                           │
  │                                                                 │
  │    [*] /dev/sda (1000204 MB; ST31000524AS)                      │
  │    [*] /dev/sdb (1000204 MB; ST31000524AS)                      │
  │    [ ] /dev/dm-0 (491903 MB; tinello-root)                      │
  │    [ ] /dev/md0 (199 MB; tinello:0)                             │
[...]

/usr/sbin/grub-probe: error: no such disk.
Auto-detection of a filesystem of /dev/md0 failed.
Please report this together with the output of "/usr/sbin/grub-probe \
 --device-map=/boot/grub/device.map --target=fs -v /boot/grub" to <bug-grub at gnu.org>
/usr/sbin/grub-probe: error: no such disk.
Auto-detection of a filesystem of /dev/md0 failed.
Please report this together with the output of "/usr/sbin/grub-probe \
 --device-map=/boot/grub/device.map --target=fs -v /boot/grub" to <bug-grub at gnu.org>

Package configuration

  ┌─────────────────────┤ Configuring grub-pc ├─────────────────────┐
  │                                                                 │
  │ GRUB failed to install to the following devices:                │
  │                                                                 │
  │ /dev/sda /dev/sdb                                               │
[...]

Generating grub.cfg ...
/usr/sbin/grub-probe: error: no such disk.

tinello:/etc# debconf-show grub-pc
  grub2/kfreebsd_cmdline:
  grub2/device_map_regenerated:
* grub2/linux_cmdline:
  grub-pc/install_devices_empty: false
  grub-pc/install_devices_failed: false
  grub-pc/chainload_from_menu.lst: true
  grub-pc/kopt_extracted: false
* grub-pc/install_devices: \
   /dev/disk/by-id/ata-ST31000524AS_6VPC7CTQ, \
   /dev/disk/by-id/ata-SAMSUNG_HD502HJ_S20BJ9FB109405
  grub-pc/postrm_purge_boot_grub: false
  grub-pc/install_devices_failed_upgrade: true
  grub-pc/disk_description:
  grub2/kfreebsd_cmdline_default: quiet
  grub-pc/partition_description:
* grub-pc/install_devices_disks_changed: \
   /dev/disk/by-id/ata-ST31000524AS_6VPC7CTQ, \
   /dev/disk/by-id/ata-SAMSUNG_HD502HJ_S20BJ9FB109405
* grub2/linux_cmdline_default: quiet
  grub-pc/mixed_legacy_and_grub2: true

tinello:/etc# /usr/sbin/grub-probe --device-map=/boot/grub/device.map \
 --target=fs -v /boot/grub
/usr/sbin/grub-probe: info: Cannot stat `/dev/disk/by-id/ata-SAMSUNG_HD502HJ_S20BJ9FB109400', skipping.
/usr/sbin/grub-probe: info: Cannot stat `/dev/disk/by-id/ata-SAMSUNG_HD502HJ_S20BJ9FB109405', skipping.
/usr/sbin/grub-probe: info: changing current directory to /dev.
/usr/sbin/grub-probe: info: changing current directory to usb.
/usr/sbin/grub-probe: info: changing current directory to dri.
/usr/sbin/grub-probe: info: changing current directory to snd.
/usr/sbin/grub-probe: info: changing current directory to by-path.
/usr/sbin/grub-probe: info: changing current directory to cpu.
/usr/sbin/grub-probe: info: changing current directory to shm.
/usr/sbin/grub-probe: info: changing current directory to tinello.
/usr/sbin/grub-probe: info: opening md/0.
/usr/sbin/grub-probe: error: no such disk.

tinello:/etc#
=====

I think we have two problems here:

1) device.map is not in sync with the current situation, which means
   that a simple `grub-mkdevicemap` should solve this.

2) however, debconf's 'grub-pc/install_devices' is not in sync either
   and `dpkg-reconfigure grub-pc` does not solve it, while IMHO it
   should.

   I think there is a fundamental problem here: grub-pc's debconf mixes
   device names (/dev/sda) with device IDs (/dev/disk/by-id/...).  This
   means that while you think you chose device names (so changing disks
   should not cause any problem), what is actually used is device IDs,
   which are not updated *before* starting grub-probe (so your choice is
   not taken into account).

   Indeed, updating this line was enough to solve the problem:
=====
tinello:/etc# echo "grub-pc grub-pc/install_devices string \
 /dev/disk/by-id/ata-ST31000524AS_6VPC7CTQ, \
 /dev/disk/by-id/ata-ST31000524AS_9VPCW9CS" | debconf-set-selections

tinello:/etc# dpkg-reconfigure grub-pc
[...]

  ┌─────────────────────┤ Configuring grub-pc ├─────────────────────┐
  │ The GRUB boot loader was previously installed to a disk that is │
  │ no longer present, or whose unique identifier has changed for   │
  │ some reason. [...]                                              │
[...]
  │ GRUB install devices:                                           │
  │                                                                 │
  │    [*] /dev/sda (1000204 MB; ST31000524AS)                      │
  │    [*] /dev/sdb (1000204 MB; ST31000524AS)                      │
  │    [ ] /dev/dm-0 (491903 MB; tinello-root)                      │
  │    [ ] /dev/md0 (199 MB; tinello:0)                             │
[...]

Installation finished. No error reported.                                                                                     Installation finished. No error reported.
Generating grub.cfg ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-3.0.0-1-amd64
Found initrd image: /boot/initrd.img-3.0.0-1-amd64
Found linux image: /boot/vmlinuz-2.6.39-2-amd64
Found initrd image: /boot/initrd.img-2.6.39-2-amd64
Found linux image: /boot/vmlinuz-2.6.32-5-amd64
Found initrd image: /boot/initrd.img-2.6.32-5-amd64
done

root at tinello:/etc# debconf-show grub-pc
  grub2/kfreebsd_cmdline:
  grub2/device_map_regenerated:
* grub2/linux_cmdline:
  grub-pc/install_devices_empty: false
  grub-pc/install_devices_failed: false
  grub-pc/chainload_from_menu.lst: true
  grub-pc/kopt_extracted: false
* grub-pc/install_devices: \
   /dev/disk/by-id/ata-ST31000524AS_6VPC7CTQ, \
   /dev/disk/by-id/ata-ST31000524AS_9VPCW9CS
  grub-pc/postrm_purge_boot_grub: false
  grub-pc/install_devices_failed_upgrade: true
  grub-pc/disk_description:
  grub2/kfreebsd_cmdline_default: quiet
  grub-pc/partition_description:
* grub-pc/install_devices_disks_changed: \
   /dev/disk/by-id/ata-ST31000524AS_6VPC7CTQ, \
   /dev/disk/by-id/ata-ST31000524AS_9VPCW9CS
* grub2/linux_cmdline_default: quiet
  grub-pc/mixed_legacy_and_grub2: true

tinello:/etc# cat /boot/grub/device.map
(hd0)   /dev/disk/by-id/ata-ST31000524AS_6VPC7CTQ
(hd1)   /dev/disk/by-id/ata-ST31000524AS_9VPCW9CS

tinello:/etc# apt-get -f install
[...]
1 not fully installed or removed.
[...]
Setting up linux-image-2.6.32-5-amd64 (2.6.32-39) ...
Running depmod.
Running update-initramfs.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 2.6.32-5-amd64 \
 /boot/vmlinuz-2.6.32-5-amd64
update-initramfs: Generating /boot/initrd.img-2.6.32-5-amd64
run-parts: executing /etc/kernel/postinst.d/pm-utils 2.6.32-5-amd64 \
 /boot/vmlinuz-2.6.32-5-amd64
run-parts: executing /etc/kernel/postinst.d/update-notifier 2.6.32-5-amd64 \
 /boot/vmlinuz-2.6.32-5-amd64
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 2.6.32-5-amd64 \
 /boot/vmlinuz-2.6.32-5-amd64
Generating grub.cfg ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-3.0.0-1-amd64
Found initrd image: /boot/initrd.img-3.0.0-1-amd64
Found linux image: /boot/vmlinuz-2.6.39-2-amd64
Found initrd image: /boot/initrd.img-2.6.39-2-amd64
Found linux image: /boot/vmlinuz-2.6.32-5-amd64
Found initrd image: /boot/initrd.img-2.6.32-5-amd64
done

tinello:/etc# 
=====

Thx, bye,
Gismo / Luca

-- Package-specific info:

*********************** BEGIN /proc/mounts
/dev/mapper/tinello-root / ext4 rw,relatime,errors=remount-ro,user_xattr,acl,barrier=1,data=ordered 0 0
/dev/md0 /boot ext2 rw,relatime,errors=continue 0 0
*********************** END /proc/mounts

*********************** BEGIN /boot/grub/device.map
(hd0)	/dev/disk/by-id/ata-SAMSUNG_HD502HJ_S20BJ9FB109400
(hd1)	/dev/disk/by-id/ata-SAMSUNG_HD502HJ_S20BJ9FB109405
(hd2)	/dev/disk/by-id/usb-Generic_USB_SD_Reader_058F312D81B-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
  load_env
fi
set default="0"
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 {
  insmod vbe
  insmod vga
  insmod video_bochs
  insmod video_cirrus
}

insmod raid
insmod mdraid
insmod lvm
insmod part_msdos
insmod ext2
set root='(tinello-root)'
search --no-floppy --fs-uuid --set f5ed19f6-f26b-4ddc-8453-7ece1530d2f5
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  load_video
  insmod gfxterm
fi
terminal_output gfxterm
insmod raid
insmod mdraid
insmod part_msdos
insmod ext2
set root='(md/0)'
search --no-floppy --fs-uuid --set b76e8cb4-0784-4d41-a7a3-2ced617f7f09
set locale_dir=($root)/grub/locale
set lang=it
insmod gettext
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
insmod raid
insmod mdraid
insmod lvm
insmod part_msdos
insmod ext2
set root='(tinello-root)'
search --no-floppy --fs-uuid --set f5ed19f6-f26b-4ddc-8453-7ece1530d2f5
insmod png
if background_image /usr/share/images/desktop-base/spacefun-grub.png; then
  set color_normal=light-gray/black
  set color_highlight=white/black
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 ###
menuentry 'Debian GNU/Linux, with Linux 3.0.0-1-amd64' --class debian --class gnu-linux --class gnu --class os {
	insmod raid
	insmod mdraid
	insmod part_msdos
	insmod ext2
	set root='(md/0)'
	search --no-floppy --fs-uuid --set b76e8cb4-0784-4d41-a7a3-2ced617f7f09
	echo	'Loading Linux 3.0.0-1-amd64 ...'
	linux	/vmlinuz-3.0.0-1-amd64 root=/dev/mapper/tinello-root ro  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/initrd.img-3.0.0-1-amd64
}
menuentry 'Debian GNU/Linux, with Linux 3.0.0-1-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os {
	insmod raid
	insmod mdraid
	insmod part_msdos
	insmod ext2
	set root='(md/0)'
	search --no-floppy --fs-uuid --set b76e8cb4-0784-4d41-a7a3-2ced617f7f09
	echo	'Loading Linux 3.0.0-1-amd64 ...'
	linux	/vmlinuz-3.0.0-1-amd64 root=/dev/mapper/tinello-root ro single 
	echo	'Loading initial ramdisk ...'
	initrd	/initrd.img-3.0.0-1-amd64
}
menuentry 'Debian GNU/Linux, with Linux 2.6.39-2-amd64' --class debian --class gnu-linux --class gnu --class os {
	insmod raid
	insmod mdraid
	insmod part_msdos
	insmod ext2
	set root='(md/0)'
	search --no-floppy --fs-uuid --set b76e8cb4-0784-4d41-a7a3-2ced617f7f09
	echo	'Loading Linux 2.6.39-2-amd64 ...'
	linux	/vmlinuz-2.6.39-2-amd64 root=/dev/mapper/tinello-root ro  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/initrd.img-2.6.39-2-amd64
}
menuentry 'Debian GNU/Linux, with Linux 2.6.39-2-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os {
	insmod raid
	insmod mdraid
	insmod part_msdos
	insmod ext2
	set root='(md/0)'
	search --no-floppy --fs-uuid --set b76e8cb4-0784-4d41-a7a3-2ced617f7f09
	echo	'Loading Linux 2.6.39-2-amd64 ...'
	linux	/vmlinuz-2.6.39-2-amd64 root=/dev/mapper/tinello-root ro single 
	echo	'Loading initial ramdisk ...'
	initrd	/initrd.img-2.6.39-2-amd64
}
menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-amd64' --class debian --class gnu-linux --class gnu --class os {
	insmod raid
	insmod mdraid
	insmod part_msdos
	insmod ext2
	set root='(md/0)'
	search --no-floppy --fs-uuid --set b76e8cb4-0784-4d41-a7a3-2ced617f7f09
	echo	'Loading Linux 2.6.32-5-amd64 ...'
	linux	/vmlinuz-2.6.32-5-amd64 root=/dev/mapper/tinello-root ro  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/initrd.img-2.6.32-5-amd64
}
menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os {
	insmod raid
	insmod mdraid
	insmod part_msdos
	insmod ext2
	set root='(md/0)'
	search --no-floppy --fs-uuid --set b76e8cb4-0784-4d41-a7a3-2ced617f7f09
	echo	'Loading Linux 2.6.32-5-amd64 ...'
	linux	/vmlinuz-2.6.32-5-amd64 root=/dev/mapper/tinello-root ro single 
	echo	'Loading initial ramdisk ...'
	initrd	/initrd.img-2.6.32-5-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/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  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
*********************** END /boot/grub/grub.cfg

-- System Information:
Debian Release: 6.0.3
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.0.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages grub-pc depends on:
ii  debconf [debco 1.5.36.1                  Debian configuration management sy
ii  grub-common    1.98+20100804-14+squeeze1 GRand Unified Bootloader, version 
ii  libc6          2.11.2-10                 Embedded GNU C Library: Shared lib
ii  libdevmapper1. 2:1.02.48-5               The Linux Kernel Device Mapper use
ii  ucf            3.0025+nmu1               Update Configuration File: preserv

grub-pc recommends no packages.

Versions of packages grub-pc suggests:
ii  desktop-base               6.0.5squeeze1 common files for the Debian Deskto

-- debconf information:
  grub2/kfreebsd_cmdline:
  grub2/device_map_regenerated:
* grub2/linux_cmdline:
  grub-pc/install_devices_empty: false
  grub-pc/install_devices_failed: false
  grub-pc/chainload_from_menu.lst: true
  grub-pc/kopt_extracted: false
* grub-pc/install_devices: \
   /dev/disk/by-id/ata-ST31000524AS_6VPC7CTQ, \
   /dev/disk/by-id/ata-SAMSUNG_HD502HJ_S20BJ9FB109405
  grub-pc/postrm_purge_boot_grub: false
  grub-pc/install_devices_failed_upgrade: true
  grub-pc/disk_description:
  grub2/kfreebsd_cmdline_default: quiet
  grub-pc/partition_description:
* grub-pc/install_devices_disks_changed: \
   /dev/disk/by-id/ata-ST31000524AS_6VPC7CTQ, \
   /dev/disk/by-id/ata-SAMSUNG_HD502HJ_S20BJ9FB109405
* grub2/linux_cmdline_default: quiet
  grub-pc/mixed_legacy_and_grub2: true
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20111209/e57435d0/attachment.pgp>


More information about the Pkg-grub-devel mailing list