All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Improve documentation of BIOS installation
@ 2011-03-29 12:40 Colin Watson
  2011-03-29 13:11 ` Pádraig Brady
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Colin Watson @ 2011-03-29 12:40 UTC (permalink / raw)
  To: grub-devel

With http://grub.enbug.org/BIOS_Boot_Partition being down at the moment,
I went to look at what corresponding documentation there was in the
manual.  There actually was some, written variously by Vladimir and me,
but I felt that it could use a bit of reorganisation, and being put into
a form where we could give out a single link that discusses all the BIOS
installation issues in one place rather than being scattered around the
manual.

What do you think of this patch?  It consolidates the existing
documentation into a new "BIOS installation" section and adds some
cross-references; I also wrote some new text to try to explain things
more clearly.

2011-03-29  Colin Watson  <cjwatson@ubuntu.com>

	* docs/grub.texi (BIOS installation): New section, partly based on
	previous text in other sections.
	(Installing GRUB using grub-install): Replace BIOS discussion with a
	cross-reference.
	(Images): Likewise.

=== modified file 'docs/grub.texi'
--- docs/grub.texi	2011-03-09 17:35:16 +0000
+++ docs/grub.texi	2011-03-29 12:22:33 +0000
@@ -550,6 +550,7 @@ the @dfn{boot directory}.
 * Installing GRUB using grub-install::
 * Making a GRUB bootable CD-ROM::
 * Device map::
+* BIOS installation::
 @end menu
 
 
@@ -565,13 +566,8 @@ always. Therefore, GRUB provides you wit
 @dfn{device map}, which you must fix if it is wrong. @xref{Device
 map}, for more details.
 
-On BIOS platforms GRUB has to use a so-called embedding zone. On msdos
-partition tables, this is the space between the MBR and the first partition
-(called the MBR gap or the boot track), while on GPT partition tables it
-uses a BIOS Boot Partition (a partition with GUID
-21686148-6449-6e6f-744e656564454649). If you use GRUB on a BIOS system, make
-sure that the embedding zone is at least 31 KiB (512KiB or more
-recommended).
+For information on where GRUB should be installed on PC BIOS platforms,
+@pxref{BIOS installation}.
 
 If you still do want to install GRUB under a UNIX-like OS (such
 as @sc{gnu}), invoke the program @command{grub-install} (@pxref{Invoking
@@ -744,6 +740,70 @@ comments in the file if needed, as the G
 just a comment if the first character is @samp{#}.
 
 
+@node BIOS installation
+@section BIOS installation
+
+@heading MBR
+
+The partition table format traditionally used on PC BIOS platforms is called
+the Master Boot Record (MBR) format; this is the format that allows up to
+four primary partitions and additional logical partitions.  With this
+partition table format, there are two ways to install GRUB: it can be
+embedded in the area between the MBR and the first partition (called by
+various names, such as the "boot track", "MBR gap", or "embedding area", and
+which is usually at least 31 KiB), or the core image can be installed in a
+file system and a list of the blocks that make it up can be stored in the
+first sector of that partition.
+
+Each of these has different problems.  There is no way to reserve space in
+the embedding area with complete safety, and some proprietary software is
+known to use it to make it difficult for users to work around licensing
+restrictions; and systems are sometimes partitioned without leaving enough
+space before the first partition.  On the other hand, installing to a
+filesystem means that GRUB is vulnerable to its blocks being moved around by
+filesystem features such as tail packing, or even by aggressive fsck
+implementations, so this approach is quite fragile; this approach also has
+reliability problems if the @file{/boot} filesystem is not on the disk the
+BIOS boots from, because GRUB must rely on guessing BIOS drive numbers.
+
+The GRUB development team generally recommends embedding GRUB before the
+first partition, unless you have special requirements.  You must ensure that
+the first partition starts at least 31 KiB (63 sectors) from the start of
+the disk; on modern disks, it is often a performance advantage to align
+partitions on larger boundaries anyway, so the first partition might start 1
+MiB from the start of the disk.
+
+@heading GPT
+
+Some newer systems use the GUID Partition Table (GPT) format.  This was
+specified as part of the Extensible Firmware Interface (EFI), but it can
+sometimes also be used on BIOS platforms.  With this format, it is possible
+to reserve a whole partition for GRUB, called the BIOS Boot Partition.  GRUB
+can then be embedded into that partition without the risk of being
+overwritten by other software and without being contained in a filesystem
+which might move its blocks around.
+
+When creating a BIOS Boot Partition on a GPT system, you should make sure
+that it is at least 31 KiB in size.  (GPT-formatted disks are not usually
+particularly small, so we recommend that you make it larger than the bare
+minimum, such as 1 MiB, to allow plenty of room for growth.)  You must also
+make sure that it has the proper partition type.  Using GNU Parted, you can
+set this using a command such as the following:
+
+@example
+# @kbd{parted /dev/@var{disk} set @var{partition-number} bios_grub on}
+@end example
+
+If you are using gdisk, set the partition type to @samp{0xEF02}.  With
+partitioning programs that require setting the GUID directly, it should be
+@samp{21686148-6449-6e6f-744e656564454649}.
+
+@strong{Caution:} Be very careful which partition you select!  When GRUB
+finds a BIOS Boot Partition during installation, it will automatically
+overwrite part of it.  Make sure that the partition does not contain any
+other data.
+
+
 @node Booting
 @chapter Booting
 
@@ -2021,28 +2081,8 @@ target operating systems, and so on) fro
 modular design allows the core image to be kept small, since the areas of
 disk where it must be installed are often as small as 32KB.
 
-On PC systems using the traditional MBR partition table format, the core
-image is usually installed in the "MBR gap" between the master boot record
-and the first partition, or sometimes it is installed in a file system and
-read directly from that.  The latter is not recommended because GRUB needs
-to encode the location of all the core image sectors in @file{diskboot.img},
-and if the file system ever moves the core image around (as it is entitled
-to do) then GRUB must be reinstalled; it also means that GRUB will not be
-able to reliably find the core image if it resides on a different disk than
-the one to which @file{boot.img} was installed.
-
-On PC systems using the more recent GUID Partition Table (GPT) format, the
-core image should be installed to a BIOS Boot Partition.  This may be
-created by GNU Parted using a command such as the following:
-
-@example
-# @kbd{parted /dev/@var{disk} set @var{partition-number} bios_grub on}
-@end example
-
-@strong{Caution:} Be very careful which partition you select!  When GRUB
-finds a BIOS Boot Partition during installation, it will automatically
-overwrite part of it.  Make sure that the partition does not contain any
-other data.
+@xref{BIOS installation}, for details on where the core image can be
+installed on PC systems.
 
 @item *.mod
 Everything else in GRUB resides in dynamically loadable modules.  These are

-- 
Colin Watson                                       [cjwatson@ubuntu.com]


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Improve documentation of BIOS installation
  2011-03-29 12:40 [PATCH] Improve documentation of BIOS installation Colin Watson
@ 2011-03-29 13:11 ` Pádraig Brady
  2011-03-29 13:29   ` Vladimir 'φ-coder/phcoder' Serbinenko
  2011-03-29 15:12   ` Colin Watson
  2011-03-29 16:26 ` richardvoigt
  2011-03-30 19:00 ` Barry Jackson
  2 siblings, 2 replies; 11+ messages in thread
