Showing posts from May, 2009

grub2 cannot read core.img

When trying to install grub2 (whatever snapshot was current as of today) I kept getting the following error: $ sudo /sbin/grub-setup -v --directory=/media/sysrescd/boot/grub \ --device-map=/media/sysrescd/boot/grub/ -r '(hd1,1)' '(hd1)' .... snip ... grub-setup: error: Cannot read `/media/sysrescd/boot/grub/core.img' correctly The error was not very descriptive because grub was apparently able to read other important files like boot.img and such. The filesystem on my USB stick was identical (feature wise) to the /boot on my HDD -- ext2. And the same command worked just fine for installing to my hard disk. Digging through the code revealed where the problem is. The error was caused by grub-setup being unable to embed core.img in the MBR. The core.img prepared by grub-mkimage was 25k big. That is about 50 sectors. The first partition on my hard disk starts on sector 63. The first partition on my USB stick was starting on sector 32 (or was it 31?). 32 <