On one squeeze machine grub-install fails since grub-probe fails. This
is puzzling since it works on a different squeeze machine with similar
setup.
data:~$ sudo grub-probe "--device-map=/boot/grub/device.map" -t fs "--device" "/dev/md0"
grub-probe: error: out of disk.
data:~$ dpkg-query -W grub-common
grub-common 1.98+20100804-14+squeeze1
data:~$ cat /proc/mdstat
Personalities : [raid0] [raid1]
md1 : active raid0 md11[0] md12[1]
2906800640 blocks 128k chunks
md3 : active raid1 sda2[0] sdd2[3] sdb2[2] sdc2[1]
1959808 blocks [4/4] [UUUU]
md0 : active raid1 sda1[0] sdd1[3] sdb1[2] sdc1[1]
9775424 blocks [4/4] [UUUU]
md12 : active raid1 sdb3[0] sdd3[1]
1453400448 blocks [2/2] [UU]
md11 : active raid1 sda3[0] sdc3[1]
1453400448 blocks [2/2] [UU]
unused devices: <none>
data:~$ cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-2.6.32-5-amd64 root=/dev/md0 ro
data:~$ cat /proc/mounts
rootfs / rootfs rw 0 0
none /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
none /proc proc rw,nosuid,nodev,noexec,relatime 0 0
none /dev devtmpfs rw,relatime,size=2009304k,nr_inodes=502326,mode=755 0 0
none /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
/dev/md0 / ext3 rw,noatime,errors=remount-ro,data=ordered 0 0
tmpfs /lib/init/rw tmpfs rw,nosuid,relatime,mode=755 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev,relatime 0 0
/dev/sde1 /tmp ext4 rw,noatime,barrier=1,data=ordered 0 0
/dev/md1 /data ext3 rw,noatime,errors=continue,data=ordered 0 0
rpc_pipefs /var/lib/nfs/rpc_pipefs rpc_pipefs rw,relatime 0 0
nfs:/home /home nfs rw,relatime,vers=3,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.7.2.3,mountvers=3,mountport=56486,mountproto=udp,addr=10.7.2.3 0 0
nfsd /proc/fs/nfsd nfsd rw,relatime 0 0
data:~$ sudo file -sL /dev/md0
/dev/md0: Linux rev 1.0 ext3 filesystem data, UUID=a041c822-a636-475d-a7dc-6fc708f24326 (needs journal recovery) (large files)
data:~$ cat /boot/grub/device.map
(hd0) /dev/disk/by-id/ata-ST31500341AS_9VS3HN5W
(hd1) /dev/disk/by-id/ata-ST31500341AS_9VS0GXEL
(hd2) /dev/disk/by-id/ata-ST31500341AS_9VS03C29
(hd3) /dev/disk/by-id/ata-ST31500341AS_9VS3J1WF
(hd4) /dev/disk/by-id/ata-KINGSTON_SNV425S264GB_07MA20044374
$ sudo gdb --args grub-probe "--device-map=/boot/grub/device.map" -t fs "--device" "/dev/md0"
GNU gdb (GDB) 7.0.1-debian
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/sbin/grub-probe...done.
(gdb) break disk.c:383
Breakpoint 1 at 0x4081b7: file ../../kern/disk.c, line 383.
(gdb) r
Starting program: /usr/sbin/grub-probe --device-map=/boot/grub/device.map -t fs --device /dev/md0
Breakpoint 1, grub_disk_adjust_range (disk=0x679210, sector=0x7fffffffe670, offset=0x7fffffffe668, size=8) at ../../kern/disk.c:383
383 return grub_error (GRUB_ERR_OUT_OF_RANGE, "out of disk");
(gdb) bt full
#0 grub_disk_adjust_range (disk=0x679210, sector=0x7fffffffe670, offset=0x7fffffffe668, size=8) at ../../kern/disk.c:383
part = 0x0
#1 0x0000000000408223 in grub_disk_read (disk=0x679210, sector=6601936976, offset=0, size=8, buf=0x7fffffffe800) at ../../kern/disk.c:397
tmp_buf = 0x7ffff7bb8e40 ""
real_offset = 0
#2 0x0000000000431c7d in grub_fshelp_read_file (disk=0x679210, node=0x6860b0, read_hook=0, pos=0, len=8, buf=0x7fffffffe800 "\210\350\377\377\377\177",
get_block=0x40e760 <grub_ext2_read_block>, filesize=6879918072953648178, log2blocksize=3) at ../../fs/fshelp.c:281
blknr = 6601936976
blockoff = 0
blockend = 8
skipfirst = 0
i = 0
blockcnt = 1
blocksize = 4096
#3 0x000000000040ee9f in grub_ext2_read_file (node=0x6860b0, read_hook=0, pos=0, len=8, buf=0x7fffffffe800 "\210\350\377\377\377\177")
at ../../fs/ext2.c:521
No locals.
#4 0x000000000040f2fb in grub_ext2_iterate_dir (dir=0x6860b0, hook=0x7fffffffe8a0) at ../../fs/ext2.c:682
dirent = {inode = 4294961288, direntlen = 32767, namelen = 0 '\000', filetype = 0 '\000'}
fpos = 0
diro = 0x6860b0
#5 0x000000000040f960 in grub_ext2_dir (device=0x6790d0, path=0x438fed "/", hook=0x430944 <dummy_func>) at ../../fs/ext2.c:870
fdiro = 0x6860b0
data = 0x685f50
#6 0x00000000004309c7 in grub_fs_probe (device=0x6790d0) at ../../kern/fs.c:55
count = 0
p = 0x642740
#7 0x00000000004028c0 in probe (path=0x0, device_name=0x7fffffffedf4 "/dev/md0") at ../../util/grub-probe.c:244
drive_name = 0x678cb0 "md0"
grub_path = 0x0
filebuf_via_grub = 0x0
filebuf_via_sys = 0x0
dev = 0x6790d0
fs = 0x43e3ff
#8 0x0000000000402ecb in main (argc=6, argv=0x7fffffffeb78) at ../../util/grub-probe.c:447
dev_map = 0x670f70 "/boot/grub/device.map"
argument = 0x7fffffffedf4 "/dev/md0"
I fetched grub from bzr (rev 3437) and it seems to correctly detect
the filesystem type:
data:~$ sudo /home/lindi/grub-install/sbin/grub-probe "--device-map=/boot/grub/device.map" -t fs "--device" "/dev/md0"
[sudo] password for lindi:
ext2
I thought about backporting grub2 from wheezy but that seemed to build
depend on some gcc*multilib* stuff that I didn't have time to backport
at this point..