From: Pádraig Brady @ 2011-03-29 13:11 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: Colin Watson

On 29/03/11 13:40, Colin Watson wrote:
> +@node BIOS installation
> +@section BIOS installation

This is a good summary.

> +(called by
> +various names, such as the "boot track", "MBR gap", or "embedding area", and
> +which is usually at least 31 KiB),

Maybe mention the original name/reason; "DOS compatibility region"

I'll link to this node from http://www.pixelbeat.org/docs/disk/
when it appears on line.

cheers,
Pádraig.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Improve documentation of BIOS installation
  2011-03-29 13:11 ` Pádraig Brady
@ 2011-03-29 13:29   ` Vladimir 'φ-coder/phcoder' Serbinenko
  2011-03-29 15:12   ` Colin Watson
  1 sibling, 0 replies; 11+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2011-03-29 13:29 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: Pádraig Brady, Colin Watson

[-- Attachment #1: Type: text/plain, Size: 985 bytes --]

On 29.03.2011 15:11, Pádraig Brady wrote:
> On 29/03/11 13:40, Colin Watson wrote:
>   
>> +@node BIOS installation
>> +@section BIOS installation
>>     
> This is a good summary.
>
>   
>> +(called by
>> +various names, such as the "boot track", "MBR gap", or "embedding area", and
>> +which is usually at least 31 KiB),
>>     
> Maybe mention the original name/reason; "DOS compatibility region"
>
>   
I think this name would be misleading since one can think that one needs
it for DOS to load or that DOS would overwrite GRUB if it's installed on
the disk. Since this term is rarely used I'd prefer to omit it.
> I'll link to this node from http://www.pixelbeat.org/docs/disk/
> when it appears on line.
>
> cheers,
> Pádraig.
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
>   


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Improve documentation of BIOS installation
  2011-03-29 13:11 ` Pádraig Brady
  2011-03-29 13:29   ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2011-03-29 15:12   ` Colin Watson
  2011-03-30 15:10     ` Pádraig Brady
  1 sibling, 1 reply; 11+ messages in thread
