Bug#589854: grub-pc: grub-install fails after upgrade
Mario 'BitKoenig' Holbe
Mario.Holbe at TU-Ilmenau.DE
Wed Jul 28 13:54:16 UTC 2010
Hello Colin,
got a bit more time for debugging...
Short: it reads the right device but returns data from the wrong device.
Long: ... read on :)
I modified ext2.c to read some more blocks around the ext2 superblock to
see what's going on (and enough blocks to make sure some of them are not
cached yet :)).
Attached grub2-ext2-debug.patch not for inclusion but for information to
show what I did and where the outputs later come from. This is a cleaned
up version of the one where my previous snippets came from, don't try to
match the debug output from my previous comment against this code.
# strace -o grub-probe.strace grub2-1.98+20100722/build/grub-pc/grub-probe -vv --device-map=/boot/grub/device.map --target=fs --device /dev/md0 >grub-probe.out 2>grub-probe.err
# nl grub-probe.strace > grub-probe.strace.nl
Here is a grub-probe.out snippet:
...
kern/fs.c:54: Detecting nilfs2...
kern/emu/hostdisk.c:582: reusing open device `/dev/sda2'
kern/fs.c:60: nilfs2 detection failed.
kern/fs.c:54: Detecting minix...
kern/fs.c:60: minix detection failed.
kern/fs.c:54: Detecting jfs...
kern/emu/hostdisk.c:582: reusing open device `/dev/sda2'
kern/emu/hostdisk.c:582: reusing open device `/dev/sda2'
kern/fs.c:60: jfs detection failed.
kern/fs.c:54: Detecting udf...
kern/fs.c:60: udf detection failed.
kern/fs.c:54: Detecting iso9660...
kern/fs.c:60: iso9660 detection failed.
kern/fs.c:54: Detecting hfsplus...
kern/fs.c:60: hfsplus detection failed.
kern/fs.c:54: Detecting hfs...
kern/fs.c:60: hfs detection failed.
kern/fs.c:54: Detecting ext2...
fs/ext2.c:548: grub_disk_read(md0, 1 * 2, 0, 336, &data->sblock)
fs/ext2.c:555: grub_disk_read(md0, 0, 0, 51200, buf)
kern/emu/hostdisk.c:582: reusing open device `/dev/sda2'
kern/emu/hostdisk.c:582: reusing open device `/dev/sda2'
kern/emu/hostdisk.c:582: reusing open device `/dev/sda2'
kern/emu/hostdisk.c:582: reusing open device `/dev/sda2'
kern/emu/hostdisk.c:582: reusing open device `/dev/sda2'
kern/emu/hostdisk.c:582: reusing open device `/dev/sda2'
kern/emu/hostdisk.c:582: reusing open device `/dev/sda2'
kern/emu/hostdisk.c:582: reusing open device `/dev/sda2'
kern/emu/hostdisk.c:582: reusing open device `/dev/sda2'
fs/ext2.c:573: 00000000 4c 55 4b 53 xx xx 00 xx 61 65 73 00 00 00 00 00 |LUKS**..aes.....|
fs/ext2.c:573: 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
fs/ext2.c:573: 00000020 00 00 00 00 00 00 00 00 78 74 73 2d 70 6c 61 69 |........xts-plai|
fs/ext2.c:573: 00000030 6e 36 34 00 00 00 00 00 00 00 00 00 00 00 00 00 |n64.............|
fs/ext2.c:573: 00000040 00 00 00 00 00 00 00 00 73 68 61 32 35 36 00 00 |........sha256..|
fs/ext2.c:573: 00000050 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |****************|
fs/ext2.c:573: 00000060 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |****************|
fs/ext2.c:573: 00000070 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |****************|
fs/ext2.c:573: 00000080 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |****************|
fs/ext2.c:573: 00000090 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |****************|
fs/ext2.c:573: 000000a0 xx xx xx xx xx xx xx xx 66 63 31 37 39 39 37 35 |********fc179975|
fs/ext2.c:573: 000000b0 2d 64 35 33 32 2d 34 62 66 66 2d 39 39 32 61 2d |-d532-4bff-992a-|
fs/ext2.c:573: 000000c0 64 33 31 34 35 34 33 32 38 66 36 64 00 00 00 00 |d31454328f6d....|
...
Excuse me that I don't like to disclose the whole LUKS header.
Note that /dev/md0, i.e. /dev/sda2 is no LUKS device but an ext2 fs.
I found instead of reading /dev/sda2 as member of /dev/md0 as it claims
it appears to read /dev/sdf which is a member of /dev/md74.
But strace.out shows it doesn't really: here is a grub-probe.strace.nl
snippet:
...
580 open("/dev/sda2", O_RDONLY|O_SYNC|O_LARGEFILE) = 10
...
1651 open("/dev/sdf", O_RDONLY|O_LARGEFILE) = 23
1652 fstat64(23, {st_mode=S_IFBLK|0660, st_rdev=makedev(8, 80), ...}) = 0
1653 ioctl(23, BLKGETSIZE64, 0xbfd4e0b8) = 0
1654 close(23) = 0
...
1714 read(10, ..., 4096) = 4096
1715 _llseek(10, 51200, [51200], SEEK_SET) = 0
1716 read(10, ..., 4096) = 4096
1717 write(1, "da2'\nkern/fs.c:60: nilfs2 detect"..., 4096) = 4096
1718 write(1, " 00 00 00 00 00 00 00 xx xx 00 "..., 4096) = 4096
1719 write(1, ".....|\nfs/ext2.c:573: 000004a0 "..., 4096) = 4096
From line 1716 I searched backwards for " = 10$" and found line 580 as
first hit. Also from line 1716 I searched backwards for sdf and found
line 1651 as first hit.
It seems like grub_disk_read() really reads /dev/sda2 as it claims but
does return data from /dev/sdf ... looks like grub's internal cache is
somewhat out of sync.
For completeness I also attached /proc/mdstat, /etc/fstab, and
/proc/mounts. This still requires a map from raid- to crypto-devices,
here is it:
/dev/md1 /dev/dm-0 (/dev/mapper/md1)
/dev/md2 /dev/dm-1 (/dev/mapper/md2)
/dev/md3 /dev/dm-2 (/dev/mapper/md3)
/dev/md4 /dev/dm-3 (/dev/mapper/md4)
/dev/md5 /dev/dm-4 (/dev/mapper/md5)
/dev/md6 /dev/dm-5 (/dev/mapper/md6)
/dev/md71 /dev/dm-6 (/dev/mapper/md71)
/dev/md72 /dev/dm-7 (/dev/mapper/md72)
/dev/md73 /dev/dm-8 (/dev/mapper/md73)
/dev/md74 /dev/dm-9 (/dev/mapper/md74)
/dev/md8 /dev/dm-10 (/dev/mapper/md8)
regards
Mario
--
The social dynamics of the net are a direct consequence of the fact that
nobody has yet developed a Remote Strangulation Protocol. -- Larry Wall
-------------- next part --------------
A non-text attachment was scrubbed...
Name: grub2-ext2-debug.patch
Type: text/x-diff
Size: 1591 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20100728/4173b7ba/attachment.patch>
-------------- next part --------------
Personalities : [raid1] [raid0]
md7 : active raid0 dm-6[0] dm-9[3] dm-8[2] dm-7[1]
5860549632 blocks super 1.2 256k chunks
md8 : active raid1 sdb9[0]
1465127865 blocks super 1.2 [2/1] [U_]
bitmap: 14/22 pages [56KB], 32768KB chunk
md74 : active raid1 sdf[0]
1465138448 blocks super 1.2 [2/1] [U_]
bitmap: 22/22 pages [88KB], 32768KB chunk
md73 : active raid1 sde[0]
1465138448 blocks super 1.2 [2/1] [U_]
bitmap: 22/22 pages [88KB], 32768KB chunk
md72 : active raid1 sdd[0]
1465138448 blocks super 1.2 [2/1] [U_]
bitmap: 22/22 pages [88KB], 32768KB chunk
md71 : active raid1 sdc[0]
1465138448 blocks super 1.2 [2/1] [U_]
bitmap: 22/22 pages [88KB], 32768KB chunk
md6 : active (auto-read-only) raid1 sda8[0] sdb8[1]
58596992 blocks [3/2] [UU_]
bitmap: 14/14 pages [56KB], 2048KB chunk
md5 : active raid1 sda7[0] sdb7[1]
312830976 blocks [3/2] [UU_]
bitmap: 18/19 pages [72KB], 8192KB chunk
md4 : active raid1 sda6[0] sdb6[1]
78132032 blocks [3/2] [UU_]
bitmap: 19/19 pages [76KB], 2048KB chunk
md3 : active raid1 sda5[0] sdb5[1]
29302464 blocks [3/2] [UU_]
bitmap: 14/14 pages [56KB], 1024KB chunk
md2 : active (auto-read-only) raid1 sda4[0] sdb4[1]
8302912 blocks [3/2] [UU_]
md1 : active raid1 sda3[0] sdb3[1]
979840 blocks [3/2] [UU_]
md0 : active raid1 sda2[0] sdb2[1]
240832 blocks [3/2] [UU_]
unused devices: <none>
-------------- next part --------------
# /etc/fstab: static file system information.
#
# type ext3,ext2 vs. auto: if kernel has no ext3 support,
# type auto fails, since mount detects it as ext3 and
# does not try to mount it as ext2, if ext3 isnt there:
# # mount -t auto -o loop foo /mnt
# mount: fs type ext3 not supported by kernel
# # mount -t ext3,ext2 -o loop foo /mnt
# # mount | grep foo
# /root/foo on /mnt type ext2 (rw,loop=/dev/loop0)
# #
#
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/mapper/md1 / ext2 defaults,errors=remount-ro 0 1
/dev/mapper/md2 none swap sw 0 0
tmpfs /tmp tmpfs nosuid,nodev 0 0
/dev/md0 /boot ext2 defaults,nosuid,nodev,noexec 0 2
/dev/mapper/md3 /usr ext3 defaults,nodev 0 3
/dev/mapper/md4 /var ext3 defaults,nosuid,nodev,user_xattr 0 3
/dev/mapper/md5 /home ext3 defaults,nosuid,nodev 0 3
/dev/mapper/md6 /mnt ext2 defaults,noexec,nosuid,nodev,noauto 0 4
/dev/md7 /home/ftp/pub xfs defaults,ro,nosuid,nodev,largeio,attr2 0 0
/dev/mapper/md8 /home/holbe/downloads xfs defaults,nosuid,nodev,attr2 0 0
/dev/cdrom /media/cdrom0 udf,iso9660,auto ro,user,noauto 0 0
/dev/fd0 /media/floppy0 auto user,noatime,noauto 0 0
/dev/stick0 /media/stick0 auto user,noatime,noauto 0 0
/dev/stick1 /media/stick1 auto user,noatime,noauto 0 0
/dev/stick2 /media/stick2 auto user,noatime,noauto 0 0
/dev/stick3 /media/stick3 auto user,noatime,noauto 0 0
/dev/stick4 /media/stick4 auto user,noatime,noauto 0 0
/dev/stick5 /media/stick5 auto user,noatime,noauto 0 0
/dev/stick6 /media/stick6 auto user,noatime,noauto 0 0
/dev/stick7 /media/stick7 auto user,noatime,noauto 0 0
/dev/stick8 /media/stick8 auto user,noatime,noauto 0 0
/dev/stick9 /media/stick9 auto user,noatime,noauto 0 0
-------------- next part --------------
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=4144368k,nr_inodes=205047,mode=755 0 0
none /dev/pts devpts rw,nosuid,noexec,relatime,mode=600,ptmxmode=000 0 0
/dev/mapper/md1 / ext2 rw,relatime 0 0
tmpfs /lib/init/rw tmpfs rw,nosuid,relatime,mode=755 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev,relatime 0 0
tmpfs /tmp tmpfs rw,nosuid,nodev,relatime 0 0
/dev/md0 /boot ext2 rw,nosuid,nodev,noexec,relatime 0 0
/dev/dm-2 /usr ext3 rw,nodev,relatime,barrier=0,data=ordered 0 0
/dev/dm-3 /var ext3 rw,nosuid,nodev,relatime,user_xattr,barrier=0,data=ordered 0 0
/dev/dm-4 /home ext3 rw,nosuid,nodev,relatime,barrier=0,data=ordered 0 0
/dev/md7 /home/ftp/pub xfs ro,nosuid,nodev,relatime,attr2,largeio,logbsize=256k,sunit=512,swidth=2048,noquota 0 0
/dev/dm-10 /home/holbe/downloads xfs rw,nosuid,nodev,relatime,attr2,noquota 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
fusectl /sys/fs/fuse/connections fusectl rw,relatime 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime 0 0
cgroup /var/run/cgroups/cpu cgroup rw,relatime,cpu 0 0
cgroup /var/run/cgroups/cpuacct cgroup rw,relatime,cpuacct 0 0
cgroup /var/run/cgroups/devices cgroup rw,relatime,devices 0 0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20100728/4173b7ba/attachment.pgp>
More information about the Pkg-grub-devel
mailing list