Grub2 grumbles

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Fri Nov 12 15:00:09 UTC 2010


On Fri, Nov 12, 2010 at 12:41:15AM -0500, D. Hugh Redelmeier wrote:
> | From: D. Hugh Redelmeier <hugh-pmF8o41NoarQT0dZR+AlfA at public.gmane.org>
> 
> | Context:
> | 
> | Summary: I need to triple boot:
> |   Ubuntu 10.10
> |   Ubuntu 10.04
> |   Windows 7
> | 
> | I use 10.10's Grub2 as the bootloader that chooses amongst these
> | things.
> 
> Giving up, I have decided to use 10.04's bootloader as the bootloader.
> 
> So: I want to put 10.10's boot sector on 10.10's partition's boot
> sector (not the Master Boot Record).
> 
> Here's grub2 being unwilling:
> 
>     $ sudo grub-setup '(hd0,5)'
>     [sudo] password for hugh: 
>     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: error: if you really want blocklists, use --force.
>     $ 
> 
> Note: old grub would have let me use /dev/sda5 as an alternative to
> (hd0,4).  Oh: and that 4 isn't a typo: grub1 and grub2 number
> partitions differently.
> 
> I cannot really understand that message.  Installing a boot block on a
> partition is perfectly normal and reasonable.  If grub2 cannot handle
> that, it is pathetic.

No, it really is absolutely correct.

grub1 had a small stage 1.5 for each filesystem which it would blockmap
(or embed if it fit) and install stage1 with that blockmap so that grub
could boot.  If you ever touched those files, grub broke until you
reinstalled the stage1 in the boot sector.

grub2 is modular instead of being monolithic.  Not to avoid the breakage
issue, grub2 wants to avoid blockmaps (since those break if the files are
ever touched without reinstalling grub to the boot sector, just as lilo
was easily broken, since it too was blockmapped, but lilo was worse in
that it also blockmapped the kernel and ramdisks).  The way grub usually
does this, is to make an image with the modules required by the current
system (so raid, ext2/3/4 filesystem, lvm, msdos partitions, etc) and puts
that into the first track of the harddisk between the partition table and
the first partition (there is almost always 62 sectors available there,
unless you use EFI style GPT partitions in which case there isn't really
any room, but GPT has a dedicated boot partition type that grub uses
instead in that case).

Now as the message says, if you really want to go back to the old
unreliable way of doing things, go right ahead, but you have to explicitly
tell it to force that bad idea to happen.

> I'm *guessing* that grub2 wants to install parts of itself in the
> gap before the first partition starts.  And that kind of gap doesn't
> exist within each partition.
> 
> See this paritioning:
> 
>     $ sudo fdisk -u -l
> 
>     Disk /dev/sda: 500.1 GB, 500107862016 bytes
>     255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
>     Units = sectors of 1 * 512 = 512 bytes
>     Sector size (logical/physical): 512 bytes / 512 bytes
>     I/O size (minimum/optimal): 512 bytes / 512 bytes
>     Disk identifier: 0x3c46f452
> 
>        Device Boot      Start         End      Blocks   Id  System
>     /dev/sda1            2048    39847935    19922944   27  Unknown
>     /dev/sda2   *    39847936    40052735      102400    7  HPFS/NTFS
>     /dev/sda3        40052736   244852735   102400000    7  HPFS/NTFS
>     /dev/sda4       244854782   976771071   365958145    5  Extended
>     /dev/sda5       244854784   283914239    19529728   83  Linux
>     /dev/sda6       283916288   322975743    19529728   83  Linux
>     /dev/sda7       322977792   332740607     4881408   82  Linux swap / Solaris
>     /dev/sda8       332742656   976771071   322014208   83  Linux
> 
> There is a gap of over 2000 sectors (almost a megabyte) before the first
> partition starts.

Exactly 1MB I suspect.  Modern windows versions aligh partitions on 1MB.

> I'm getting seriously annoyed with grub2.

You are annoyed that they got rid of a major source of breakage?

Just use that 1MB of space you are wasting anyhow, and it will work much
better and be much more reliable.  It's not like you can use it for
anything else useful.

-- 
Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list