From: Colin Watson @ 2011-03-29 15:12 UTC (permalink / raw)
  To: Pádraig Brady; +Cc: The development of GNU GRUB

On Tue, Mar 29, 2011 at 02:11:45PM +0100, Pádraig Brady wrote:
> On 29/03/11 13:40, Colin Watson wrote:
> > +@node BIOS installation
> > +@section BIOS installation
> 
> This is a good summary.

Thanks.  I've incorporated some feedback from Vladimir and committed
this.

Vladimir and I disagreed a bit over what the traditional partition table
scheme should be called.  Other parts of the GRUB manual describe it as
"msdos", which is also the identifier used in GNU Parted's UI; and he
pointed out that MBR is also used to refer to sector 0.  I'm
uncomfortable with the lower case there, and I also don't like
attributing the scheme to a single company and (proprietary) operating
system in a GNU manual.

The GNU Parted manual uses "MS-DOS" in a number of places where prose is
more suitable than the identifier, although some of the documentation it
should have has "moved" to the non-existent "GNU Storage Guide".

http://en.wikipedia.org/wiki/Master_Boot_Record talks about the "MBR
partition table scheme", although I haven't checked to see whether
that's long-lived terminology on Wikipedia.

The GPT specification uses MBR in both senses: it refers to the "MBR
disk layout", and also to the MBR which may be located at LBA 0.  I like
this terminology because it's company- and OS-neutral, although it does
require careful phrasing in order to be clear.

Does anyone have preferences here?  I left it as "MBR" in my commit for
the time being, although there may well be scope for a rephrasing
through the whole manual.

> > +(called by
> > +various names, such as the "boot track", "MBR gap", or "embedding area", and
> > +which is usually at least 31 KiB),
> 
> Maybe mention the original name/reason; "DOS compatibility region"

Vladimir's reaction was that a casual reader might think "Huh?  What
does this have to do with compatibility".  Do you have a reference for
this being the original name?

> I'll link to this node from http://www.pixelbeat.org/docs/disk/
> when it appears on line.

  http://www.gnu.org/software/grub/manual/grub.html#BIOS-installation

You might like to link to (or contribute to!)
http://www.gnu.org/software/grub/manual/grub.html#Images as well, in the
context of your document.

Cheers,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Improve documentation of BIOS installation
  2011-03-29 12:40 [PATCH] Improve documentation of BIOS installation Colin Watson
  2011-03-29 13:11 ` Pádraig Brady
@ 2011-03-29 16:26 ` richardvoigt
  2011-03-30 19:00 ` Barry Jackson
  2 siblings, 0 replies; 11+ messages in thread
From: richardvoigt @ 2011-03-29 16:26 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: Colin Watson

> -@strong{Caution:} Be very careful which partition you select!  When GRUB
> -finds a BIOS Boot Partition during installation, it will automatically
> -overwrite part of it.  Make sure that the partition does not contain any
> -other data.
+@xref{BIOS installation}, for details on where the core image can be
+installed on PC systems.

I would suggest NOT moving warnings into links introduced as "for
details".  Something should be kept here, like:

( ! ) Caution: If your system has a BIOS Boot Partition, GRUB
automatic installation will overwrite it and data could be lost.  Be
sure to read @xref{BIOS installation/GPT}.

And then that section needs to also contain a simple test which users
can do to discover that they have no BIOS Boot Partition to worry
about.

Please also check whether it's more correct to say that GRUB will
automatically overwrite during installation, or GRUB will overwrite
during automatic installation.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Improve documentation of BIOS installation
  2011-03-29 15:12   ` Colin Watson
