Bug#679214: grub-pc: Grub2 fails to boot from a degraded mdraid RAID6

2013-02-07 Thread Joni Orponen
Package: grub-pc
Version: 2.00-13
Followup-For: Bug #679214

This bug still exists in grub 2.00 on Debian.

The trigger cause seems to be 'extra' devices in mdraid arrays.

RAID1 > 2
RAID5 > 3
RAID6 > 4

Can anyone else reproduce this with a 6 disk array and / on LVM?

-- Package-specific info:

*** BEGIN /proc/mounts
/dev/sr0 /cdrom iso9660 ro,relatime 0 0
/dev/array/root / ext4 rw,relatime,user_xattr,barrier=1,stripe=256,data=ordered 
0 0
*** END /proc/mounts

*** BEGIN /boot/grub/device.map
(hd0)   /dev/disk/by-id/ata-VBOX_HARDDISK_VB9e4c9476-26d9eb65
(hd1)   /dev/disk/by-id/ata-VBOX_HARDDISK_VB28ec1605-6c9ea282
(hd2)   /dev/disk/by-id/ata-VBOX_HARDDISK_VB7a7f5ef7-5322a996
(hd3)   /dev/disk/by-id/ata-VBOX_HARDDISK_VBfedcbcc6-834bf48c
(hd4)   /dev/disk/by-id/ata-VBOX_HARDDISK_VB7c34e4d8-4fada505
(hd5)   /dev/disk/by-id/ata-VBOX_HARDDISK_VB0c575cba-2bb136b3
*** 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 [ 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 part_msdos
insmod part_msdos
insmod part_msdos
insmod part_msdos
insmod part_msdos
insmod diskfilter
insmod mdraid1x
insmod raid5rec
insmod lvm
insmod ext2
set root='lvm/array-root'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint='lvm/array-root'  
b382c897-f9ce-4eea-b075-3546c5d4fe19
else
  search --no-floppy --fs-uuid --set=root b382c897-f9ce-4eea-b075-3546c5d4fe19
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=C
  insmod gettext
fi
terminal_output gfxterm
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/10_linux ###
menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu 
--class os $menuentry_id_option 
'gnulinux-simple-b382c897-f9ce-4eea-b075-3546c5d4fe19' {
load_video
insmod gzio
insmod part_msdos
insmod part_msdos
insmod part_msdos
insmod part_msdos
insmod part_msdos
insmod part_msdos
insmod diskfilter
insmod mdraid1x
insmod raid5rec
insmod lvm
insmod ext2
set root='lvm/array-root'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint='lvm/array-root'  
b382c897-f9ce-4eea-b075-3546c5d4fe19
else
  search --no-floppy --fs-uuid --set=root 
b382c897-f9ce-4eea-b075-3546c5d4fe19
fi
echo'Loading Linux 3.2.0-4-amd64 ...'
linux   /boot/vmlinuz-3.2.0-4-amd64 root=/dev/mapper/array-root ro  
echo'Loading initial ramdisk ...'
initrd  /boot/initrd.img-3.2.0-4-amd64
}
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 
'gnulinux-advanced-b382c897-f9ce-4eea-b075-3546c5d4fe19' {
menuentry 'Debian GNU/Linux, with Linux 3.2.0-4-amd64' --class debian 
--class gnu-linux --class gnu --class os $menuentry_id_option 
'gnulinux-3.2.0-4-amd64-advanced-b382c897-f9ce-4eea-b075-3546c5d4fe19' {
load_video
insmod gzio
insmod part_msdos
insmod part_msdos
insmod part_msdos
insmod part_msdos
insmod part_msdos
insmod part_msdos
insmod diskfilter
insmod mdraid1x
insmod raid5rec
insmod lvm
insmod ext2
set root='lvm/array-root'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root 
--hint='lvm/array-root'  b382c897-f9ce-4eea-b075-3546c5d4fe19
else
  search --no-floppy --fs-uuid --set=root 
b382c897-f9ce-

Bug#679214: grub-pc: Grub2 fails to boot from a degraded mdraid RAID6

2012-06-27 Thread Joni Orponen
Package: grub-pc
Version: 1.99-22.1
Severity: important
Tags: d-i

My setup:

Wheezy businesscard install daily build (2012-06-25)
MBR on disks
One partition per disk
6 disk mdraid RAID6
/ and /boot on LVM
/ and /boot as ext4 (in fact on the same partition)

The installer installs everything fine, but grub fails to boot. Grub
can see the ext4 partitions on the lvm just fine, but with various
levels of failure cannot read the contents of them (they are either
not read at all or then they are corrupted in various ways).

After booting into recovery mode and letting the raid array build
itself the system boots up just fine after the array has finished
syncing. This is an acceptable workaround for a home system, but not
really acceptable for production environments (rebooting with a
degraded array can cause major downtime while the array syncs in a
single user mode recovery environment; alternatively someone has to
rush on-site with a newer grub boot medium to boot the system
normally).

I believe this upstream bug to be the bug in question:

https://savannah.gnu.org/bugs/?35843

Upstream claims it fixed in a newer version.

I have cross-verified this myself by having had success with Fedora 17,
Arch and Gentoo and failing with both Debian (6, 7) and Ubuntu (10.04,
12.04). The difference being that Debian and Ubuntu are on grub-pc 1.9x
while both Arch and Fedora 17 are on grub-pc 2.0+ and the Gentoo in
question is on latest (circa 2012-06-25) bzr from the GNU savannah.

A proposed solution would be to either move forward to match upstream
or to go and cherry-pick and backport the relevant change in question.
I unfortunately do not have the expertise to help you with this
process.

This bug report is being sent from an unbootable test setup in Virtualbox.

I have tagged this report relevant to the Debian installer due to the
install process leaving an unbootable system without extra steps.

-- Package-specific info:

*** BEGIN /proc/mounts
/dev/sr0 /cdrom iso9660 ro,relatime 0 0
/dev/raid6/root / ext4 rw,relatime,user_xattr,barrier=1,stripe=512,data=ordered 
0 0
*** END /proc/mounts

*** BEGIN /boot/grub/device.map
(hd0)   /dev/disk/by-id/ata-VBOX_HARDDISK_VBa2b88522-1437d827
(hd1)   /dev/disk/by-id/ata-VBOX_HARDDISK_VBc9570229-0652b7c9
(hd2)   /dev/disk/by-id/ata-VBOX_HARDDISK_VB3cbd04d6-03d73061
(hd3)   /dev/disk/by-id/ata-VBOX_HARDDISK_VB773558b3-c023f499
(hd4)   /dev/disk/by-id/ata-VBOX_HARDDISK_VBc69b081d-32b67df7
(hd5)   /dev/disk/by-id/ata-VBOX_HARDDISK_VB61f4bc52-a54ccf46
*** 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 raid6rec
insmod mdraid1x
insmod lvm
insmod part_msdos
insmod part_msdos
insmod part_msdos
insmod part_msdos
insmod part_msdos
insmod part_msdos
insmod ext2
set root='(raid6-root)'
search --no-floppy --fs-uuid --set=root aac00a9a-fce6-4260-a61e-5ded48e5dcb9
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  load_video
  insmod gfxterm
  insmod raid
  insmod raid6rec
  insmod mdraid1x
  insmod lvm
  insmod part_msdos
  insmod part_msdos
  insmod part_msdos
  insmod part_msdos
  insmod part_msdos
  insmod part_msdos
  insmod ext2
  set root='(raid6-root)'
  search --no-floppy --fs-uuid --set=root aac00a9a-fce6-4260-a61e-5ded48e5dcb9
  set locale_dir=($root)/boot/grub/locale
  set lang=C
  insmod gettext
fi
terminal_output gfxterm
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
insmod raid
insmod raid6rec
insmod mdraid1x
insmod lvm
insmod part_msdos
insmod part_msdos
insmod part_msdos
insmod part_msdos
insmod part_msdos
insmod part_msdos
insmod ext2
set root='(raid6-root)'
search --no-floppy --fs-uuid --set=root aac00a9a-fce6-4260-a61e-5ded48e5dcb9
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.2.0-2-amd64' --class debian --class 
gnu-linux --class gnu --class os {
insmod gzio
insmod raid
insmod raid6rec
insmod mdraid1x
insmod lvm