[Grml] Cannot add grub to new partition for grml.

Michael Schierl schierlm at gmx.de
Sat Nov 21 14:09:45 CET 2009


single.1 at netzero.com schrieb:
> I tried to install grml2hd and all worked fine until I tried to add
> grub to the /dev/sda16 partition and the grub install failed. 

Yeah that is a know error in Grub 1.96 and 1.97 that it cannot be
installed into a partition table if at the time of installing Grub,
/boot/grub/core.img is not stored in the root partition of the
filesystem. During installation  (like grml2hd) this is almost always
the case as they use a unionfs as root filesystem.

You can of course skip installing Grub and install it later manually
from chrooting into your new system (assuming you don't have a dedicated
/boot partition) or by trying to work around the bug by setting certain
symlinks.

For details, see
http://article.gmane.org/gmane.linux.distributions.grml.user/2366


> Error
> was that I had to force the grub because it was a BAD idea to load
> grub that was not at the mbr???? . 

That was the last message printed, but it was not the error. It would
even appear if Grub worked well.

The main reason *why* it is a bad idea to install Grub into a partition
(and it always was) is the fact, that if you install Grub to a
partition, it will have to hardcode the starting position of core.img
(or stage2 in case of Grub1) into the boot record of that partition
(there is not enough space in the boot record to store a complete
ext3/xfs/btrfs loader there). In practice, it works sufficiently well
(if the bug was not there) as long as you do not use a filesystem that
supports online defragmentation (like ext4 or btrfs), because in that
case it can happen that the filesystem suddenly moves core.img around to
make space for a bigger file, and the next boot after that will fail as
it cannot find core.img any longer.

To avoid this, you'll have to either install into the MBR (there is more
space there to put a real filesystem loader there) or into a dedicated
partition without any filesystem on it. (The latter option is not
supported by grml2hd, though). So, either install to MBR with grml2hd,
or roll your bootloader setup manually without it. As you have 16
partitions, I guess you have some chainloading between different
bootloaders anyway. If all of them were Grub2, you could chainload the
config files instead. If you have a Grub1 in the MBR, you can chainload
Grub2 from it without needing a boot loader in a partition table - just
specify (hd0,15)/boot/grub/core.img as a kernel in your Grub1 config
file. All of these options are more robust than installing Grub into a
partition boot record, as they do not hardcode any offsets.


Hope this helps,


Michael



More information about the Grml mailing list