@ 2011-03-30 15:10     ` Pádraig Brady
  0 siblings, 0 replies; 11+ messages in thread
From: Pádraig Brady @ 2011-03-30 15:10 UTC (permalink / raw)
  To: Colin Watson; +Cc: The development of GNU GRUB

On 29/03/11 16:12, Colin Watson wrote:
> On Tue, Mar 29, 2011 at 02:11:45PM +0100, Pádraig Brady wrote:
>> On 29/03/11 13:40, Colin Watson wrote:
>>> +(called by
>>> +various names, such as the "boot track", "MBR gap", or "embedding area", and
>>> +which is usually at least 31 KiB),
>>
>> Maybe mention the original name/reason; "DOS compatibility region"
> 
> Vladimir's reaction was that a casual reader might think "Huh?  What
> does this have to do with compatibility".  Do you have a reference for
> this being the original name?

No. I was basing this on terminology used in fdisk docs,
and on the original reason for the presence of this gap.
The "compatibility" refers to DOS being compatible with the disk layout,
as detailed at the link below.

>> I'll link to this node from http://www.pixelbeat.org/docs/disk/
>> when it appears on line.
> 
>   http://www.gnu.org/software/grub/manual/grub.html#BIOS-installation
> 
> You might like to link to (or contribute to!)
> http://www.gnu.org/software/grub/manual/grub.html#Images as well, in the
> context of your document.

I'll add both links.

cheers!
Pádraig.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Improve documentation of BIOS installation
  2011-03-29 12:40 [PATCH] Improve documentation of BIOS installation Colin Watson
  2011-03-29 13:11 ` Pádraig Brady
  2011-03-29 16:26 ` richardvoigt
@ 2011-03-30 19:00 ` Barry Jackson
  2011-03-30 19:08   ` Vladimir 'φ-coder/phcoder' Serbinenko
  2011-03-30 19:52   ` Colin Watson
  2 siblings, 2 replies; 11+ messages in thread
From: Barry Jackson @ 2011-03-30 19:00 UTC (permalink / raw)
  To: grub-devel

On 29/03/11 13:40, Colin Watson wrote:
> With http://grub.enbug.org/BIOS_Boot_Partition being down at the moment,
> I went to look at what corresponding documentation there was in the
> manual.........

One question that I cannot find an answer for in the manual here :-
18.1 GRUB only offers a rescue shell
It explains that the only available commands are ls, set, unset and insmod.
So what use is it?
Assuming that a module is missing or a variable is incorrect, and these 
are corrected with insmod and set - what next?
I can see no way to boot after correcting things without a 'boot' 
command available. If you can't boot, why bother with set or insmod.
I just don't get it!





^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Improve documentation of BIOS installation
  2011-03-30 19:00 ` Barry Jackson
@ 2011-03-30 19:08   ` Vladimir 'φ-coder/phcoder' Serbinenko
  2011-03-30 19:52   ` Colin Watson
  1 sibling, 0 replies; 11+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2011-03-30 19:08 UTC (permalink / raw)
  To: grub-devel

On 30.03.2011 21:00, Barry Jackson wrote:
> On 29/03/11 13:40, Colin Watson wrote:
>> With http://grub.enbug.org/BIOS_Boot_Partition being down at the moment,
>> I went to look at what corresponding documentation there was in the
>> manual.........
>
> One question that I cannot find an answer for in the manual here :-
> 18.1 GRUB only offers a rescue shell
> It explains that the only available commands are ls, set, unset and
> insmod.
> So what use is it?
> Assuming that a module is missing or a variable is incorrect, and
> these are corrected with insmod and set - what next?
> I can see no way to boot after correcting things without a 'boot'
> command available. If you can't boot, why bother with set or insmod.
> I just don't get it!
[...]
insmod normal
normal
>
>
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Improve documentation of BIOS installation
  2011-03-30 19:00 ` Barry Jackson
  2011-03-30 19:08   ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2011-03-30 19:52   ` Colin Watson
  2011-03-31  8:38     ` Barry Jackson
  1 sibling, 1 reply; 11+ messages in thread
From: Colin Watson @ 2011-03-30 19:52 UTC (permalink / raw)
  To: grub-devel

On Wed, Mar 30, 2011 at 08:00:46PM +0100, Barry Jackson wrote:
> On 29/03/11 13:40, Colin Watson wrote:
> >With http://grub.enbug.org/BIOS_Boot_Partition being down at the moment,
> >I went to look at what corresponding documentation there was in the
> >manual.........
> 
> One question that I cannot find an answer for in the manual here :-
> 18.1 GRUB only offers a rescue shell
> It explains that the only available commands are ls, set, unset and insmod.
> So what use is it?
> Assuming that a module is missing or a variable is incorrect, and
> these are corrected with insmod and set - what next?
> I can see no way to boot after correcting things without a 'boot'
> command available. If you can't boot, why bother with set or insmod.
> I just don't get it!

