Bug#586621: /usr/sbin/grub-setup: error: cannot read `/boot/grub/core.img' correctly.

Julien Plissonneau Duquène exp-end-2010-07-f072e4ef at aqiii.org
Mon Jun 21 02:58:14 UTC 2010


Package: grub-pc
Version: 1.98+20100617-1
Severity: important

Hello,

grub-pc is unusable on my system since I upgraded from 1.98+20100614-2 to
1.98+20100617-1. 

As a side note in package configuration it is not possible to select a
partition as an install_device, which makes every grub-pc pkg update leave
my system unbootable unless I remember to run grub-install after the
update.

Tried reinstalling the package, editing device.map, using (hd0,msdos2) or
/dev/sda2, same problem.

This command used to work:
# grub-install --force /dev/sda2
/usr/sbin/grub-setup: warn: Attempting to install GRUB to a partition
instead of the MBR.  This is a BAD idea..
/usr/sbin/grub-setup: warn: Embedding is not possible.  GRUB can only be
installed in this setup by using blocklists.  However, blocklists are
UNRELIABLE and their use is discouraged..
/usr/sbin/grub-setup: error: cannot read `/boot/grub/core.img' correctly.

Got some details:
# grub-setup --verbose --force /dev/sda2
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: /dev/sda2 starts from 1050624.
grub-setup: info: opening the device hd0.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: Partition 0 starts from 32.
grub-setup: info: Partition 1 starts from 1050624.
grub-setup: info: changing current directory to /dev.
grub-setup: info: changing current directory to cpu.
grub-setup: info: changing current directory to snd.
grub-setup: info: changing current directory to net.
grub-setup: info: changing current directory to shm.
grub-setup: info: changing current directory to usb.
grub-setup: info: changing current directory to disk.
grub-setup: info: changing current directory to by-label.
grub-setup: info: changing current directory to by-uuid.
grub-setup: info: changing current directory to by-id.
grub-setup: info: changing current directory to by-path.
grub-setup: info: /dev/sda2 starts from 1050624.
grub-setup: info: opening the device hd0.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: Partition 0 starts from 32.
grub-setup: info: Partition 1 starts from 1050624.
grub-setup: info: getting the size of /boot/grub/boot.img.
grub-setup: info: reading /boot/grub/boot.img.
grub-setup: info: getting the size of /boot/grub/boot.img.
grub-setup: info: getting the size of /boot/grub/core.img.
grub-setup: info: reading /boot/grub/core.img.
grub-setup: info: getting the size of /boot/grub/core.img.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: setting the root device to `hd0,msdos2'.
grub-setup: info: dos partition is 1, bsd partition is -1.
grub-setup: warn: Attempting to install GRUB to a partition instead of the
MBR.  This is a BAD idea..
grub-setup: warn: Embedding is not possible.  GRUB can only be installed in
this setup by using blocklists.  However, blocklists are UNRELIABLE and
their use is discouraged..
grub-setup: info: attempting to read the core image `/boot/grub/core.img'
from GRUB.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: succeeded in opening the core image but the data is
different.
grub-setup: info: attempting to read the core image `/boot/grub/core.img'
from GRUB again.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: succeeded in opening the core image but the data is
different.
grub-setup: info: attempting to read the core image `/boot/grub/core.img'
from GRUB again.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: succeeded in opening the core image but the data is
different.
grub-setup: info: attempting to read the core image `/boot/grub/core.img'
from GRUB again.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: succeeded in opening the core image but the data is
different.
grub-setup: info: attempting to read the core image `/boot/grub/core.img'
from GRUB again.
grub-setup: info: the size of hd0 is 26588016.
grub-setup: info: succeeded in opening the core image but the data is
different.
grub-setup: error: cannot read `/boot/grub/core.img' correctly.

Did some strace after dd if=/dev/urandom of=/boot/grub/core.img bs=20480
count=1:
(...)
21951 open("/boot/grub/core.img", O_RDONLY|O_LARGEFILE) = 3
21951 fstat64(3, {st_mode=S_IFREG|0644, st_size=20480, ...}) = 0
21951 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = 0xb777e000
21951 _llseek(3, 0, [0], SEEK_SET)      = 0
21951 read(3,
"\323B\373\306\221\202\2\344\305\302\257:\224\10n\27B\233\310L\305\342'\7\326\365\257\\\303
MG"..., 20480) = 20480
21951 close(3)                          = 0
(...)
21951 open("/dev/sda2", O_RDONLY|O_SYNC|O_LARGEFILE) = 4
(...)
21951 read(4,
"\323B\373\306\221\202\2\344\305\302\257:\224\10n\27B\233\310L\305\342'\7\326\365\257\\\303
MG"..., 4096) = 4096
21951 _llseek(4, 5586862080, [5586862080], SEEK_SET) = 0
21951 read(4,
"\342\277\252*D\232\350\342\3034+\327\210!\367\f\202\343\334\354\223\355\325\334:\247\336\255\224.\336S"...,
4096) = 4096
21951 _llseek(4, 5586866176, [5586866176], SEEK_SET) = 0
21951 read(4,
"\nS$#M1F\235\375\326?\236\355\307q\1\367\10s\261\v{\326\17\224\306\221h\344\350<9"...,
4096) = 4096
21951 _llseek(4, 5586870272, [5586870272], SEEK_SET) = 0
21951 read(4,
"\232\207\377\201IP\327`\342\367\36\367\332\346\"3A\254im\366\27r\321\305\203\321]\246\2408\27"...,
4096) = 4096
21951 _llseek(4, 5586874368, [5586874368], SEEK_SET) = 0
21951 read(4,
"\37\247\257\340\275\332P\204\374\366\261\1\203\20\246a\22\t\361<\225w\305\3560b\371\3451\7\264\236"...,
4096) = 4096
21951 write(2, "grub-setup: info:", 17) = 17
21951 write(2, " ", 1)                  = 1
21951 write(2, "succeeded in opening the core im"..., 61) = 61
21951 write(2, ".\n", 2)                = 2
21951 close(4)                          = 0
(...)

Data read looks identical but comparison fails. Memory corruption bug?

-- Package-specific info:

*********************** WARNING grub-setup left core.img in filesystem

*********************** BEGIN /proc/mounts
/dev/disk/by-uuid/43b97bff-fb61-4388-800d-62d90c2f0c8a / ext3
rw,relatime,errors=remount-ro,data=ordered 0 0
*********************** END /proc/mounts

*********************** BEGIN /boot/grub/device.map
(hd0)	/dev/sda
(hd0,1)	/dev/sda1
(hd0,2)	/dev/sda2
*********************** END /boot/grub/device.map

-- debconf information:
  grub2/kfreebsd_cmdline:
* grub2/linux_cmdline:
* grub-pc/install_devices_empty: true
* grub-pc/chainload_from_menu.lst: true
  grub-pc/kopt_extracted: false
* grub-pc/install_devices:
  grub-pc/postrm_purge_boot_grub: false
  grub2/kfreebsd_cmdline_default: quiet
* grub2/linux_cmdline_default:
  grub-pc/mixed_legacy_and_grub2: true


-- 
Julien Plissonneau Duquène






More information about the Pkg-grub-devel mailing list