Sun 21 Oct 2012 09:56:21 AM UTC, original submission:
I think this bug has come up before in different guises e.g. https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/574883
Was trying to load Grub2 into a partition (not MBR), in Fedora 17 using grub2-install. (Wanting to use a specific partition for Grub in a multi-os situation).
Process ran through, no error reported. Attempted to chain load to the partition resulted in an error 'no signature'. Dumping the first sector of the partition showed it to be filled only with "0"s. No boot code.
After some attempts & investigation, running again using debug/verbose option ended with following (actually by this time I was trying just grub2-bios-setup itself):
....
/usr/sbin/grub2-bios-setup: info: saving <213632,0,512>.
/usr/sbin/grub2-bios-setup: info: saving <213633,0,512>.
/usr/sbin/grub2-bios-setup: info: saving <216642,0,512>.
/usr/sbin/grub2-bios-setup: info: saving <216643,0,512>.
/usr/sbin/grub2-bios-setup: info: opening the core image `/mnt/grub-partition/grub2/i386-pc/core.img'.
/usr/sbin/grub2-bios-setup: info: writing 0x400 bytes.
----End----
Appears as if grub has just written 400 bytes, either to the core image or the partition boot sector. It's not clear which.
Panic sets in at this point. Grub has apparently written 400 bytes somewhere, but obviously not to my boot sector. Has it potentially corrupted another sector?
Downloaded & built source and eventually found the following error:
File: grub-core/kern/disc.c
Procedure: grub_disk_write
The following line (or similar) occurs in more than one place:
...
if ((disk->dev->write) (disk, sector, 1, tmp_buf) != GRUB_ERR_NONE)
goto finish;
...
finish:
return grub_errno;
Here, whilst the procedure correctly stops if the disk write fails, it doesn't record the fact that an error occurred (into grub_errno). The grub_disk_write process therefore returns an apparent success, even though there was a fundamental error.
The user, like me, is left wondering what happened!
I think it would be a good idea to surround both the start and end of the write to the boot partition with comments, so you can see more clearly just what's being done.
Looking further the code, it appeared I had an error 24, which I think is a Not-Implemented error. Does that mean that this sort of set-up, using "blocklists" isn't supported at all anymore? The documentation implies it is, but you have to be careful and use the --force switch (which I did).
|