The manual even answers this question directly with an example:

  http://www.gnu.org/software/grub/manual/grub.html#GRUB-only-offers-a-rescue-shell

See the example after "then you can correct this and enter normal mode
manually".

(Once you are in normal mode with a correct prefix, then commands will
be autoloaded, although you could insmod them manually if you really
wanted.  But this should be self-explanatory once you do it, as entering
normal mode will give you a GRUB menu.)

I've extended the text you refer to
(http://www.gnu.org/software/grub/manual/grub.html#Commands) to link to
this troubleshooting section.  It'll be there the next time we push to
the website.

Regards,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Improve documentation of BIOS installation
  2011-03-30 19:52   ` Colin Watson
@ 2011-03-31  8:38     ` Barry Jackson
  2011-04-12 12:33       ` Colin Watson
  0 siblings, 1 reply; 11+ messages in thread
From: Barry Jackson @ 2011-03-31  8:38 UTC (permalink / raw)
  To: grub-devel

On 30/03/11 20:52, Colin Watson wrote:
> On Wed, Mar 30, 2011 at 08:00:46PM +0100, Barry Jackson wrote:
>> On 29/03/11 13:40, Colin Watson wrote:
>>> With http://grub.enbug.org/BIOS_Boot_Partition being down at the moment,
>>> I went to look at what corresponding documentation there was in the
>>> manual.........
>>
>> One question that I cannot find an answer for in the manual here :-
>> 18.1 GRUB only offers a rescue shell
>> It explains that the only available commands are ls, set, unset and insmod.
>> So what use is it?
>> Assuming that a module is missing or a variable is incorrect, and
>> these are corrected with insmod and set - what next?
>> I can see no way to boot after correcting things without a 'boot'
>> command available. If you can't boot, why bother with set or insmod.
>> I just don't get it!
>
> The manual even answers this question directly with an example:
>
>    http://www.gnu.org/software/grub/manual/grub.html#GRUB-only-offers-a-rescue-shell
>
> See the example after "then you can correct this and enter normal mode
> manually".
>
> (Once you are in normal mode with a correct prefix, then commands will
> be autoloaded, although you could insmod them manually if you really
> wanted.  But this should be self-explanatory once you do it, as entering
> normal mode will give you a GRUB menu.)
>
> I've extended the text you refer to
> (http://www.gnu.org/software/grub/manual/grub.html#Commands) to link to
> this troubleshooting section.  It'll be there the next time we push to
> the website.
>
> Regards,
>

Thanks Colin,
I was being a bit dim - or maybe it was late.
I had not grasped the concept of the 'normal' command which was not 
included in the list of available commands.

It's much clearer now.

Maybe next time I'm hit with a rescue shell I may just be able to boot 
from it ;-)

Barry


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Improve documentation of BIOS installation
  2011-03-31  8:38     ` Barry Jackson
@ 2011-04-12 12:33       ` Colin Watson
  0 siblings, 0 replies; 11+ messages in thread
From: Colin Watson @ 2011-04-12 12:33 UTC (permalink / raw)
  To: grub-devel

On Thu, Mar 31, 2011 at 09:38:37AM +0100, Barry Jackson wrote:
> I was being a bit dim - or maybe it was late.
> I had not grasped the concept of the 'normal' command which was not
> included in the list of available commands.

Good point.  I've added brief documentation for this now.

  http://www.gnu.org/software/grub/manual/grub.html#normal

-- 
Colin Watson                                       [cjwatson@ubuntu.com]


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-04-12 12:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-29 12:40 [PATCH] Improve documentation of BIOS installation Colin Watson
2011-03-29 13:11 ` Pádraig Brady
2011-03-29 13:29   ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-03-29 15:12   ` Colin Watson
2011-03-30 15:10     ` Pádraig Brady
2011-03-29 16:26 ` richardvoigt
2011-03-30 19:00 ` Barry Jackson
2011-03-30 19:08   ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-03-30 19:52   ` Colin Watson
2011-03-31  8:38     ` Barry Jackson
2011-04-12 12:33       ` Colin Watson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.