Bug#589534: grub2: grub-mkconfig partition detection neither reliable nor intuitive
Josef Spillner (kuarepoti-dju.net)
2005 at kuarepoti-dju.net
Sun Jul 18 14:56:01 UTC 2010
Package: grub2
Version: 1.98-1
Severity: normal
*** Please type your report below this line ***
My harddisk (sda) started to show bad blocks so I've installed another one
(sdb) and cloned the
system to it with dd_rescue. What happens now when I run update-grub or
grub-mkconfig on the old
system booted from sda, it sets root=sdb1 and generates the kernel list in
grub.cfg from the ones
available in sdb1's /boot menu for both the sda grub as well as the sdb
grub.
This is either great supercow intelligence to not use the kernels on the
(still active) old hard disk anymore, or (more probably)
a bug in grub2. It means that the mere existence of a new hard disk in the
physical system, without even
mounting it, changes grub2's behaviour, which is certainly not a good
idea.
In the file /usr/lib/grub/grub-mkconfig_lib, function
prepare_grub_to_access_device(), only /dev/sdb1 is
given as an argument, but not /dev/sda1. Both partitions contain their
disk's system directories including /boot.
I've added a DEVICE debug statement which shows up in the attached
configuration file grub.cfg.
I couldn't find information in the ultra-minimalistic manual pages for
grub-install, update-grub,
grub-mkconfig etc. what the desired behaviour is to compare it to the
actual behaviour. In my view,
the desired behaviour would be to include all kernels from all partitions
grub2 works on and place the
list into all grub2 installations. The latter part is currently working,
the former is not.
To summarise graphically, when running update-grub from the sda system we
get:
* in /dev/sda's boot menu: kernels on sdb1 + custom entries from sdb1
* in /dev/sdb's boot menu: kernels on sdb1 + custom entries from sdb1
Instead of:
* in /dev/sda's boot menu: kernels on sda1 + sdb1 + custom entries from
sda1 + sdb1
* in /dev/sdb's boot menu: kernels on sda1 + sdb1 + custom entries from
sda1 + sdb1
-- Package-specific info:
*********************** BEGIN /proc/mounts
/dev/disk/by-uuid/384493f8-0bc2-4e63-8ff1-cdce440b4279 / ext3
rw,relatime,errors=remount-ro,data=ordered 0 0
*********************** END /proc/mounts
*********************** BEGIN /boot/grub/device.map
(hd0) /dev/sda
*********************** END /boot/grub/device.map
*********************** BEGIN /boot/grub/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/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
}
# DEVICE /dev/sdb1
insmod ext2
set root='(/dev/sdb,1)'
search --no-floppy --fs-uuid --set 384493f8-0bc2-4e63-8ff1-cdce440b4279
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
insmod gfxterm
insmod vbe
if terminal_output gfxterm ; then true ; else
# For backward compatibility with versions of terminal.mod that don't
# understand terminal_output
terminal gfxterm
fi
fi
# DEVICE /dev/sdb1
insmod ext2
set root='(/dev/sdb,1)'
search --no-floppy --fs-uuid --set 384493f8-0bc2-4e63-8ff1-cdce440b4279
set locale_dir=($root)/boot/grub/locale
set lang=de
insmod gettext
set timeout=5
### 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/08_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.
menuentry "Debian GNU/Linux, with Linux 2.6.32-3-amd64 (nokbd-stx8)"
--class debian --class gnu-linux --class gnu --class os {
insmod ext2
set root='(hd0,1)'
#set root='(hd1,1)'
search --no-floppy --fs-uuid --set
384493f8-0bc2-4e63-8ff1-cdce440b4279
echo Loading Linux 2.6.32-3-amd64 ...
linux /boot/vmlinuz-2.6.32-3-amd64
root=UUID=384493f8-0bc2-4e63-8ff1-cdce440b4279 ro quiet
echo Loading initial ramdisk ...
initrd /boot/initrd.img-2.6.32-3-amd64
}
### END /etc/grub.d/08_custom ###
### BEGIN /etc/grub.d/10_linux ###
menuentry "Debian GNU/Linux, with Linux 2.6.32-trunk-amd64" --class debian
--class gnu-linux --class gnu --class os {
# DEVICE /dev/sdb1
insmod ext2
set root='(/dev/sdb,1)'
search --no-floppy --fs-uuid --set
384493f8-0bc2-4e63-8ff1-cdce440b4279
echo Loading Linux 2.6.32-trunk-amd64 ...
linux /boot/vmlinuz-2.6.32-trunk-amd64
root=UUID=384493f8-0bc2-4e63-8ff1-cdce440b4279 ro quiet
echo Loading initial ramdisk ...
initrd /boot/initrd.img-2.6.32-trunk-amd64
}
menuentry "Debian GNU/Linux, with Linux 2.6.32-trunk-amd64 (recovery
mode)" --class debian --class gnu-linux --class gnu --class os {
# DEVICE /dev/sdb1
insmod ext2
set root='(/dev/sdb,1)'
search --no-floppy --fs-uuid --set
384493f8-0bc2-4e63-8ff1-cdce440b4279
echo Loading Linux 2.6.32-trunk-amd64 ...
linux /boot/vmlinuz-2.6.32-trunk-amd64
root=UUID=384493f8-0bc2-4e63-8ff1-cdce440b4279 ro single
echo Loading initial ramdisk ...
initrd /boot/initrd.img-2.6.32-trunk-amd64
}
menuentry "Debian GNU/Linux, with Linux 2.6.32-3-amd64" --class debian
--class gnu-linux --class gnu --class os {
# DEVICE /dev/sdb1
insmod ext2
set root='(/dev/sdb,1)'
search --no-floppy --fs-uuid --set
384493f8-0bc2-4e63-8ff1-cdce440b4279
echo Loading Linux 2.6.32-3-amd64 ...
linux /boot/vmlinuz-2.6.32-3-amd64
root=UUID=384493f8-0bc2-4e63-8ff1-cdce440b4279 ro quiet
echo Loading initial ramdisk ...
initrd /boot/initrd.img-2.6.32-3-amd64
}
menuentry "Debian GNU/Linux, with Linux 2.6.32-3-amd64 (recovery mode)"
--class debian --class gnu-linux --class gnu --class os {
# DEVICE /dev/sdb1
insmod ext2
set root='(/dev/sdb,1)'
search --no-floppy --fs-uuid --set
384493f8-0bc2-4e63-8ff1-cdce440b4279
echo Loading Linux 2.6.32-3-amd64 ...
linux /boot/vmlinuz-2.6.32-3-amd64
root=UUID=384493f8-0bc2-4e63-8ff1-cdce440b4279 ro single
echo Loading initial ramdisk ...
initrd /boot/initrd.img-2.6.32-3-amd64
}
menuentry "Debian GNU/Linux, with Linux 2.6.30-2-amd64" --class debian
--class gnu-linux --class gnu --class os {
# DEVICE /dev/sdb1
insmod ext2
set root='(/dev/sdb,1)'
search --no-floppy --fs-uuid --set
384493f8-0bc2-4e63-8ff1-cdce440b4279
echo Loading Linux 2.6.30-2-amd64 ...
linux /boot/vmlinuz-2.6.30-2-amd64
root=UUID=384493f8-0bc2-4e63-8ff1-cdce440b4279 ro quiet
echo Loading initial ramdisk ...
initrd /boot/initrd.img-2.6.30-2-amd64
}
menuentry "Debian GNU/Linux, with Linux 2.6.30-2-amd64 (recovery mode)"
--class debian --class gnu-linux --class gnu --class os {
# DEVICE /dev/sdb1
insmod ext2
set root='(/dev/sdb,1)'
search --no-floppy --fs-uuid --set
384493f8-0bc2-4e63-8ff1-cdce440b4279
echo Loading Linux 2.6.30-2-amd64 ...
linux /boot/vmlinuz-2.6.30-2-amd64
root=UUID=384493f8-0bc2-4e63-8ff1-cdce440b4279 ro single
echo Loading initial ramdisk ...
initrd /boot/initrd.img-2.6.30-2-amd64
}
### END /etc/grub.d/10_linux ###
### 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.
menuentry "Debian GNU/Linux, with Linux 2.6.32-3-amd64 (nokbd-stx40)"
--class debian --class gnu-linux --class gnu --class os {
insmod ext2
set root='(hd0,1)'
#set root='(hd1,1)'
search --no-floppy --fs-uuid --set
384493f8-0bc2-4e63-8ff1-cdce440b4279
echo Loading Linux 2.6.32-3-amd64 ...
linux /boot/vmlinuz-2.6.32-3-amd64
root=UUID=384493f8-0bc2-4e63-8ff1-cdce440b4279 ro quiet
echo Loading initial ramdisk ...
initrd /boot/initrd.img-2.6.32-3-amd64
}
### END /etc/grub.d/40_custom ###
*********************** END /boot/grub/grub.cfg
-- System Information:
Debian Release: squeeze/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages grub2 depends on:
ii grub-pc 1.98-1 GRand Unified Bootloader,
version
grub2 recommends no packages.
grub2 suggests no packages.
-- no debconf information
More information about the Pkg-grub-devel
mailing list