1
This is ../../../docs/grub.info, produced by makeinfo version 4.13 from
2
../../../docs/grub.texi.
4
This manual is for GNU GRUB (version 1.99~20101123-1, 16 November 2010).
6
Copyright (C) 1999,2000,2001,2002,2004,2006,2008,2009,2010 Free
7
Software Foundation, Inc.
9
Permission is granted to copy, distribute and/or modify this
10
document under the terms of the GNU Free Documentation License,
11
Version 1.2 or any later version published by the Free Software
12
Foundation; with no Invariant Sections.
14
INFO-DIR-SECTION Kernel
16
* GRUB: (grub). The GRand Unified Bootloader
17
* grub-install: (grub)Invoking grub-install. Install GRUB on your drive
18
* grub-mkconfig: (grub)Invoking grub-mkconfig. Generate GRUB configuration
19
* grub-mkpasswd-pbkdf2: (grub)Invoking grub-mkpasswd-pbkdf2.
23
File: grub.info, Node: Top, Next: Introduction, Up: (dir)
28
This is the documentation of GNU GRUB, the GRand Unified Bootloader, a
29
flexible and powerful boot loader program for a wide range of
32
This edition documents version 1.99~20101123-1.
34
This manual is for GNU GRUB (version 1.99~20101123-1, 16 November
37
Copyright (C) 1999,2000,2001,2002,2004,2006,2008,2009,2010 Free
38
Software Foundation, Inc.
40
Permission is granted to copy, distribute and/or modify this
41
document under the terms of the GNU Free Documentation License,
42
Version 1.2 or any later version published by the Free Software
43
Foundation; with no Invariant Sections.
47
* Introduction:: Capturing the spirit of GRUB
48
* Naming convention:: Names of your drives in GRUB
49
* Installation:: Installing GRUB on your drive
50
* Booting:: How to boot different operating systems
51
* Configuration:: Writing your own configuration file
52
* Theme file format:: Format of GRUB theme files
53
* Network:: Downloading OS images from a network
54
* Serial terminal:: Using GRUB via a serial line
55
* Vendor power-on keys:: Changing GRUB behaviour on vendor power-on keys
56
* Images:: GRUB image files
57
* Filesystem:: Filesystem syntax and semantics
58
* Interface:: The menu and the command-line
59
* Commands:: The list of available builtin commands
60
* Security:: Authentication and authorisation
61
* Supported kernels:: The list of supported kernels
62
* Troubleshooting:: Error messages produced by GRUB
63
* Invoking grub-install:: How to use the GRUB installer
64
* Invoking grub-mkconfig:: Generate a GRUB configuration file
65
* Invoking grub-mkpasswd-pbkdf2::
66
Generate GRUB password hashes
67
* Obtaining and Building GRUB:: How to obtain and build GRUB
68
* Reporting bugs:: Where you should send a bug report
69
* Future:: Some future plans on GRUB
70
* Internals:: Hacking GRUB
71
* Copying This Manual:: Copying This Manual
75
File: grub.info, Node: Introduction, Next: Naming convention, Prev: Top, Up: Top
77
1 Introduction to GRUB
78
**********************
82
* Overview:: What exactly GRUB is and how to use it
83
* History:: From maggot to house fly
84
* Changes from GRUB Legacy:: Differences from previous versions
85
* Features:: GRUB features
86
* Role of a boot loader:: The role of a boot loader
89
File: grub.info, Node: Overview, Next: History, Up: Introduction
94
Briefly, a "boot loader" is the first software program that runs when a
95
computer starts. It is responsible for loading and transferring
96
control to an operating system "kernel" software (such as Linux or GNU
97
Mach). The kernel, in turn, initializes the rest of the operating
98
system (e.g. a GNU system).
100
GNU GRUB is a very powerful boot loader, which can load a wide
101
variety of free operating systems, as well as proprietary operating
102
systems with chain-loading(1) (*note Overview-Footnote-1::). GRUB is
103
designed to address the complexity of booting a personal computer; both
104
the program and this manual are tightly bound to that computer platform,
105
although porting to other platforms may be addressed in the future.
107
One of the important features in GRUB is flexibility; GRUB
108
understands filesystems and kernel executable formats, so you can load
109
an arbitrary operating system the way you like, without recording the
110
physical position of your kernel on the disk. Thus you can load the
111
kernel just by specifying its file name and the drive and partition
112
where the kernel resides.
114
When booting with GRUB, you can use either a command-line interface
115
(*note Command-line interface::), or a menu interface (*note Menu
116
interface::). Using the command-line interface, you type the drive
117
specification and file name of the kernel manually. In the menu
118
interface, you just select an OS using the arrow keys. The menu is
119
based on a configuration file which you prepare beforehand (*note
120
Configuration::). While in the menu, you can switch to the command-line
121
mode, and vice-versa. You can even edit menu entries before using them.
123
In the following chapters, you will learn how to specify a drive, a
124
partition, and a file name (*note Naming convention::) to GRUB, how to
125
install GRUB on your drive (*note Installation::), and how to boot your
126
OSes (*note Booting::), step by step.
129
File: grub.info, Node: Overview-Footnotes, Up: Overview
131
(1) "chain-load" is the mechanism for loading unsupported operating
132
systems by loading another boot loader. It is typically used for
133
loading DOS or Windows.
136
File: grub.info, Node: History, Next: Changes from GRUB Legacy, Prev: Overview, Up: Introduction
141
GRUB originated in 1995 when Erich Boleyn was trying to boot the GNU
142
Hurd with the University of Utah's Mach 4 microkernel (now known as GNU
143
Mach). Erich and Brian Ford designed the Multiboot Specification
144
(*note Multiboot Specification: (multiboot)Top.), because they were
145
determined not to add to the large number of mutually-incompatible PC
148
Erich then began modifying the FreeBSD boot loader so that it would
149
understand Multiboot. He soon realized that it would be a lot easier to
150
write his own boot loader from scratch than to keep working on the
151
FreeBSD boot loader, and so GRUB was born.
153
Erich added many features to GRUB, but other priorities prevented him
154
from keeping up with the demands of its quickly-expanding user base. In
155
1999, Gordon Matzigkeit and Yoshinori K. Okuji adopted GRUB as an
156
official GNU package, and opened its development by making the latest
157
sources available via anonymous CVS. *Note Obtaining and Building
158
GRUB::, for more information.
160
Over the next few years, GRUB was extended to meet many needs, but it
161
quickly became clear that its design was not keeping up with the
162
extensions being made to it, and we reached the point where it was very
163
difficult to make any further changes without breaking existing
164
features. Around 2002, Yoshinori K. Okuji started work on PUPA
165
(Preliminary Universal Programming Architecture for GNU GRUB), aiming
166
to rewrite the core of GRUB to make it cleaner, safer, more robust, and
167
more powerful. PUPA was eventually renamed to GRUB 2, and the original
168
version of GRUB was renamed to GRUB Legacy. Small amounts of
169
maintenance continued to be done on GRUB Legacy, but the last release
170
(0.97) was made in 2005 and at the time of writing it seems unlikely
171
that there will be another.
173
By around 2007, GNU/Linux distributions started to use GRUB 2 to
174
limited extents, and by the end of 2009 multiple major distributions
175
were installing it by default.
178
File: grub.info, Node: Changes from GRUB Legacy, Next: Features, Prev: History, Up: Introduction
180
1.3 Differences from previous versions
181
======================================
183
GRUB 2 is a rewrite of GRUB (*note History::), although it shares many
184
characteristics with the previous version, now known as GRUB Legacy.
185
Users of GRUB Legacy may need some guidance to find their way around
188
* The configuration file has a new name (`grub.cfg' rather than
189
`menu.lst' or `grub.conf'), new syntax (*note Configuration::) and
190
many new commands (*note Commands::). Configuration cannot be
191
copied over directly, although most GRUB Legacy users should not
192
find the syntax too surprising.
194
* `grub.cfg' is typically automatically generated by `grub-mkconfig'
195
(*note Simple configuration::). This makes it easier to handle
196
versioned kernel upgrades.
198
* Partition numbers in GRUB device names now start at 1, not 0
199
(*note Naming convention::).
201
* The configuration file is now written in something closer to a full
202
scripting language: variables, conditionals, and loops are
205
* A small amount of persistent storage is available across reboots,
206
using the `save_env' and `load_env' commands in GRUB and the
207
`grub-editenv' utility. For safety reasons this storage is only
208
available when installed on plain disk (no LVM or RAID), using
209
non-checksumming filesystem (no ZFS) and using BIOS or EFI
210
functions (no ATA, USB or IEEE1275)
212
* GRUB 2 has more reliable ways to find its own files and those of
213
target kernels on multiple-disk systems, and has commands (*note
214
search::) to find devices using file system labels or Universally
215
Unique Identifiers (UUIDs).
217
* GRUB 2 is available for several other types of system in addition
218
to the PC BIOS systems supported by GRUB Legacy: PC EFI, PC
219
coreboot, PowerPC, SPARC, and MIPS Lemote Yeeloong are all
222
* Many more file systems are supported, including but not limited to
223
ext4, HFS+, and NTFS.
225
* GRUB 2 can read files directly from LVM and RAID devices.
227
* A graphical terminal and a graphical menu system are available.
229
* GRUB 2's interface can be translated, including menu entry names.
231
* The image files (*note Images::) that make up GRUB have been
232
reorganised; Stage 1, Stage 1.5, and Stage 2 are no more.
234
* GRUB 2 puts many facilities in dynamically loaded modules,
235
allowing the core image to be smaller, and allowing the core image
236
to be built in more flexible ways.
239
File: grub.info, Node: Features, Next: Role of a boot loader, Prev: Changes from GRUB Legacy, Up: Introduction
244
The primary requirement for GRUB is that it be compliant with the
245
"Multiboot Specification", which is described in *note Multiboot
246
Specification: (multiboot)Top.
248
The other goals, listed in approximate order of importance, are:
250
* Basic functions must be straightforward for end-users.
252
* Rich functionality to support kernel experts and designers.
254
* Backward compatibility for booting FreeBSD, NetBSD, OpenBSD, and
255
Linux. Proprietary kernels (such as DOS, Windows NT, and OS/2) are
256
supported via a chain-loading function.
258
Except for specific compatibility modes (chain-loading and the Linux
259
"piggyback" format), all kernels will be started in much the same state
260
as in the Multiboot Specification. Only kernels loaded at 1 megabyte or
261
above are presently supported. Any attempt to load below that boundary
262
will simply result in immediate failure and an error message reporting
265
In addition to the requirements above, GRUB has the following
266
features (note that the Multiboot Specification doesn't require all the
267
features that GRUB supports):
269
Recognize multiple executable formats
270
Support many of the "a.out" variants plus "ELF". Symbol tables are
273
Support non-Multiboot kernels
274
Support many of the various free 32-bit kernels that lack Multiboot
275
compliance (primarily FreeBSD, NetBSD, OpenBSD, and Linux).
276
Chain-loading of other boot loaders is also supported.
278
Load multiples modules
279
Fully support the Multiboot feature of loading multiple modules.
281
Load a configuration file
282
Support a human-readable text configuration file with preset boot
283
commands. You can also load another configuration file dynamically
284
and embed a preset configuration file in a GRUB image file. The
285
list of commands (*note Commands::) are a superset of those
286
supported on the command-line. An example configuration file is
287
provided in *note Configuration::.
289
Provide a menu interface
290
A menu interface listing preset boot commands, with a programmable
291
timeout, is available. There is no fixed limit on the number of
292
boot entries, and the current implementation has space for several
295
Have a flexible command-line interface
296
A fairly flexible command-line interface, accessible from the menu,
297
is available to edit any preset commands, or write a new boot
298
command set from scratch. If no configuration file is present,
299
GRUB drops to the command-line.
301
The list of commands (*note Commands::) are a subset of those
302
supported for configuration files. Editing commands closely
303
resembles the Bash command-line (*note Bash: (features)Command
304
Line Editing.), with <TAB>-completion of commands, devices,
305
partitions, and files in a directory depending on context.
307
Support multiple filesystem types
308
Support multiple filesystem types transparently, plus a useful
309
explicit blocklist notation. The currently supported filesystem
310
types are "Amiga Fast FileSystem (AFFS)", "AtheOS fs", "BeFS",
311
"cpio", "Linux ext2/ext3/ext4", "DOS FAT12/FAT16/FAT32", "HFS",
312
"HFS+", "ISO9660", "JFS", "Minix fs", "nilfs2", "NTFS",
313
"ReiserFS", "Amiga Smart FileSystem (SFS)", "tar", "UDF", "BSD
314
UFS/UFS2", and "XFS". *Note Filesystem::, for more information.
316
Support automatic decompression
317
Can decompress files which were compressed by `gzip'. This
318
function is both automatic and transparent to the user (i.e. all
319
functions operate upon the uncompressed contents of the specified
320
files). This greatly reduces a file size and loading time, a
321
particularly great benefit for floppies.(1) (*note
322
Features-Footnote-1::)
324
It is conceivable that some kernel modules should be loaded in a
325
compressed state, so a different module-loading command can be
326
specified to avoid uncompressing the modules.
328
Access data on any installed device
329
Support reading data from any or all floppies or hard disk(s)
330
recognized by the BIOS, independent of the setting of the root
333
Be independent of drive geometry translations
334
Unlike many other boot loaders, GRUB makes the particular drive
335
translation irrelevant. A drive installed and running with one
336
translation may be converted to another translation without any
337
adverse effects or changes in GRUB's configuration.
339
Detect all installed RAM
340
GRUB can generally find all the installed RAM on a PC-compatible
341
machine. It uses an advanced BIOS query technique for finding all
342
memory regions. As described on the Multiboot Specification (*note
343
Multiboot Specification: (multiboot)Top.), not all kernels make
344
use of this information, but GRUB provides it for those who do.
346
Support Logical Block Address mode
347
In traditional disk calls (called "CHS mode"), there is a geometry
348
translation problem, that is, the BIOS cannot access over 1024
349
cylinders, so the accessible space is limited to at least 508 MB
350
and to at most 8GB. GRUB can't universally solve this problem, as
351
there is no standard interface used in all machines. However,
352
several newer machines have the new interface, Logical Block
353
Address ("LBA") mode. GRUB automatically detects if LBA mode is
354
available and uses it if available. In LBA mode, GRUB can access
357
Support network booting
358
GRUB is basically a disk-based boot loader but also has network
359
support. You can load OS images from a network by using the "TFTP"
362
Support remote terminals
363
To support computers with no console, GRUB provides remote terminal
364
support, so that you can control GRUB from a remote host. Only
365
serial terminal support is implemented at the moment.
368
File: grub.info, Node: Features-Footnotes, Up: Features
370
(1) There are a few pathological cases where loading a very badly
371
organized ELF kernel might take longer, but in practice this never
375
File: grub.info, Node: Role of a boot loader, Prev: Features, Up: Introduction
377
1.5 The role of a boot loader
378
=============================
380
The following is a quotation from Gordon Matzigkeit, a GRUB fanatic:
382
Some people like to acknowledge both the operating system and
383
kernel when they talk about their computers, so they might say
384
they use "GNU/Linux" or "GNU/Hurd". Other people seem to think
385
that the kernel is the most important part of the system, so they
386
like to call their GNU operating systems "Linux systems."
388
I, personally, believe that this is a grave injustice, because the
389
_boot loader_ is the most important software of all. I used to
390
refer to the above systems as either "LILO"(1) (*note Role of a
391
boot loader-Footnote-1::) or "GRUB" systems.
393
Unfortunately, nobody ever understood what I was talking about;
394
now I just use the word "GNU" as a pseudonym for GRUB.
396
So, if you ever hear people talking about their alleged "GNU"
397
systems, remember that they are actually paying homage to the best
398
boot loader around... GRUB!
400
We, the GRUB maintainers, do not (usually) encourage Gordon's level
401
of fanaticism, but it helps to remember that boot loaders deserve
402
recognition. We hope that you enjoy using GNU GRUB as much as we did
406
File: grub.info, Node: Role of a boot loader-Footnotes, Up: Role of a boot loader
408
(1) The LInux LOader, a boot loader that everybody uses, but nobody
412
File: grub.info, Node: Naming convention, Next: Installation, Prev: Introduction, Up: Top
417
The device syntax used in GRUB is a wee bit different from what you may
418
have seen before in your operating system(s), and you need to know it so
419
that you can specify a drive/partition.
421
Look at the following examples and explanations:
425
First of all, GRUB requires that the device name be enclosed with
426
`(' and `)'. The `fd' part means that it is a floppy disk. The number
427
`0' is the drive number, which is counted from _zero_. This expression
428
means that GRUB will use the whole floppy disk.
432
Here, `hd' means it is a hard disk drive. The first integer `0'
433
indicates the drive number, that is, the first hard disk, the string
434
`msdos' indicates the partition scheme, while the second integer, `2',
435
indicates the partition number (or the PC slice number in the BSD
436
terminology). The partition numbers are counted from _one_, not from
437
zero (as was the case in previous versions of GRUB). This expression
438
means the second partition of the first hard disk drive. In this case,
439
GRUB uses one partition of the disk, instead of the whole disk.
443
This specifies the first "extended partition" of the first hard disk
444
drive. Note that the partition numbers for extended partitions are
445
counted from `5', regardless of the actual number of primary partitions
450
This means the BSD `a' partition on first PC slice number of the
453
Of course, to actually access the disks or partitions with GRUB, you
454
need to use the device specification in a command, like `set
455
root=(fd0)' or `parttool (hd0,msdos3) hidden-'. To help you find out
456
which number specifies a partition you want, the GRUB command-line
457
(*note Command-line interface::) options have argument completion. This
458
means that, for example, you only need to type
462
followed by a <TAB>, and GRUB will display the list of drives,
463
partitions, or file names. So it should be quite easy to determine the
464
name of your target partition, even with minimal knowledge of the
467
Note that GRUB does _not_ distinguish IDE from SCSI - it simply
468
counts the drive numbers from zero, regardless of their type. Normally,
469
any IDE drive number is less than any SCSI drive number, although that
470
is not true if you change the boot sequence by swapping IDE and SCSI
473
Now the question is, how to specify a file? Again, consider an
478
This specifies the file named `vmlinuz', found on the first
479
partition of the first hard disk drive. Note that the argument
480
completion works with file names, too.
482
That was easy, admit it. Now read the next chapter, to find out how
483
to actually install GRUB on your drive.
486
File: grub.info, Node: Installation, Next: Booting, Prev: Naming convention, Up: Top
491
In order to install GRUB as your boot loader, you need to first install
492
the GRUB system and utilities under your UNIX-like operating system
493
(*note Obtaining and Building GRUB::). You can do this either from the
494
source tarball, or as a package for your OS.
496
After you have done that, you need to install the boot loader on a
497
drive (floppy or hard disk). There are two ways of doing that - either
498
using the utility `grub-install' (*note Invoking grub-install::) on a
499
UNIX-like OS, or by running GRUB itself from a floppy. These are quite
500
similar, however the utility might probe a wrong BIOS drive, so you
503
Also, if you install GRUB on a UNIX-like OS, please make sure that
504
you have an emergency boot disk ready, so that you can rescue your
505
computer if, by any chance, your hard drive becomes unusable
508
GRUB comes with boot images, which are normally put in the directory
509
`/usr/lib/grub/i386-pc'. Hereafter, the directory where GRUB images are
510
initially placed (normally `/usr/lib/grub/i386-pc') will be called the
511
"image directory", and the directory where the boot loader needs to
512
find them (usually `/boot/grub') will be called the "boot directory".
516
* Installing GRUB using grub-install::
517
* Making a GRUB bootable CD-ROM::
521
File: grub.info, Node: Installing GRUB using grub-install, Next: Making a GRUB bootable CD-ROM, Up: Installation
523
3.1 Installing GRUB using grub-install
524
======================================
526
*Caution:* This procedure is definitely less safe, because there are
527
several ways in which your computer can become unbootable. For example,
528
most operating systems don't tell GRUB how to map BIOS drives to OS
529
devices correctly--GRUB merely "guesses" the mapping. This will succeed
530
in most cases, but not always. Therefore, GRUB provides you with a map
531
file called the "device map", which you must fix if it is wrong. *Note
532
Device map::, for more details.
534
On BIOS platforms GRUB has to use a so-called embedding zone. On
535
msdos partition tables, this is the space between the MBR and the first
536
partition (called the MBR gap or the boot track), while on GPT
537
partition tables it uses a BIOS Boot Partition (a partition with GUID
538
21686148-6449-6e6f-744e656564454649). If you use GRUB on a BIOS system,
539
make sure that the embedding zone is at least 31 KiB (512KiB or more
542
If you still do want to install GRUB under a UNIX-like OS (such as
543
GNU), invoke the program `grub-install' (*note Invoking grub-install::)
544
as the superuser ("root").
546
The usage is basically very simple. You only need to specify one
547
argument to the program, namely, where to install the boot loader. The
548
argument can be either a device file (like `/dev/hda') or a partition
549
specified in GRUB's notation. For example, under Linux the following
550
will install GRUB into the MBR of the first IDE disk:
552
# grub-install /dev/hda
554
Likewise, under GNU/Hurd, this has the same effect:
556
# grub-install /dev/hd0
558
But all the above examples assume that GRUB should use images under
559
the root directory. If you want GRUB to use images under a directory
560
other than the root directory, you need to specify the option
561
`--root-directory'. The typical usage is that you create a GRUB boot
562
floppy with a filesystem. Here is an example:
565
# mount -t ext2 /dev/fd0 /mnt
566
# grub-install --root-directory=/mnt fd0
569
Another example is when you have a separate boot partition which is
570
mounted at `/boot'. Since GRUB is a boot loader, it doesn't know
571
anything about mountpoints at all. Thus, you need to run `grub-install'
574
# grub-install --root-directory=/boot /dev/hda
576
By the way, as noted above, it is quite difficult to guess BIOS
577
drives correctly under a UNIX-like OS. Thus, `grub-install' will prompt
578
you to check if it could really guess the correct mappings, after the
579
installation. The format is defined in *note Device map::. Please be
580
quite careful. If the output is wrong, it is unlikely that your
581
computer will be able to boot with no problem.
583
Some BIOSes have a bug of exposing the first partition of a USB
584
drive as a floppy instead of exposing the USB drive as a hard disk
585
(they call it "USB-FDD" boot). In such cases, you need to install like
588
# losetup /dev/loop0 /dev/sdb1
589
# mount /dev/loop0 /mnt/usb
590
# grub-install --boot-directory=/mnt/usb/bugbios --force --allow-floppy /dev/loop0
592
This install doesn't conflict with standard install as long as they
593
are in separate directories.
595
Note that `grub-install' is actually just a shell script and the
596
real task is done by `grub-mkimage' and `grub-setup'. Therefore, you
597
may run those commands directly to install GRUB, without using
598
`grub-install'. Don't do that, however, unless you are very familiar
599
with the internals of GRUB. Installing a boot loader on a running OS
600
may be extremely dangerous.
603
File: grub.info, Node: Making a GRUB bootable CD-ROM, Next: Device map, Prev: Installing GRUB using grub-install, Up: Installation
605
3.2 Making a GRUB bootable CD-ROM
606
=================================
608
GRUB supports the "no emulation mode" in the El Torito specification(1)
609
(*note Making a GRUB bootable CD-ROM-Footnote-1::). This means that you
610
can use the whole CD-ROM from GRUB and you don't have to make a floppy
611
or hard disk image file, which can cause compatibility problems.
613
For booting from a CD-ROM, GRUB uses a special Stage 2 called
614
`stage2_eltorito'. The only GRUB files you need to have in your
615
bootable CD-ROM are this `stage2_eltorito' and optionally a config file
616
`grub.cfg'. You don't need to use `stage1' or `stage2', because El
617
Torito is quite different from the standard boot process.
619
Here is an example of procedures to make a bootable CD-ROM image.
620
First, make a top directory for the bootable image, say, `iso':
624
Make a directory for GRUB:
626
$ mkdir -p iso/boot/grub
628
Copy the file `stage2_eltorito':
630
$ cp /usr/lib/grub/i386-pc/stage2_eltorito iso/boot/grub
632
If desired, make the config file `grub.cfg' under `iso/boot/grub'
633
(*note Configuration::), and copy any files and directories for the
634
disc to the directory `iso/'.
636
Finally, make a ISO9660 image file like this:
638
$ mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot \
639
-boot-load-size 4 -boot-info-table -o grub.iso iso
641
This produces a file named `grub.iso', which then can be burned into
642
a CD (or a DVD). `mkisofs' has already set up the disc to boot from
643
the `boot/grub/stage2_eltorito' file, so there is no need to setup GRUB
644
on the disc. (Note that the `-boot-load-size 4' bit is required for
645
compatibility with the BIOS on many older machines.)
647
You can use the device `(cd)' to access a CD-ROM in your config
648
file. This is not required; GRUB automatically sets the root device to
649
`(cd)' when booted from a CD-ROM. It is only necessary to refer to
650
`(cd)' if you want to access other drives as well.
653
File: grub.info, Node: Making a GRUB bootable CD-ROM-Footnotes, Up: Making a GRUB bootable CD-ROM
655
(1) El Torito is a specification for bootable CD using BIOS
659
File: grub.info, Node: Device map, Prev: Making a GRUB bootable CD-ROM, Up: Installation
661
3.3 The map between BIOS drives and OS devices
662
==============================================
664
The `grub-mkdevicemap' program can be used to create the "device map
665
file". It is often run automatically by tools such as `grub-install'
666
if the device map file does not already exist. The file name
667
`/boot/grub/device.map' is preferred.
669
If the device map file exists, the GRUB utilities (`grub-probe',
670
`grub-setup', etc.) read it to map BIOS drives to OS devices. This
671
file consists of lines like this:
675
DEVICE is a drive specified in the GRUB syntax (*note Device
676
syntax::), and FILE is an OS file, which is normally a device file.
678
Historically, the device map file was used because GRUB device names
679
had to be used in the configuration file, and they were derived from
680
BIOS drive numbers. The map between BIOS drives and OS devices cannot
681
always be guessed correctly: for example, GRUB will get the order wrong
682
if you exchange the boot sequence between IDE and SCSI in your BIOS.
684
Unfortunately, even OS device names are not always stable. Modern
685
versions of the Linux kernel may probe drives in a different order from
686
boot to boot, and the prefix (`/dev/hd*' versus `/dev/sd*') may change
687
depending on the driver subsystem in use. As a result, the device map
688
file required frequent editing on some systems.
690
GRUB avoids this problem nowadays by using UUIDs or file system
691
labels when generating `grub.cfg', and we advise that you do the same
692
for any custom menu entries you write. If the device map file does not
693
exist, then the GRUB utilities will assume a temporary device map on
694
the fly. This is often good enough, particularly in the common case of
697
However, the device map file is not entirely obsolete yet, and there
698
are still some situations that require it to exist. If necessary, you
699
may edit the file if `grub-mkdevicemap' makes a mistake. You can put
700
any comments in the file if needed, as the GRUB utilities assume that a
701
line is just a comment if the first character is `#'.
704
File: grub.info, Node: Booting, Next: Configuration, Prev: Installation, Up: Top
709
GRUB can load Multiboot-compliant kernels in a consistent way, but for
710
some free operating systems you need to use some OS-specific magic.
714
* General boot methods:: How to boot OSes with GRUB generally
715
* OS-specific notes:: Notes on some operating systems
718
File: grub.info, Node: General boot methods, Next: OS-specific notes, Up: Booting
720
4.1 How to boot operating systems
721
=================================
723
GRUB has two distinct boot methods. One of the two is to load an
724
operating system directly, and the other is to chain-load another boot
725
loader which then will load an operating system actually. Generally
726
speaking, the former is more desirable, because you don't need to
727
install or maintain other boot loaders and GRUB is flexible enough to
728
load an operating system from an arbitrary disk/partition. However, the
729
latter is sometimes required, since GRUB doesn't support all the
730
existing operating systems natively.
734
* Loading an operating system directly::
738
File: grub.info, Node: Loading an operating system directly, Next: Chain-loading, Up: General boot methods
740
4.1.1 How to boot an OS directly with GRUB
741
------------------------------------------
743
Multiboot (*note Multiboot Specification: (multiboot)Top.) is the
744
native format supported by GRUB. For the sake of convenience, there is
745
also support for Linux, FreeBSD, NetBSD and OpenBSD. If you want to
746
boot other operating systems, you will have to chain-load them (*note
749
FIXME: this section is incomplete.
751
1. Run the command `boot' (*note boot::).
753
However, DOS and Windows have some deficiencies, so you might have to
754
use more complicated instructions. *Note DOS/Windows::, for more
758
File: grub.info, Node: Chain-loading, Prev: Loading an operating system directly, Up: General boot methods
760
4.1.2 Chain-loading an OS
761
-------------------------
763
Operating systems that do not support Multiboot and do not have specific
764
support in GRUB (specific support is available for Linux, FreeBSD,
765
NetBSD and OpenBSD) must be chain-loaded, which involves loading
766
another boot loader and jumping to it in real mode.
768
The `chainloader' command (*note chainloader::) is used to set this
769
up. It is normally also necessary to load some GRUB modules and set the
770
appropriate root device. Putting this together, we get something like
771
this, for a Windows system on the first partition of the first hard
774
menuentry "Windows" {
781
On systems with multiple hard disks, an additional workaround may be
782
required. *Note DOS/Windows::.
784
Chain-loading is only supported on PC BIOS and EFI platforms.
787
File: grub.info, Node: OS-specific notes, Prev: General boot methods, Up: Booting
789
4.2 Some caveats on OS-specific issues
790
======================================
792
Here, we describe some caveats on several operating systems.
801
File: grub.info, Node: GNU/Hurd, Next: GNU/Linux, Up: OS-specific notes
806
Since GNU/Hurd is Multiboot-compliant, it is easy to boot it; there is
807
nothing special about it. But do not forget that you have to specify a
808
root partition to the kernel.
810
1. Set GRUB's root device to the same drive as GNU/Hurd's. The
811
command `search --file --set /boot/gnumach.gz' or similar may help
812
you (*note search::).
814
2. Load the kernel and the modules, like this:
816
grub> multiboot /boot/gnumach.gz root=device:hd0s1
817
grub> module /hurd/ext2fs.static ext2fs --readonly \
818
--multiboot-command-line='${kernel-command-line}' \
819
--host-priv-port='${host-port}' \
820
--device-master-port='${device-port}' \
821
--exec-server-task='${exec-task}' -T typed '${root}' \
822
'$(task-create)' '$(task-resume)'
823
grub> module /lib/ld.so.1 exec /hurd/exec '$(exec-task=task-create)'
825
3. Finally, run the command `boot' (*note boot::).
828
File: grub.info, Node: GNU/Linux, Next: DOS/Windows, Prev: GNU/Hurd, Up: OS-specific notes
833
It is relatively easy to boot GNU/Linux from GRUB, because it somewhat
834
resembles to boot a Multiboot-compliant OS.
836
1. Set GRUB's root device to the same drive as GNU/Linux's. The
837
command `search --file --set /vmlinuz' or similar may help you
840
2. Load the kernel using the command `linux' (*note linux::):
842
grub> linux /vmlinuz root=/dev/sda1
844
If you need to specify some kernel parameters, just append them to
845
the command. For example, to set `acpi' to `off', do this:
847
grub> linux /vmlinuz root=/dev/sda1 acpi=off
849
See the documentation in the Linux source tree for complete
850
information on the available options.
852
With `linux' GRUB uses 32-bit protocol. Some BIOS services like APM
853
or EDD aren't available with this protocol. In this case you need
856
grub> linux16 /vmlinuz root=/dev/sda1 acpi=off
858
3. If you use an initrd, execute the command `initrd' (*note initrd::)
863
If you used `linux16' you need to use `initrd16':
865
grub> initrd16 /initrd
867
4. Finally, run the command `boot' (*note boot::).
869
*Caution:* If you use an initrd and specify the `mem=' option to the
870
kernel to let it use less than actual memory size, you will also have
871
to specify the same memory size to GRUB. To let GRUB know the size, run
872
the command `uppermem' _before_ loading the kernel. *Note uppermem::,
873
for more information.
876
File: grub.info, Node: DOS/Windows, Prev: GNU/Linux, Up: OS-specific notes
881
GRUB cannot boot DOS or Windows directly, so you must chain-load them
882
(*note Chain-loading::). However, their boot loaders have some critical
883
deficiencies, so it may not work to just chain-load them. To overcome
884
the problems, GRUB provides you with two helper functions.
886
If you have installed DOS (or Windows) on a non-first hard disk, you
887
have to use the disk swapping technique, because that OS cannot boot
888
from any disks but the first one. The workaround used in GRUB is the
889
command `drivemap' (*note drivemap::), like this:
891
drivemap -s (hd0) (hd1)
893
This performs a "virtual" swap between your first and second hard
896
*Caution:* This is effective only if DOS (or Windows) uses BIOS to
897
access the swapped disks. If that OS uses a special driver for the
898
disks, this probably won't work.
900
Another problem arises if you installed more than one set of
901
DOS/Windows onto one disk, because they could be confused if there are
902
more than one primary partitions for DOS/Windows. Certainly you should
903
avoid doing this, but there is a solution if you do want to do so. Use
904
the partition hiding/unhiding technique.
906
If GRUB "hides" a DOS (or Windows) partition (*note parttool::), DOS
907
(or Windows) will ignore the partition. If GRUB "unhides" a DOS (or
908
Windows) partition, DOS (or Windows) will detect the partition. Thus,
909
if you have installed DOS (or Windows) on the first and the second
910
partition of the first hard disk, and you want to boot the copy on the
911
first partition, do the following:
913
parttool (hd0,1) hidden-
914
parttool (hd0,2) hidden+
917
parttool ${root} boot+
921
File: grub.info, Node: Configuration, Next: Theme file format, Prev: Booting, Up: Top
923
5 Writing your own configuration file
924
*************************************
926
GRUB is configured using `grub.cfg', usually located under
927
`/boot/grub'. This file is quite flexible, but most users will not
928
need to write the whole thing by hand.
932
* Simple configuration:: Recommended for most users
933
* Shell-like scripting:: For power users and developers
934
* Embedded configuration:: Embedding a configuration file into GRUB
937
File: grub.info, Node: Simple configuration, Next: Shell-like scripting, Up: Configuration
939
5.1 Simple configuration handling
940
=================================
942
The program `grub-mkconfig' (*note Invoking grub-mkconfig::) generates
943
`grub.cfg' files suitable for most cases. It is suitable for use when
944
upgrading a distribution, and will discover available kernels and
945
attempt to generate menu entries for them.
947
The file `/etc/default/grub' controls the operation of
948
`grub-mkconfig'. It is sourced by a shell script, and so must be valid
949
POSIX shell input; normally, it will just be a sequence of `KEY=value'
950
lines, but if the value contains spaces or other special characters
951
then it must be quoted. For example:
953
GRUB_TERMINAL_INPUT="console serial"
955
Valid keys in `/etc/default/grub' are as follows:
958
The default menu entry. This may be a number, in which case it
959
identifies the Nth entry in the generated menu counted from zero,
960
or the full name of a menu entry, or the special string `saved'.
961
Using the full name may be useful if you want to set a menu entry
962
as the default even though there may be a variable number of
965
If you set this to `saved', then the default menu entry will be
966
that saved by `GRUB_SAVEDEFAULT', `grub-set-default', or
972
If this option is set to `true', then, when an entry is selected,
973
save it as a new default entry for use by future runs of GRUB.
974
This is only useful if `GRUB_DEFAULT=saved'; it is a separate
975
option because `GRUB_DEFAULT=saved' is useful without this option,
976
in conjunction with `grub-set-default' or `grub-reboot'. Unset by
977
default. The remarks of *note Changes from GRUB Legacy:: on the
978
availability of `save_env' apply.
981
Boot the default entry this many seconds after the menu is
982
displayed, unless a key is pressed. The default is `5'. Set to
983
`0' to boot immediately without displaying the menu, or to `-1' to
986
`GRUB_HIDDEN_TIMEOUT'
987
Wait this many seconds for a key to be pressed before displaying
988
the menu. If no key is pressed during that time, boot
989
immediately. Unset by default.
991
`GRUB_HIDDEN_TIMEOUT_QUIET'
992
In conjunction with `GRUB_HIDDEN_TIMEOUT', set this to `true' to
993
suppress the verbose countdown while waiting for a key to be
994
pressed before displaying the menu. Unset by default.
996
`GRUB_DEFAULT_BUTTON'
997
`GRUB_TIMEOUT_BUTTON'
998
`GRUB_HIDDEN_TIMEOUT_BUTTON'
999
`GRUB_BUTTON_CMOS_ADDRESS'
1000
Variants of the corresponding variables without the `_BUTTON'
1001
suffix, used to support vendor-specific power buttons. *Note
1002
Vendor power-on keys::.
1005
Set by distributors of GRUB to their identifying name. This is
1006
used to generate more informative menu entry titles.
1008
`GRUB_TERMINAL_INPUT'
1009
Select the terminal input device. You may select multiple devices
1010
here, separated by spaces.
1012
Valid terminal input names depend on the platform, but may include
1013
`console' (PC BIOS and EFI consoles), `serial' (serial terminal),
1014
`ofconsole' (Open Firmware console), `at_keyboard' (PC AT
1015
keyboard, mainly useful with Coreboot), or `usb_keyboard' (USB
1016
keyboard using the HID Boot Protocol, for cases where the firmware
1017
does not handle this).
1019
The default is to use the platform's native terminal input.
1021
`GRUB_TERMINAL_OUTPUT'
1022
Select the terminal output device. You may select multiple
1023
devices here, separated by spaces.
1025
Valid terminal output names depend on the platform, but may include
1026
`console' (PC BIOS and EFI consoles), `serial' (serial terminal),
1027
`gfxterm' (graphics-mode output), `ofconsole' (Open Firmware
1028
console), or `vga_text' (VGA text output, mainly useful with
1031
The default is to use the platform's native terminal output.
1034
If this option is set, it overrides both `GRUB_TERMINAL_INPUT' and
1035
`GRUB_TERMINAL_OUTPUT' to the same value.
1037
`GRUB_SERIAL_COMMAND'
1038
A command to configure the serial port when using the serial
1039
console. *Note serial::. Defaults to `serial'.
1041
`GRUB_CMDLINE_LINUX'
1042
Command-line arguments to add to menu entries for the Linux kernel.
1044
`GRUB_CMDLINE_LINUX_DEFAULT'
1045
Unless `GRUB_DISABLE_RECOVERY' is set to `true', two menu entries
1046
will be generated for each Linux kernel: one default entry and one
1047
entry for recovery mode. This option lists command-line arguments
1048
to add only to the default menu entry, after those listed in
1049
`GRUB_CMDLINE_LINUX'.
1051
`GRUB_CMDLINE_NETBSD'
1052
`GRUB_CMDLINE_NETBSD_DEFAULT'
1053
As `GRUB_CMDLINE_LINUX' and `GRUB_CMDLINE_LINUX_DEFAULT', but for
1057
`GRUB_CMDLINE_XEN_DEFAULT'
1058
As `GRUB_CMDLINE_LINUX' and `GRUB_CMDLINE_LINUX_DEFAULT', but for
1061
`GRUB_DISABLE_LINUX_UUID'
1062
Normally, `grub-mkconfig' will generate menu entries that use
1063
universally-unique identifiers (UUIDs) to identify the root
1064
filesystem to the Linux kernel, using a `root=UUID=...' kernel
1065
parameter. This is usually more reliable, but in some cases it
1066
may not be appropriate. To disable the use of UUIDs, set this
1069
`GRUB_DISABLE_RECOVERY'
1070
If this option is set to `true', disable the generation of recovery
1073
`GRUB_VIDEO_BACKEND'
1074
If graphical video support is required, either because the
1075
`gfxterm' graphical terminal is in use or because
1076
`GRUB_GFXPAYLOAD_LINUX' is set, then `grub-mkconfig' will normally
1077
load all available GRUB video drivers and use the one most
1078
appropriate for your hardware. If you need to override this for
1079
some reason, then you can set this option.
1081
After `grub-install' has been run, the available video drivers are
1082
listed in `/boot/grub/video.lst'.
1085
Set the resolution used on the `gfxterm' graphical terminal. Note
1086
that you can only use modes which your graphics card supports via
1087
VESA BIOS Extensions (VBE), so for example native LCD panel
1088
resolutions may not be available. The default is `640x480'.
1091
Set a background image for use with the `gfxterm' graphical
1092
terminal. The value of this option must be a file readable by
1093
GRUB at boot time, and it must end with `.png', `.tga', `.jpg', or
1094
`.jpeg'. The image will be scaled if necessary to fit the screen.
1097
Set a theme for use with the `gfxterm' graphical terminal.
1099
`GRUB_GFXPAYLOAD_LINUX'
1100
Set to `text' to force the Linux kernel to boot in normal text
1101
mode, `keep' to preserve the graphics mode set using
1102
`GRUB_GFXMODE', `WIDTHxHEIGHT'[`xDEPTH'] to set a particular
1103
graphics mode, or a sequence of these separated by commas or
1104
semicolons to try several modes in sequence.
1106
Depending on your kernel, your distribution, your graphics card,
1107
and the phase of the moon, note that using this option may cause
1108
GNU/Linux to suffer from various display problems, particularly
1109
during the early part of the boot sequence. If you have problems,
1110
set this option to `text' and GRUB will tell Linux to boot in
1113
`GRUB_DISABLE_OS_PROBER'
1114
Normally, `grub-mkconfig' will try to use the external `os-prober'
1115
program, if installed, to discover other operating systems
1116
installed on the same system and generate appropriate menu entries
1117
for them. Set this option to `true' to disable this.
1120
Play a tune on the speaker when GRUB starts. This is particularly
1121
useful for users unable to see the screen. The value of this
1122
option is passed directly to *note play::.
1125
If this option is set, GRUB will issue a *note badram:: command to
1126
filter out specified regions of RAM.
1129
For more detailed customisation of `grub-mkconfig''s output, you may
1130
edit the scripts in `/etc/grub.d' directly. `/etc/grub.d/40_custom' is
1131
particularly useful for adding entire custom menu entries; simply type
1132
the menu entries you want to add at the end of that file, making sure
1133
to leave at least the first two lines intact.
1136
File: grub.info, Node: Shell-like scripting, Next: Embedded configuration, Prev: Simple configuration, Up: Configuration
1138
5.2 Writing full configuration files directly
1139
=============================================
1141
`grub.cfg' is written in GRUB's built-in scripting language, which has
1142
a syntax quite similar to that of GNU Bash and other Bourne shell
1148
A "word" is a sequence of characters considered as a single unit by
1149
GRUB. Words are separated by "metacharacters", which are the following
1150
plus space, tab, and newline:
1154
Quoting may be used to include metacharacters in words; see below.
1159
Reserved words have a special meaning to GRUB. The following words are
1160
recognised as reserved when unquoted and either the first word of a
1161
simple command or the third word of a `for' command:
1164
case do done elif else esac fi for function
1165
if in menuentry select then time until while
1167
Not all of these reserved words have a useful purpose yet; some are
1168
reserved for future expansion.
1173
Quoting is used to remove the special meaning of certain characters or
1174
words. It can be used to treat metacharacters as part of a word, to
1175
prevent reserved words from being recognised as such, and to prevent
1178
There are three quoting mechanisms: the escape character, single
1179
quotes, and double quotes.
1181
A non-quoted backslash (\) is the "escape character". It preserves
1182
the literal value of the next character that follows, with the
1183
exception of newline.
1185
Enclosing characters in single quotes preserves the literal value of
1186
each character within the quotes. A single quote may not occur between
1187
single quotes, even when preceded by a backslash.
1189
Enclosing characters in double quotes preserves the literal value of
1190
all characters within the quotes, with the exception of `$' and `\'.
1191
The `$' character retains its special meaning within double quotes.
1192
The backslash retains its special meaning only when followed by one of
1193
the following characters: `$', `"', `\', or newline. A
1194
backslash-newline pair is treated as a line continuation (that is, it is
1195
removed from the input stream and effectively ignored(1) (*note
1196
Shell-like scripting-Footnote-1::)). A double quote may be quoted
1197
within double quotes by preceding it with a backslash.
1202
The `$' character introduces variable expansion. The variable name to
1203
be expanded may be enclosed in braces, which are optional but serve to
1204
protect the variable to be expanded from characters immediately
1205
following it which could be interpreted as part of the name.
1207
Normal variable names begin with an alphabetic character, followed
1208
by zero or more alphanumeric characters.
1210
Positional variable names consist of one or more digits. They
1211
represent parameters passed to function calls, with `$1' representing
1212
the first parameter, and so on.
1214
The special variable name `?' expands to the exit status of the most
1215
recently executed command. When positional variable names are active,
1216
other special variable names `@', `*' and `#' are defined and they
1217
expand to all positional parameters with necessary quoting, positional
1218
parameters without any quoting, and positional parameter count
1224
A word beginning with `#' causes that word and all remaining characters
1225
on that line to be ignored.
1230
A "simple command" is a sequence of words separated by spaces or tabs
1231
and terminated by a semicolon or a newline. The first word specifies
1232
the command to be executed. The remaining words are passed as
1233
arguments to the invoked command.
1235
The return value of a simple command is its exit status. If the
1236
reserved word `!' precedes the command, then the return value is
1237
instead the logical negation of the command's exit status.
1242
A "compound command" is one of the following:
1244
for NAME in WORD ...; do LIST; done
1245
The list of words following `in' is expanded, generating a list of
1246
items. The variable NAME is set to each element of this list in
1247
turn, and LIST is executed each time. The return value is the
1248
exit status of the last command that executes. If the expansion
1249
of the items following `in' results in an empty list, no commands
1250
are executed, and the return status is 0.
1252
if LIST; then LIST; [elif LIST; then LIST;] ... [else LIST;] fi
1253
The `if' LIST is executed. If its exit status is zero, the `then'
1254
LIST is executed. Otherwise, each `elif' LIST is executed in
1255
turn, and if its exit status is zero, the corresponding `then'
1256
LIST is executed and the command completes. Otherwise, the `else'
1257
LIST is executed, if present. The exit status is the exit status
1258
of the last command executed, or zero if no condition tested true.
1260
while COND; do LIST; done
1261
until COND; do LIST; done
1262
The `while' command continuously executes the `do' LIST as long as
1263
the last command in COND returns an exit status of zero. The
1264
`until' command is identical to the `while' command, except that
1265
the test is negated; the `do' LIST is executed as long as the last
1266
command in COND returns a non-zero exit status. The exit status
1267
of the `while' and `until' commands is the exit status of the last
1268
`do' LIST command executed, or zero if none was executed.
1270
function NAME { COMMAND; ... }
1271
This defines a function named NAME. The "body" of the function is
1272
the list of commands within braces, each of which must be
1273
terminated with a semicolon or a newline. This list of commands
1274
will be executed whenever NAME is specified as the name of a
1275
simple command. Function definitions do not affect the exit
1276
status in `$?'. When executed, the exit status of a function is
1277
the exit status of the last command executed in the body.
1279
menuentry TITLE [`--class=class' ...] [`--users=users'] [`--hotkey=key'] { COMMAND; ... }
1285
Some built-in commands are also provided by GRUB script to help script
1286
writers perform actions that are otherwise not possible. For example,
1287
these include commands to jump out of a loop without fully completing
1291
Exit from within a `for', `while', or `until' loop. If `n' is
1292
specified, break `n' levels. `n' must be greater than or equal to
1293
1. If `n' is greater than the number of enclosing loops, all
1294
enclosing loops are exited. The return value is 0 unless `n' is
1295
not greater than or equal to 1.
1298
Resume the next iteration of the enclosing `for', `while' or
1299
`until' loop. If `n' is specified, resume at the `n'th enclosing
1300
loop. `n' must be greater than or equal to 1. If `n' is greater
1301
than the number of enclosing loops, the last enclosing loop (the
1302
"top-level" loop) is resumed. The return value is 0 unless `n' is
1303
not greater than or equal to 1.
1306
Causes a function to exit with the return value specified by `n'.
1307
If `n' is omitted, the return status is that of the last command
1308
executed in the function body. If used outside a function the
1309
return status is false.
1312
The positional parameters from `n'+1 ... are renamed to `$1'....
1313
Parameters represented by the numbers `$#' down to `$#'-`n'+1 are
1314
unset. `n' must be a non-negative number less than or equal to
1315
`$#'. If `n' is 0, no parameters are changed. If `n' is not
1316
given, it is assumed to be 1. If `n' is greater than `$#', the
1317
positional parameters are not changed. The return status is
1318
greater than zero if `n' is greater than `$#' or less than zero;
1323
File: grub.info, Node: Shell-like scripting-Footnotes, Up: Shell-like scripting
1325
(1) Currently a backslash-newline pair within a variable name is not
1326
handled properly, so use this feature with some care.
1329
File: grub.info, Node: Embedded configuration, Prev: Shell-like scripting, Up: Configuration
1331
5.3 Embedding a configuration file into GRUB
1332
============================================
1334
GRUB supports embedding a configuration file directly into the core
1335
image, so that it is loaded before entering normal mode. This is
1336
useful, for example, when it is not straightforward to find the real
1337
configuration file, or when you need to debug problems with loading
1338
that file. `grub-install' uses this feature when it is not using BIOS
1339
disk functions or when installing to a different disk from the one
1340
containing `/boot/grub', in which case it needs to use the `search'
1341
command (*note search::) to find `/boot/grub'.
1343
To embed a configuration file, use the `-c' option to
1344
`grub-mkimage'. The file is copied into the core image, so it may
1345
reside anywhere on the file system, and may be removed after running
1348
After the embedded configuration file (if any) is executed, GRUB
1349
will load the `normal' module, which will then read the real
1350
configuration file from `$prefix/grub.cfg'. By this point, the `root'
1351
variable will also have been set to the root device name. For example,
1352
`prefix' might be set to `(hd0,1)/boot/grub', and `root' might be set to
1353
`hd0,1'. Thus, in most cases, the embedded configuration file only
1354
needs to set the `prefix' and `root' variables, and then drop through
1355
to GRUB's normal processing. A typical example of this might look like
1358
search.fs_uuid 01234567-89ab-cdef-0123-456789abcdef root
1359
set prefix=($root)/boot/grub
1361
(The `search_fs_uuid' module must be included in the core image for
1362
this example to work.)
1364
In more complex cases, it may be useful to read other configuration
1365
files directly from the embedded configuration file. This allows such
1366
things as reading files not called `grub.cfg', or reading files from a
1367
directory other than that where GRUB's loadable modules are installed.
1368
To do this, include the `configfile' and `normal' modules in the core
1369
image, and embed a configuration file that uses the `configfile'
1370
command to load another file. The following example of this also
1371
requires the `echo', `search_label', and `test' modules to be included
1374
search.fs_label grub root
1375
if [ -e /boot/grub/example/test1.cfg ]; then
1376
set prefix=($root)/boot/grub
1377
configfile /boot/grub/example/test1.cfg
1379
if [ -e /boot/grub/example/test2.cfg ]; then
1380
set prefix=($root)/boot/grub
1381
configfile /boot/grub/example/test2.cfg
1383
echo "Could not find an example configuration file!"
1387
The embedded configuration file may not contain menu entries
1388
directly, but may only read them from elsewhere using `configfile'.
1391
File: grub.info, Node: Theme file format, Next: Network, Prev: Configuration, Up: Top
1399
The GRUB graphical menu supports themes that can customize the layout
1400
and appearance of the GRUB boot menu. The theme is configured through
1401
a plain text file that specifies the layout of the various GUI
1402
components (including the boot menu, timeout progress bar, and text
1403
messages) as well as the appearance using colors, fonts, and images.
1404
Example is available in docs/example_theme.txt
1412
Colors can be specified in several ways:
1414
* HTML-style "#RRGGBB" or "#RGB" format, where *R*, *G*, and *B* are
1415
hexadecimal digits (e.g., "#8899FF")
1417
* as comma-separated decimal RGB values (e.g., "128, 128, 255")
1419
* with "SVG 1.0 color names" (e.g., "cornflowerblue") which must be
1420
specified in lowercase.
1425
The fonts GRUB uses "PFF2 font format" bitmap fonts. Fonts are
1426
specified with full font names. Currently there is no provision for a
1427
preference list of fonts, or deriving one font from another. Fonts are
1428
loaded with the "loadfont" command in GRUB. To see the list of loaded
1429
fonts, execute the "lsfonts" command. If there are too many fonts to
1430
fit on screen, do "set pager=1" before executing "lsfonts".
1439
Progress bars are used to display the remaining time before GRUB
1440
boots the default menu entry. To create a progress bar that will
1441
display the remaining time before automatic boot, simply create a
1442
"progress_bar" component with the id "__timeout__". This indicates to
1443
GRUB that the progress bar should be updated as time passes, and it
1444
should be made invisible if the countdown to automatic boot is
1445
interrupted by the user.
1447
Progress bars may optionally have text displayed on them. This is
1448
controlled through the "show_text" property, which can be set to either
1449
"true" or "false" to control whether text is displayed. When GRUB is
1450
counting down to automatic boot, the text informs the user of the
1451
number of seconds remaining.
1453
6.2.4 Circular Progress Indicator
1454
---------------------------------
1456
The circular progress indicator functions similarly to the progress
1457
bar. When given an id of "__timeout__", GRUB updates the circular
1458
progress indicator's value to indicate the time remaining. For the
1459
circular progress indicator, there are two images used to render it:
1460
the *center* image, and the *tick* image. The center image is rendered
1461
in the center of the component, while the tick image is used to render
1462
each mark along the circumference of the indicator.
1467
Text labels can be placed on the boot screen. The font, color, and
1468
horizontal alignment can be specified for labels. If a label is given
1469
the id "__timeout__", then the "text" property for that label is also
1470
updated with a message informing the user of the number of seconds
1471
remaining until automatic boot. This is useful in case you want the
1472
text displayed somewhere else instead of directly on the progress bar.
1477
The boot menu where GRUB displays the menu entries from the "grub.cfg"
1478
file. It is a list of items, where each item has a title and an
1479
optional icon. The icon is selected based on the *classes* specified
1480
for the menu entry. If there is a PNG file named "myclass.png" in the
1481
"grub/themes/icons" directory, it will be displayed for items which
1482
have the class *myclass*. The boot menu can be customized in several
1483
ways, such as the font and color used for the menu entry title, and by
1484
specifying styled boxes for the menu itself and for the selected item
1490
One of the most important features for customizing the layout is the
1491
use of *styled boxes*. A styled box is composed of 9 rectangular (and
1492
potentially empty) regions, which are used to seamlessly draw the
1493
styled box on screen:
1495
Northwest (nw) North (n) Northeast (ne)
1496
West (w) Center (c) East (e)
1497
Southwest (sw) South (s) Southeast (se)
1499
To support any size of box on screen, the center slice and the
1500
slices for the top, bottom, and sides are all scaled to the correct
1501
size for the component on screen, using the following rules:
1503
1. The edge slices (north, south, east, and west) are scaled in the
1504
direction of the edge they are adjacent to. For instance, the
1505
west slice is scaled vertically.
1507
2. The corner slices (northwest, northeast, southeast, and southwest)
1510
3. The center slice is scaled to fill the remaining space in the
1513
As an example of how an image might be sliced up, consider the
1514
styled box used for a terminal view.
1518
6.2.8 Creating Styled Box Images
1519
--------------------------------
1521
The Inkscape_ scalable vector graphics editor is a very useful tool for
1522
creating styled box images. One process that works well for slicing a
1523
drawing into the necessary image slices is:
1525
1. Create or open the drawing you'd like use.
1527
2. Create a new layer on the top of the layer stack. Make it
1528
visible. Select this layer as the current layer.
1530
3. Draw 9 rectangles on your drawing where you'd like the slices to
1531
be. Clear the fill option, and set the stroke to 1 pixel wide
1532
solid stroke. The corners of the slices must meet precisely; if
1533
it is off by a single pixel, it will probably be evident when the
1534
styled box is rendered in the GRUB menu. You should probably go
1535
to File | Document Properties | Grids and enable a grid or create
1536
a guide (click on one of the rulers next to the drawing and drag
1537
over the drawing; release the mouse button to place the guide) to
1538
help place the rectangles precisely.
1540
4. Right click on the center slice rectangle and choose Object
1541
Properties. Change the "Id" to "slice_c" and click Set. Repeat
1542
this for the remaining 8 rectangles, giving them Id values of
1543
"slice_n", "slice_ne", "slice_e", and so on according to the
1546
5. Save the drawing.
1548
6. Select all the slice rectangles. With the slice layer selected,
1549
you can simply press Ctrl+A to select all rectangles. The status
1550
bar should indicate that 9 rectangles are selected.
1552
7. Click the layer hide icon for the slice layer in the layer
1553
palette. The rectangles will remain selected, even though they
1556
8. Choose File | Export Bitmap and check the *Batch export 9 selected
1557
objects* box. Make sure that *Hide all except selected* is
1558
unchecked. click *Export*. This will create PNG files in the same
1559
directory as the drawing, named after the slices. These can now
1560
be used for a styled box in a GRUB theme.
1562
6.3 Theme File Manual
1563
=====================
1565
The theme file is a plain text file. Lines that begin with "#" are
1566
ignored and considered comments. (Note: This may not be the case if
1567
the previous line ended where a value was expected.)
1569
The theme file contains two types of statements:
1570
1. Global properties.
1572
2. Component construction.
1574
6.3.1 Global Properties
1575
-----------------------
1580
Global properties are specified with the simple format:
1583
* name2: "value which may contain spaces"
1587
In this example, name3 is assigned a color value.
1589
6.3.3 Global Property List
1590
--------------------------
1592
title-text Specifies the text to display at the top
1593
center of the screen as a title.
1594
title-font Defines the font used for the title
1595
message at the top of the screen.
1596
title-color Defines the color of the title message.
1597
message-font Defines the font used for messages, such
1598
as when GRUB is unable to automatically
1600
message-color Defines the color of the message text.
1601
message-bg-color Defines the background color of the
1603
desktop-image Specifies the image to use as the
1604
background. It will be scaled to fit the
1606
desktop-color Specifies the color for the background if
1607
*desktop-image* is not specified.
1608
terminal-box Specifies the file name pattern for the
1609
styled box slices used for the command
1610
line terminal window. For example,
1611
"terminal-box: terminal_*.png" will use
1612
the images "terminal_c.png" as the center
1613
area, "terminal_n.png" as the north (top)
1614
edge, "terminal_nw.png" as the northwest
1615
(upper left) corner, and so on. If the
1616
image for any slice is not found, it will
1617
simply be left empty.
1619
6.3.4 Component Construction
1620
----------------------------
1622
Greater customizability comes is provided by components. A tree of
1623
components forms the user interface. *Containers* are components that
1624
can contain other components, and there is always a single root
1625
component which is an instance of a *canvas* container.
1627
Components are created in the theme file by prefixing the type of
1628
component with a '+' sign:
1630
` + label { text="GRUB" font="aqui 11" color="#8FF" } '
1632
properties of a component are specified as "name = value" (whitespace
1633
surrounding tokens is optional and is ignored) where *value* may be:
1634
* a single word (e.g., "align = center", "color = #FF8080"),
1636
* a quoted string (e.g., "text = "Hello, World!""), or
1638
* a tuple (e.g., "preferred_size = (120, 80)").
1640
6.3.5 Component List
1641
--------------------
1643
The following is a list of the components and the properties they
1646
* label A label displays a line of text.
1649
text The text to display.
1650
font The font to use for text display.
1651
color The color of the text.
1652
align The horizontal alignment of the text within
1653
the component. Options are "left", "center",
1656
* image A component that displays an image. The image is scaled
1657
to fit the component, although the preferred size defaults to
1658
the image's original size unless the "preferred_size" property
1663
file The full path to the image file to load.
1665
* progress_bar Displays a horizontally oriented progress bar. It
1666
can be rendered using simple solid filled rectangles, or using
1667
a pair of pixmap styled boxes.
1671
fg_color The foreground color for plain solid color
1673
bg_color The background color for plain solid color
1675
border_color The border color for plain solid color
1677
text_color The text color.
1678
show_text Boolean value indicating whether or not text
1679
should be displayed on the progress bar. If
1680
set to *false*, then no text will be displayed
1681
on the bar. If set to any other value, text
1682
will be displayed on the bar.
1683
bar_style The styled box specification for the frame of
1684
the progress bar. Example:
1685
"progress_frame_*.png"
1686
highlight_styleThe styled box specification for the
1687
highlighted region of the progress bar. This
1688
box will be used to paint just the highlighted
1689
region of the bar, and will be increased in
1690
size as the bar nears completion. Example:
1691
"progress_hl_*.png".
1692
text The text to display on the progress bar. If
1693
the progress bar's ID is set to "__timeout__",
1694
then GRUB will updated this property with an
1695
informative message as the timeout approaches.
1696
value The progress bar current value. Normally not
1698
start The progress bar start value. Normally not
1700
end The progress bar end value. Normally not set
1703
* circular_progress Displays a circular progress indicator. The
1704
appearance of this component is determined by two images: the
1705
*center* image and the *tick* image. The center image is
1706
generally larger and will be drawn in the center of the
1707
component. Around the circumference of a circle within the
1708
component, the tick image will be drawn a certain number of
1709
times, depending on the properties of the component.
1713
center_bitmap The file name of the image to draw in
1714
the center of the component.
1715
tick_bitmap The file name of the image to draw for
1717
num_ticks The number of ticks that make up a full
1719
ticks_disappear Boolean value indicating whether tick
1720
marks should progressively appear,
1721
or progressively disappear as *value*
1722
approaches *end*. Specify "true"
1724
value The progress indicator current value.
1725
Normally not set manually.
1726
start The progress indicator start value.
1727
Normally not set manually.
1728
end The progress indicator end value.
1729
Normally not set manually.
1731
* boot_menu Displays the GRUB boot menu. It allows selecting
1732
items and executing them.
1736
item_font The font to use for the menu item
1738
selected_item_font The font to use for the selected
1739
menu item, or "inherit" (the
1740
default) to use "item_font"
1741
for the selected menu item as
1743
item_color The color to use for the menu
1745
selected_item_color The color to use for the selected
1746
menu item, or "inherit" (the
1748
"item_color" for the selected
1750
icon_width The width of menu item icons.
1751
Icons are scaled to the specified
1753
icon_height The height of menu item icons.
1754
item_height The height of each menu item in
1756
item_padding The amount of space in pixels to
1757
leave on each side of the menu
1759
item_icon_space The space between an item's icon
1760
and the title text, in pixels.
1761
item_spacing The amount of space to leave
1762
between menu items, in pixels.
1763
menu_pixmap_style The image file pattern for the
1764
menu frame styled box.
1765
Example: "menu_*.png" (this will
1766
use images such as "menu_c.png",
1767
"menu_w.png", `menu_nw.png",
1769
selected_item_pixmap_style The image file pattern for the
1770
selected item highlight styled
1772
scrollbar Boolean value indicating whether
1773
the scroll bar should be drawn if
1774
the frame and thumb styled
1775
boxes are configured.
1776
scrollbar_frame The image file pattern for the
1778
Example: "scrollbar_*.png"
1779
scrollbar_thumb The image file pattern for the
1780
scroll bar thumb (the part of the
1781
scroll bar that moves as
1783
Example: "scrollbar_thumb_*.png"
1784
max_items_shown The maximum number of items to
1785
show on the menu. If there are
1786
more than *max_items_shown*
1787
items in the menu, the list will
1788
scroll to make all items
1791
* canvas Canvas is a container that allows manual placement of
1792
components within it. It does not alter the positions of its
1793
child components. It assigns all child components their
1796
* hbox The *hbox* container lays out its children from left to
1797
right, giving each one its preferred width. The height of each
1798
child is set to the maximum of the preferred heights of all
1801
* vbox The *vbox* container lays out its children from top to
1802
bottom, giving each one its preferred height. The width of
1803
each child is set to the maximum of the preferred widths of all
1806
6.3.6 Common properties
1807
-----------------------
1809
The following properties are supported by all components:
1811
The distance from the left border of container to left border of
1812
the object in either of three formats:
1815
p%+x mixture of both
1818
The distance from the left border of container to left border of
1819
the object in same format.
1822
The width of object in same format.
1825
The height of object in same format.
1828
The identifier for the component. This can be any arbitrary
1829
string. The ID can be used by scripts to refer to various
1830
components in the GUI component tree. Currently, there is one
1831
special ID value that GRUB recognizes:
1833
"__timeout__" Any component with this ID will have its
1834
*text*, *start*, *end*, *value*, and *visible*
1835
properties set by GRUB when it is counting
1836
down to an automatic boot of the default menu
1840
File: grub.info, Node: Network, Next: Serial terminal, Prev: Theme file format, Up: Top
1842
7 Booting GRUB from the network
1843
*******************************
1845
The following instructions only work on PC BIOS systems where the
1846
Preboot eXecution Environment (PXE) is available.
1848
To generate a PXE boot image, run:
1850
grub-mkimage --format=i386-pc-pxe --output=grub.pxe --prefix='(pxe)/boot/grub' pxe pxecmd
1852
Copy `grub.pxe', `/boot/grub/*.mod', and `/boot/grub/*.lst' to the
1853
PXE (TFTP) server, ensuring that `*.mod' and `*.lst' are accessible via
1854
the `/boot/grub/' path from the TFTP server root. Set the DHCP server
1855
configuration to offer `grub.pxe' as the boot file (the `filename'
1856
option in ISC dhcpd).
1858
You can also use the `grub-mknetdir' utility to generate an image
1859
and a GRUB directory tree, rather than copying files around manually.
1861
After GRUB has started, files on the TFTP server will be accessible
1862
via the `(pxe)' device.
1864
The server and gateway IP address can be controlled by changing the
1865
`(pxe)' device name to `(pxe:SERVER-IP)' or
1866
`(pxe:SERVER-IP:GATEWAY-IP)'. Note that this should be changed both in
1867
the prefix and in any references to the device name in the
1870
GRUB provides several environment variables which may be used to
1871
inspect or change the behaviour of the PXE device:
1874
The IP address of this machine. Read-only.
1877
The network interface's MAC address. Read-only.
1880
The client host name provided by DHCP. Read-only.
1883
The client domain name provided by DHCP. Read-only.
1886
The path to the client's root disk provided by DHCP. Read-only.
1888
`net_pxe_extensionspath'
1889
The path to additional DHCP vendor extensions provided by DHCP.
1893
The boot file name provided by DHCP. Read-only.
1895
`net_pxe_dhcp_server_name'
1896
The name of the DHCP server responsible for these boot parameters.
1900
The PXE transfer block size. Read-write, defaults to 512.
1902
`pxe_default_server'
1903
The default PXE server. Read-write, although setting this is only
1904
useful before opening a PXE device.
1906
`pxe_default_gateway'
1907
The default gateway to use when contacting the PXE server.
1908
Read-write, although setting this is only useful before opening a
1912
File: grub.info, Node: Serial terminal, Next: Vendor power-on keys, Prev: Network, Up: Top
1914
8 Using GRUB via a serial line
1915
******************************
1917
This chapter describes how to use the serial terminal support in GRUB.
1919
If you have many computers or computers with no display/keyboard, it
1920
could be very useful to control the computers through serial
1921
communications. To connect one computer with another via a serial line,
1922
you need to prepare a null-modem (cross) serial cable, and you may need
1923
to have multiport serial boards, if your computer doesn't have extra
1924
serial ports. In addition, a terminal emulator is also required, such as
1925
minicom. Refer to a manual of your operating system, for more
1928
As for GRUB, the instruction to set up a serial terminal is quite
1929
simple. Here is an example:
1931
grub> serial --unit=0 --speed=9600
1932
grub> terminal_input serial; terminal_output serial
1934
The command `serial' initializes the serial unit 0 with the speed
1935
9600bps. The serial unit 0 is usually called `COM1', so, if you want to
1936
use COM2, you must specify `--unit=1' instead. This command accepts
1937
many other options, so please refer to *note serial::, for more details.
1939
The commands `terminal_input' (*note terminal_input::) and
1940
`terminal_output' (*note terminal_output::) choose which type of
1941
terminal you want to use. In the case above, the terminal will be a
1942
serial terminal, but you can also pass `console' to the command, as
1943
`terminal serial console'. In this case, a terminal in which you press
1944
any key will be selected as a GRUB terminal. In the example above, note
1945
that you need to put both commands on the same command line, as you
1946
will lose the ability to type commands on the console after the first
1949
However, note that GRUB assumes that your terminal emulator is
1950
compatible with VT100 by default. This is true for most terminal
1951
emulators nowadays, but you should pass the option `--dumb' to the
1952
command if your terminal emulator is not VT100-compatible or implements
1953
few VT100 escape sequences. If you specify this option then GRUB
1954
provides you with an alternative menu interface, because the normal
1955
menu requires several fancy features of your terminal.
1958
File: grub.info, Node: Vendor power-on keys, Next: Images, Prev: Serial terminal, Up: Top
1960
9 Using GRUB with vendor power-on keys
1961
**************************************
1963
Some laptop vendors provide an additional power-on button which boots
1964
another OS. GRUB supports such buttons with the `GRUB_TIMEOUT_BUTTON',
1965
`GRUB_DEFAULT_BUTTON', `GRUB_HIDDEN_TIMEOUT_BUTTON' and
1966
`GRUB_BUTTON_CMOS_ADDRESS' variables in default/grub (*note Simple
1967
configuration::). `GRUB_TIMEOUT_BUTTON', `GRUB_DEFAULT_BUTTON' and
1968
`GRUB_HIDDEN_TIMEOUT_BUTTON' are used instead of the corresponding
1969
variables without the `_BUTTON' suffix when powered on using the special
1970
button. `GRUB_BUTTON_CMOS_ADDRESS' is vendor-specific and partially
1971
model-specific. Values known to the GRUB team are:
1979
To take full advantage of this function, install GRUB into the MBR
1980
(*note Installing GRUB using grub-install::).
1983
File: grub.info, Node: Images, Next: Filesystem, Prev: Vendor power-on keys, Up: Top
1988
GRUB consists of several images: a variety of bootstrap images for
1989
starting GRUB in various ways, a kernel image, and a set of modules
1990
which are combined with the kernel image to form a core image. Here is
1991
a short overview of them.
1994
On PC BIOS systems, this image is the first part of GRUB to start.
1995
It is written to a master boot record (MBR) or to the boot sector
1996
of a partition. Because a PC boot sector is 512 bytes, the size
1997
of this image is exactly 512 bytes.
1999
The sole function of `boot.img' is to read the first sector of the
2000
core image from a local disk and jump to it. Because of the size
2001
restriction, `boot.img' cannot understand any file system
2002
structure, so `grub-setup' hardcodes the location of the first
2003
sector of the core image into `boot.img' when installing GRUB.
2006
This image is used as the first sector of the core image when
2007
booting from a hard disk. It reads the rest of the core image
2008
into memory and starts the kernel. Since file system handling is
2009
not yet available, it encodes the location of the core image using
2010
a block list format.
2013
This image is used as the first sector of the core image when
2014
booting from a CD-ROM drive. It performs a similar function to
2018
This image is used as the start of the core image when booting
2019
from the network using PXE. *Note Network::.
2022
This image may be placed at the start of the core image in order
2023
to make GRUB look enough like a Linux kernel that it can be booted
2024
by LILO using an `image=' section.
2027
This image contains GRUB's basic run-time facilities: frameworks
2028
for device and file handling, environment variables, the rescue
2029
mode command-line parser, and so on. It is rarely used directly,
2030
but is built into all core images.
2033
This is the core image of GRUB. It is built dynamically from the
2034
kernel image and an arbitrary list of modules by the `grub-mkimage'
2035
program. Usually, it contains enough modules to access
2036
`/boot/grub', and loads everything else (including menu handling,
2037
the ability to load target operating systems, and so on) from the
2038
file system at run-time. The modular design allows the core image
2039
to be kept small, since the areas of disk where it must be
2040
installed are often as small as 32KB.
2042
On PC systems using the traditional MBR partition table format,
2043
the core image is usually installed in the "MBR gap" between the
2044
master boot record and the first partition, or sometimes it is
2045
installed in a file system and read directly from that. The
2046
latter is not recommended because GRUB needs to encode the
2047
location of all the core image sectors in `diskboot.img', and if
2048
the file system ever moves the core image around (as it is entitled
2049
to do) then GRUB must be reinstalled; it also means that GRUB will
2050
not be able to reliably find the core image if it resides on a
2051
different disk than the one to which `boot.img' was installed.
2053
On PC systems using the more recent GUID Partition Table (GPT)
2054
format, the core image should be installed to a BIOS Boot
2055
Partition. This may be created by GNU Parted using a command such
2058
# parted /dev/DISK set PARTITION-NUMBER bios_grub on
2060
*Caution:* Be very careful which partition you select! When GRUB
2061
finds a BIOS Boot Partition during installation, it will
2062
automatically overwrite part of it. Make sure that the partition
2063
does not contain any other data.
2066
Everything else in GRUB resides in dynamically loadable modules.
2067
These are often loaded automatically, or built into the core image
2068
if they are essential, but may also be loaded manually using the
2069
`insmod' command (*note insmod::).
2071
For GRUB Legacy users
2072
=====================
2074
GRUB 2 has a different design from GRUB Legacy, and so correspondences
2075
with the images it used cannot be exact. Nevertheless, GRUB Legacy
2076
users often ask questions in the terms they are familiar with, and so
2077
here is a brief guide to how GRUB 2's images relate to that.
2080
Stage 1 from GRUB Legacy was very similar to `boot.img' in GRUB 2,
2081
and they serve the same function.
2084
In GRUB Legacy, Stage 1.5's function was to include enough
2085
filesystem code to allow the much larger Stage 2 to be read from
2086
an ordinary filesystem. In this respect, its function was similar
2087
to `core.img' in GRUB 2. However, `core.img' is much more capable
2088
than Stage 1.5 was; since it offers a rescue shell, it is
2089
sometimes possible to recover manually in the event that it is
2090
unable to load any other modules, for example if partition numbers
2091
have changed. `core.img' is built in a more flexible way,
2092
allowing GRUB 2 to support reading modules from advanced disk
2093
types such as LVM and RAID.
2095
GRUB Legacy could run with only Stage 1 and Stage 2 in some limited
2096
configurations, while GRUB 2 requires `core.img' and cannot work
2100
GRUB 2 has no single Stage 2 image. Instead, it loads modules from
2101
`/boot/grub' at run-time.
2104
In GRUB 2, images for booting from CD-ROM drives are now
2105
constructed using `cdboot.img' and `core.img', making sure that
2106
the core image contains the `iso9660' module. It is usually best
2107
to use the `grub-mkrescue' program for this.
2110
There is as yet no equivalent for `nbgrub' in GRUB 2; it was used
2111
by Etherboot and some other network boot loaders.
2114
In GRUB 2, images for PXE network booting are now constructed using
2115
`pxeboot.img' and `core.img', making sure that the core image
2116
contains the `pxe' and `pxecmd' modules. *Note Network::.
2119
File: grub.info, Node: Filesystem, Next: Interface, Prev: Images, Up: Top
2121
11 Filesystem syntax and semantics
2122
**********************************
2124
GRUB uses a special syntax for specifying disk drives which can be
2125
accessed by BIOS. Because of BIOS limitations, GRUB cannot distinguish
2126
between IDE, ESDI, SCSI, or others. You must know yourself which BIOS
2127
device is equivalent to which OS device. Normally, that will be clear if
2128
you see the files in a device or use the command `search' (*note
2133
* Device syntax:: How to specify devices
2134
* File name syntax:: How to specify files
2135
* Block list syntax:: How to specify block lists
2138
File: grub.info, Node: Device syntax, Next: File name syntax, Up: Filesystem
2140
11.1 How to specify devices
2141
===========================
2143
The device syntax is like this:
2145
`(DEVICE[,PART-NUM][,BSD-SUBPART-LETTER])'
2147
`[]' means the parameter is optional. DEVICE should be either `fd'
2148
or `hd' followed by a digit, like `fd0'. But you can also set DEVICE
2149
to a hexadecimal or a decimal number which is a BIOS drive number, so
2150
the following are equivalent:
2156
PART-NUM represents the partition number of DEVICE, starting from
2157
one for primary partitions and from five for extended partitions, and
2158
BSD-SUBPART-LETTER represents the BSD disklabel subpartition, such as
2161
A shortcut for specifying BSD subpartitions is
2162
`(DEVICE,BSD-SUBPART-LETTER)', in this case, GRUB searches for the
2163
first PC partition containing a BSD disklabel, then finds the
2164
subpartition BSD-SUBPART-LETTER. Here is an example:
2168
The syntax `(hd0)' represents using the entire disk (or the MBR when
2169
installing GRUB), while the syntax `(hd0,1)' represents using the first
2170
partition of the disk (or the boot sector of the partition when
2173
If you enabled the network support, the special drive `(pxe)' is
2174
also available. Before using the network drive, you must initialize the
2175
network. *Note Network::, for more information.
2177
If you boot GRUB from a CD-ROM, `(cd)' is available. *Note Making a
2178
GRUB bootable CD-ROM::, for details.
2181
File: grub.info, Node: File name syntax, Next: Block list syntax, Prev: Device syntax, Up: Filesystem
2183
11.2 How to specify files
2184
=========================
2186
There are two ways to specify files, by "absolute file name" and by
2189
An absolute file name resembles a Unix absolute file name, using `/'
2190
for the directory separator (not `\' as in DOS). One example is
2191
`(hd0,1)/boot/grub/grub.cfg'. This means the file `/boot/grub/grub.cfg'
2192
in the first partition of the first hard disk. If you omit the device
2193
name in an absolute file name, GRUB uses GRUB's "root device"
2194
implicitly. So if you set the root device to, say, `(hd1,1)' by the
2195
command `set root=(hd1,1)' (*note set::), then `/boot/kernel' is the
2196
same as `(hd1,1)/boot/kernel'.
2199
File: grub.info, Node: Block list syntax, Prev: File name syntax, Up: Filesystem
2201
11.3 How to specify block lists
2202
===============================
2204
A block list is used for specifying a file that doesn't appear in the
2205
filesystem, like a chainloader. The syntax is
2206
`[OFFSET]+LENGTH[,[OFFSET]+LENGTH]...'. Here is an example:
2208
`0+100,200+1,300+300'
2210
This represents that GRUB should read blocks 0 through 99, block 200,
2211
and blocks 300 through 599. If you omit an offset, then GRUB assumes
2214
Like the file name syntax (*note File name syntax::), if a blocklist
2215
does not contain a device name, then GRUB uses GRUB's "root device". So
2216
`(hd0,2)+1' is the same as `+1' when the root device is `(hd0,2)'.
2219
File: grub.info, Node: Interface, Next: Commands, Prev: Filesystem, Up: Top
2221
12 GRUB's user interface
2222
************************
2224
GRUB has both a simple menu interface for choosing preset entries from a
2225
configuration file, and a highly flexible command-line for performing
2226
any desired combination of boot commands.
2228
GRUB looks for its configuration file as soon as it is loaded. If one
2229
is found, then the full menu interface is activated using whatever
2230
entries were found in the file. If you choose the "command-line" menu
2231
option, or if the configuration file was not found, then GRUB drops to
2232
the command-line interface.
2236
* Command-line interface:: The flexible command-line interface
2237
* Menu interface:: The simple menu interface
2238
* Menu entry editor:: Editing a menu entry
2241
File: grub.info, Node: Command-line interface, Next: Menu interface, Up: Interface
2243
12.1 The flexible command-line interface
2244
========================================
2246
The command-line interface provides a prompt and after it an editable
2247
text area much like a command-line in Unix or DOS. Each command is
2248
immediately executed after it is entered(1) (*note Command-line
2249
interface-Footnote-1::). The commands (*note Command-line and menu
2250
entry commands::) are a subset of those available in the configuration
2251
file, used with exactly the same syntax.
2253
Cursor movement and editing of the text on the line can be done via a
2254
subset of the functions available in the Bash shell:
2258
Move forward one character.
2262
Move back one character.
2266
Move to the start of the line.
2270
Move the the end of the line.
2274
Delete the character underneath the cursor.
2278
Delete the character to the left of the cursor.
2281
Kill the text from the current cursor position to the end of the
2285
Kill backward from the cursor to the beginning of the line.
2288
Yank the killed text back into the buffer at the cursor.
2292
Move up through the history list.
2296
Move down through the history list.
2298
When typing commands interactively, if the cursor is within or before
2299
the first word in the command-line, pressing the <TAB> key (or <C-i>)
2300
will display a listing of the available commands, and if the cursor is
2301
after the first word, the `<TAB>' will provide a completion listing of
2302
disks, partitions, and file names depending on the context. Note that
2303
to obtain a list of drives, one must open a parenthesis, as `root ('.
2305
Note that you cannot use the completion functionality in the TFTP
2306
filesystem. This is because TFTP doesn't support file name listing for
2310
File: grub.info, Node: Command-line interface-Footnotes, Up: Command-line interface
2312
(1) However, this behavior will be changed in the future version, in
2313
a user-invisible way.
2316
File: grub.info, Node: Menu interface, Next: Menu entry editor, Prev: Command-line interface, Up: Interface
2318
12.2 The simple menu interface
2319
==============================
2321
The menu interface is quite easy to use. Its commands are both
2322
reasonably intuitive and described on screen.
2324
Basically, the menu interface provides a list of "boot entries" to
2325
the user to choose from. Use the arrow keys to select the entry of
2326
choice, then press <RET> to run it. An optional timeout is available
2327
to boot the default entry (the first one if not set), which is aborted
2328
by pressing any key.
2330
Commands are available to enter a bare command-line by pressing <c>
2331
(which operates exactly like the non-config-file version of GRUB, but
2332
allows one to return to the menu if desired by pressing <ESC>) or to
2333
edit any of the "boot entries" by pressing <e>.
2335
If you protect the menu interface with a password (*note Security::),
2336
all you can do is choose an entry by pressing <RET>, or press <p> to
2340
File: grub.info, Node: Menu entry editor, Prev: Menu interface, Up: Interface
2342
12.3 Editing a menu entry
2343
=========================
2345
The menu entry editor looks much like the main menu interface, but the
2346
lines in the menu are individual commands in the selected entry instead
2349
If an <ESC> is pressed in the editor, it aborts all the changes made
2350
to the configuration entry and returns to the main menu interface.
2352
Each line in the menu entry can be edited freely, and you can add
2353
new lines by pressing <RET> at the end of a line. To boot the edited
2354
entry, press <Ctrl-x>.
2356
Although GRUB unfortunately does not support "undo", you can do
2357
almost the same thing by just returning to the main menu using <ESC>.
2360
File: grub.info, Node: Commands, Next: Security, Prev: Interface, Up: Top
2362
13 The list of available commands
2363
*********************************
2365
In this chapter, we list all commands that are available in GRUB.
2367
Commands belong to different groups. A few can only be used in the
2368
global section of the configuration file (or "menu"); most of them can
2369
be entered on the command-line and can be used either anywhere in the
2370
menu or specifically in the menu entries.
2372
In rescue mode, only the `insmod' (*note insmod::), `ls' (*note
2373
ls::), `set' (*note set::), and `unset' (*note unset::) commands are
2378
* Menu-specific commands::
2379
* General commands::
2380
* Command-line and menu entry commands::
2383
File: grub.info, Node: Menu-specific commands, Next: General commands, Up: Commands
2385
13.1 The list of commands for the menu only
2386
===========================================
2388
The semantics used in parsing the configuration file are the following:
2390
* The menu-specific commands have to be used before any others.
2392
* The files _must_ be in plain-text format.
2394
* `#' at the beginning of a line in a configuration file means it is
2397
* Options are separated by spaces.
2399
* All numbers can be either decimal or hexadecimal. A hexadecimal
2400
number must be preceded by `0x', and is case-insensitive.
2402
* Extra options or text at the end of the line are ignored unless
2403
otherwise specified.
2405
* Unrecognized commands are added to the current entry, except
2406
before entries start, where they are ignored.
2408
These commands can only be used in the menu:
2412
* menuentry:: Start a menu entry
2415
File: grub.info, Node: menuentry, Up: Menu-specific commands
2420
-- Command: menuentry TITLE [`--class=class' ...] [`--users=users']
2421
[`--hotkey=key'] { COMMAND; ... }
2422
This defines a GRUB menu entry named TITLE. When this entry is
2423
selected from the menu, GRUB will set the CHOSEN environment
2424
variable to TITLE, execute the list of commands given within
2425
braces, and if the last command in the list returned successfully
2426
and a kernel was loaded it will execute the `boot' command.
2428
The `--class' option may be used any number of times to group menu
2429
entries into classes. Menu themes may display different classes
2430
using different styles.
2432
The `--users' option grants specific users access to specific menu
2433
entries. *Note Security::.
2435
The `--hotkey' option associates a hotkey with a menu entry. KEY
2436
may be a single letter, or one of the aliases `backspace', `tab',
2440
File: grub.info, Node: General commands, Next: Command-line and menu entry commands, Prev: Menu-specific commands, Up: Commands
2442
13.2 The list of general commands
2443
=================================
2445
Commands usable anywhere in the menu and in the command-line.
2449
* serial:: Set up a serial device
2450
* terminal_input:: Manage input terminals
2451
* terminal_output:: Manage output terminals
2452
* terminfo:: Define terminal type
2455
File: grub.info, Node: serial, Next: terminal_input, Up: General commands
2460
-- Command: serial [`--unit=unit'] [`--port=port'] [`--speed=speed']
2461
[`--word=word'] [`--parity=parity'] [`--stop=stop']
2462
Initialize a serial device. UNIT is a number in the range 0-3
2463
specifying which serial port to use; default is 0, which
2464
corresponds to the port often called COM1. PORT is the I/O port
2465
where the UART is to be found; if specified it takes precedence
2466
over UNIT. SPEED is the transmission speed; default is 9600. WORD
2467
and STOP are the number of data bits and stop bits. Data bits must
2468
be in the range 5-8 and stop bits must be 1 or 2. Default is 8 data
2469
bits and one stop bit. PARITY is one of `no', `odd', `even' and
2472
The serial port is not used as a communication channel unless the
2473
`terminal_input' or `terminal_output' command is used (*note
2474
terminal_input::, *note terminal_output::).
2476
See also *note Serial terminal::.
2479
File: grub.info, Node: terminal_input, Next: terminal_output, Prev: serial, Up: General commands
2481
13.2.2 terminal_input
2482
---------------------
2484
-- Command: terminal_input [`--append'|`--remove'] [terminal1]
2486
List or select an input terminal.
2488
With no arguments, list the active and available input terminals.
2490
With `--append', add the named terminals to the list of active
2491
input terminals; any of these may be used to provide input to GRUB.
2493
With `--remove', remove the named terminals from the active list.
2495
With no options but a list of terminal names, make only the listed
2496
terminal names active.
2499
File: grub.info, Node: terminal_output, Next: terminfo, Prev: terminal_input, Up: General commands
2501
13.2.3 terminal_output
2502
----------------------
2504
-- Command: terminal_output [`--append'|`--remove'] [terminal1]
2506
List or select an output terminal.
2508
With no arguments, list the active and available output terminals.
2510
With `--append', add the named terminals to the list of active
2511
output terminals; all of these will receive output from GRUB.
2513
With `--remove', remove the named terminals from the active list.
2515
With no options but a list of terminal names, make only the listed
2516
terminal names active.
2519
File: grub.info, Node: terminfo, Prev: terminal_output, Up: General commands
2524
-- Command: terminfo [-a|-u|-v] [term]
2525
Define the capabilities of your terminal by giving the name of an
2526
entry in the terminfo database, which should correspond roughly to
2527
a `TERM' environment variable in Unix.
2529
The currently available terminal types are `vt100', `vt100-color',
2530
`ieee1275', and `dumb'. If you need other terminal types, please
2531
contact us to discuss the best way to include support for these in
2534
The `-a' (`--ascii'), `-u' (`--utf8'), and `-v' (`--visual-utf8')
2535
options control how non-ASCII text is displayed. `-a' specifies
2536
an ASCII-only terminal; `-u' specifies logically-ordered UTF-8;
2537
and `-v' specifies "visually-ordered UTF-8" (in other words,
2538
arranged such that a terminal emulator without bidirectional text
2539
support will display right-to-left text in the proper order; this
2540
is not really proper UTF-8, but a workaround).
2542
If no option or terminal type is specified, the current terminal
2546
File: grub.info, Node: Command-line and menu entry commands, Prev: General commands, Up: Commands
2548
13.3 The list of command-line and menu entry commands
2549
=====================================================
2551
These commands are usable in the command-line and in menu entries. If
2552
you forget a command, you can run the command `help' (*note help::).
2556
* acpi:: Load ACPI tables
2557
* badram:: Filter out bad regions of RAM
2558
* blocklist:: Print a block list
2559
* boot:: Start up your operating system
2560
* cat:: Show the contents of a file
2561
* chainloader:: Chain-load another boot loader
2562
* cmp:: Compare two files
2563
* configfile:: Load a configuration file
2564
* cpuid:: Check for CPU features
2565
* crc:: Calculate CRC32 checksums
2566
* date:: Display or set current date and time
2567
* drivemap:: Map a drive to another
2568
* echo:: Display a line of text
2569
* export:: Export an environment variable
2570
* gettext:: Translate a string
2571
* gptsync:: Fill an MBR based on GPT entries
2572
* halt:: Shut down your computer
2573
* help:: Show help messages
2574
* initrd:: Load a Linux initrd
2575
* initrd16:: Load a Linux initrd (16-bit mode)
2576
* insmod:: Insert a module
2577
* keystatus:: Check key modifier status
2578
* linux:: Load a Linux kernel
2579
* linux16:: Load a Linux kernel (16-bit mode)
2580
* ls:: List devices or files
2581
* parttool:: Modify partition table entries
2582
* password:: Set a clear-text password
2583
* password_pbkdf2:: Set a hashed password
2584
* play:: Play a tune
2585
* pxe_unload:: Unload the PXE environment
2586
* reboot:: Reboot your computer
2587
* search:: Search devices by file, label, or UUID
2588
* sendkey:: Emulate keystrokes
2589
* set:: Set an environment variable
2590
* unset:: Unset an environment variable
2591
* uppermem:: Set the upper memory size
2594
File: grub.info, Node: acpi, Next: badram, Up: Command-line and menu entry commands
2599
-- Command: acpi [`-1'|`-2']
2600
[`--exclude=table1,...'|`--load-only=table1,...']
2601
[`--oemid=id'] [`--oemtable=table'] [`--oemtablerev=rev']
2602
[`--oemtablecreator=creator'] [`--oemtablecreatorrev=rev']
2603
[`--no-ebda'] filename ...
2604
Modern BIOS systems normally implement the Advanced Configuration
2605
and Power Interface (ACPI), and define various tables that
2606
describe the interface between an ACPI-compliant operating system
2607
and the firmware. In some cases, the tables provided by default
2608
only work well with certain operating systems, and it may be
2609
necessary to replace some of them.
2611
Normally, this command will replace the Root System Description
2612
Pointer (RSDP) in the Extended BIOS Data Area to point to the new
2613
tables. If the `--no-ebda' option is used, the new tables will be
2614
known only to GRUB, but may be used by GRUB's EFI emulation.
2617
File: grub.info, Node: badram, Next: blocklist, Prev: acpi, Up: Command-line and menu entry commands
2622
-- Command: badram addr,mask[,addr,mask...]
2625
This command notifies the memory manager that specified regions of
2626
RAM ought to be filtered out (usually, because they're damaged). This
2627
remains in effect after a payload kernel has been loaded by GRUB, as
2628
long as the loaded kernel obtains its memory map from GRUB. Kernels
2629
that support this include Linux, GNU Mach, the kernel of FreeBSD and
2630
Multiboot kernels in general.
2632
Syntax is the same as provided by the Memtest86+ utility
2633
(http://www.memtest.org/): a list of address/mask pairs. Given a
2634
page-aligned address and a base address / mask pair, if all the bits of
2635
the page-aligned address that are enabled by the mask match with the
2636
base address, it means this page is to be filtered. This syntax makes
2637
it easy to represent patterns that are often result of memory damage,
2638
due to physical distribution of memory cells.
2641
File: grub.info, Node: blocklist, Next: boot, Prev: badram, Up: Command-line and menu entry commands
2646
-- Command: blocklist file
2647
Print a block list (*note Block list syntax::) for FILE.
2650
File: grub.info, Node: boot, Next: cat, Prev: blocklist, Up: Command-line and menu entry commands
2656
Boot the OS or chain-loader which has been loaded. Only necessary
2657
if running the fully interactive command-line (it is implicit at
2658
the end of a menu entry).
2661
File: grub.info, Node: cat, Next: chainloader, Prev: boot, Up: Command-line and menu entry commands
2666
-- Command: cat [`--dos'] file
2667
Display the contents of the file FILE. This command may be useful
2668
to remind you of your OS's root partition:
2670
grub> cat /etc/fstab
2672
If the `--dos' option is used, then carriage return / new line
2673
pairs will be displayed as a simple new line. Otherwise, the
2674
carriage return will be displayed as a control character (`<d>')
2675
to make it easier to see when boot problems are caused by a file
2676
formatted using DOS-style line endings.
2679
File: grub.info, Node: chainloader, Next: cmp, Prev: cat, Up: Command-line and menu entry commands
2684
-- Command: chainloader [`--force'] file
2685
Load FILE as a chain-loader. Like any other file loaded by the
2686
filesystem code, it can use the blocklist notation (*note Block
2687
list syntax::) to grab the first sector of the current partition
2688
with `+1'. If you specify the option `--force', then load FILE
2689
forcibly, whether it has a correct signature or not. This is
2690
required when you want to load a defective boot loader, such as
2694
File: grub.info, Node: cmp, Next: configfile, Prev: chainloader, Up: Command-line and menu entry commands
2699
-- Command: cmp file1 file2
2700
Compare the file FILE1 with the file FILE2. If they differ in
2701
size, print the sizes like this:
2703
Differ in size: 0x1234 [foo], 0x4321 [bar]
2705
If the sizes are equal but the bytes at an offset differ, then
2706
print the bytes like this:
2708
Differ at the offset 777: 0xbe [foo], 0xef [bar]
2710
If they are completely identical, nothing will be printed.
2713
File: grub.info, Node: configfile, Next: cpuid, Prev: cmp, Up: Command-line and menu entry commands
2718
-- Command: configfile file
2719
Load FILE as a configuration file. If FILE defines any menu
2720
entries, then show a menu containing them immediately.
2723
File: grub.info, Node: cpuid, Next: crc, Prev: configfile, Up: Command-line and menu entry commands
2728
-- Command: cpuid [-l]
2729
Check for CPU features. This command is only available on x86
2732
With the `-l' option, return true if the CPU supports long mode
2735
If invoked without options, this command currently behaves as if
2736
it had been invoked with `-l'. This may change in the future.
2739
File: grub.info, Node: crc, Next: date, Prev: cpuid, Up: Command-line and menu entry commands
2744
-- Command: crc file
2745
Display the CRC32 checksum of FILE.
2748
File: grub.info, Node: date, Next: drivemap, Prev: crc, Up: Command-line and menu entry commands
2753
-- Command: date [[year-]month-day] [hour:minute[:second]]
2754
With no arguments, print the current date and time.
2756
Otherwise, take the current date and time, change any elements
2757
specified as arguments, and set the result as the new date and
2758
time. For example, `date 01-01' will set the current month and
2759
day to January 1, but leave the year, hour, minute, and second
2763
File: grub.info, Node: drivemap, Next: echo, Prev: date, Up: Command-line and menu entry commands
2768
-- Command: drivemap `-l'|`-r'|[`-s'] from_drive to_drive
2769
Without options, map the drive FROM_DRIVE to the drive TO_DRIVE.
2770
This is necessary when you chain-load some operating systems, such
2771
as DOS, if such an OS resides at a non-first drive. For
2772
convenience, any partition suffix on the drive is ignored, so you
2773
can safely use ${root} as a drive specification.
2775
With the `-s' option, perform the reverse mapping as well, swapping
2778
With the `-l' option, list the current mappings.
2780
With the `-r' option, reset all mappings to the default values.
2784
drivemap -s (hd0) (hd1)
2787
File: grub.info, Node: echo, Next: export, Prev: drivemap, Up: Command-line and menu entry commands
2792
-- Command: echo [`-n'] [`-e'] string ...
2793
Display the requested text and, unless the `-n' option is used, a
2794
trailing new line. If there is more than one string, they are
2795
separated by spaces in the output. As usual in GRUB commands,
2796
variables may be substituted using `${var}'.
2798
The `-e' option enables interpretation of backslash escapes. The
2799
following sequences are recognised:
2808
suppress trailing new line
2825
When interpreting backslash escapes, backslash followed by any
2826
other character will print that character.
2829
File: grub.info, Node: export, Next: gettext, Prev: echo, Up: Command-line and menu entry commands
2834
-- Command: export envvar
2835
Export the environment variable ENVVAR. Exported variables are
2836
visible to subsidiary configuration files loaded using
2840
File: grub.info, Node: gettext, Next: gptsync, Prev: export, Up: Command-line and menu entry commands
2845
-- Command: gettext string
2846
Translate STRING into the current language.
2848
The current language code is stored in the `lang' variable in
2849
GRUB's environment. Translation files in MO format are read from
2850
`locale_dir', usually `/boot/grub/locale'.
2853
File: grub.info, Node: gptsync, Next: halt, Prev: gettext, Up: Command-line and menu entry commands
2858
-- Command: gptsync device [partition[+/-[type]]] ...
2859
Disks using the GUID Partition Table (GPT) also have a legacy
2860
Master Boot Record (MBR) partition table for compatibility with
2861
the BIOS and with older operating systems. The legacy MBR can
2862
only represent a limited subset of GPT partition entries.
2864
This command populates the legacy MBR with the specified PARTITION
2865
entries on DEVICE. Up to three partitions may be used.
2867
TYPE is an MBR partition type code; prefix with `0x' if you want
2868
to enter this in hexadecimal. The separator between PARTITION and
2869
TYPE may be `+' to make the partition active, or `-' to make it
2870
inactive; only one partition may be active. If both the separator
2871
and type are omitted, then the partition will be inactive.
2874
File: grub.info, Node: halt, Next: help, Prev: gptsync, Up: Command-line and menu entry commands
2879
-- Command: halt `--no-apm'
2880
The command halts the computer. If the `--no-apm' option is
2881
specified, no APM BIOS call is performed. Otherwise, the computer
2882
is shut down using APM.
2885
File: grub.info, Node: help, Next: initrd, Prev: halt, Up: Command-line and menu entry commands
2890
-- Command: help [pattern ...]
2891
Display helpful information about builtin commands. If you do not
2892
specify PATTERN, this command shows short descriptions of all
2895
If you specify any PATTERNS, it displays longer information about
2896
each of the commands whose names begin with those PATTERNS.
2899
File: grub.info, Node: initrd, Next: initrd16, Prev: help, Up: Command-line and menu entry commands
2904
-- Command: initrd file
2905
Load an initial ramdisk for a Linux kernel image, and set the
2906
appropriate parameters in the Linux setup area in memory. This
2907
may only be used after the `linux' command (*note linux::) has
2908
been run. See also *note GNU/Linux::.
2911
File: grub.info, Node: initrd16, Next: insmod, Prev: initrd, Up: Command-line and menu entry commands
2916
-- Command: initrd16 file
2917
Load an initial ramdisk for a Linux kernel image to be booted in
2918
16-bit mode, and set the appropriate parameters in the Linux setup
2919
area in memory. This may only be used after the `linux16' command
2920
(*note linux16::) has been run. See also *note GNU/Linux::.
2922
This command is only available on x86 systems.
2925
File: grub.info, Node: insmod, Next: keystatus, Prev: initrd16, Up: Command-line and menu entry commands
2930
-- Command: insmod module
2931
Insert the dynamic GRUB module called MODULE.
2934
File: grub.info, Node: keystatus, Next: linux, Prev: insmod, Up: Command-line and menu entry commands
2939
-- Command: keystatus [`--shift'] [`--ctrl'] [`--alt']
2940
Return true if the Shift, Control, or Alt modifier keys are held
2941
down, as requested by options. This is useful in scripting, to
2942
allow some user control over behaviour without having to wait for
2945
Checking key modifier status is only supported on some platforms.
2946
If invoked without any options, the `keystatus' command returns
2947
true if and only if checking key modifier status is supported.
2950
File: grub.info, Node: linux, Next: linux16, Prev: keystatus, Up: Command-line and menu entry commands
2955
-- Command: linux file ...
2956
Load a Linux kernel image from FILE. The rest of the line is
2957
passed verbatim as the "kernel command-line". Any initrd must be
2958
reloaded after using this command (*note initrd::).
2960
On x86 systems, the kernel will be booted using the 32-bit boot
2961
protocol. Note that this means that the `vga=' boot option will
2962
not work; if you want to set a special video mode, you will need
2963
to use GRUB commands such as `set gfxpayload=1024x768' or `set
2964
gfxpayload=keep' (to keep the same mode as used in GRUB) instead.
2965
GRUB can automatically detect some uses of `vga=' and translate
2966
them to appropriate settings of `gfxpayload'. The `linux16'
2967
command (*note linux16::) avoids this restriction.
2970
File: grub.info, Node: linux16, Next: ls, Prev: linux, Up: Command-line and menu entry commands
2975
-- Command: linux16 file ...
2976
Load a Linux kernel image from FILE in 16-bit mode. The rest of
2977
the line is passed verbatim as the "kernel command-line". Any
2978
initrd must be reloaded after using this command (*note
2981
The kernel will be booted using the traditional 16-bit boot
2982
protocol. As well as bypassing problems with `vga=' described in
2983
*note linux::, this permits booting some other programs that
2984
implement the Linux boot protocol for the sake of convenience.
2986
This command is only available on x86 systems.
2989
File: grub.info, Node: ls, Next: parttool, Prev: linux16, Up: Command-line and menu entry commands
2994
-- Command: ls [arg ...]
2995
List devices or files.
2997
With no arguments, print all devices known to GRUB.
2999
If the argument is a device name enclosed in parentheses (*note
3000
Device syntax::), then list all files at the root directory of
3003
If the argument is a directory given as an absolute file name
3004
(*note File name syntax::), then list the contents of that
3008
File: grub.info, Node: parttool, Next: password, Prev: ls, Up: Command-line and menu entry commands
3013
-- Command: parttool partition commands
3014
Make various modifications to partition table entries.
3016
Each COMMAND is either a boolean option, in which case it must be
3017
followed with `+' or `-' (with no intervening space) to enable or
3018
disable that option, or else it takes a value in the form
3021
Currently, `parttool' is only useful on DOS partition tables (also
3022
known as Master Boot Record, or MBR). On these partition tables,
3023
the following commands are available:
3026
When enabled, this makes the selected partition be the active
3027
(bootable) partition on its disk, clearing the active flag on
3028
all other partitions. This command is limited to _primary_
3032
Change the type of an existing partition. The value must be
3033
a number in the range 0-0xFF (prefix with `0x' to enter it in
3037
When enabled, this hides the selected partition by setting
3038
the "hidden" bit in its partition type code; when disabled,
3039
unhides the selected partition by clearing this bit. This is
3040
useful only when booting DOS or Wwindows and multiple primary
3041
FAT partitions exist in one disk. See also *note
3045
File: grub.info, Node: password, Next: password_pbkdf2, Prev: parttool, Up: Command-line and menu entry commands
3050
-- Command: password user clear-password
3051
Define a user named USER with password CLEAR-PASSWORD. *Note
3055
File: grub.info, Node: password_pbkdf2, Next: play, Prev: password, Up: Command-line and menu entry commands
3057
13.3.28 password_pbkdf2
3058
-----------------------
3060
-- Command: password_pbkdf2 user hashed-password
3061
Define a user named USER with password hash HASHED-PASSWORD. Use
3062
`grub-mkpasswd-pbkdf2' (*note Invoking grub-mkpasswd-pbkdf2::) to
3063
generate password hashes. *Note Security::.
3066
File: grub.info, Node: play, Next: pxe_unload, Prev: password_pbkdf2, Up: Command-line and menu entry commands
3071
-- Command: play file | tempo [pitch1 duration1] [pitch2 duration2] ...
3074
If the argument is a file name (*note File name syntax::), play
3075
the tune recorded in it. The file format is first the tempo as an
3076
unsigned 32bit little-endian number, then pairs of unsigned 16bit
3077
little-endian numbers for pitch and duration pairs.
3079
If the arguments are a series of numbers, play the inline tune.
3081
The tempo is the base for all note durations. 60 gives a 1-second
3082
base, 120 gives a half-second base, etc. Pitches are Hz. Set
3083
pitch to 0 to produce a rest.
3086
File: grub.info, Node: pxe_unload, Next: reboot, Prev: play, Up: Command-line and menu entry commands
3091
-- Command: pxe_unload
3092
Unload the PXE environment (*note Network::).
3094
This command is only available on PC BIOS systems.
3097
File: grub.info, Node: reboot, Next: search, Prev: pxe_unload, Up: Command-line and menu entry commands
3103
Reboot the computer.
3106
File: grub.info, Node: search, Next: sendkey, Prev: reboot, Up: Command-line and menu entry commands
3111
-- Command: search [`--file'|`--label'|`--fs-uuid'] [`--set' [var]]
3112
[`--no-floppy'] name
3113
Search devices by file (`-f', `--file'), filesystem label (`-l',
3114
`--label'), or filesystem UUID (`-u', `--fs-uuid').
3116
If the `--set' option is used, the first device found is set as the
3117
value of environment variable VAR. The default variable is `root'.
3119
The `--no-floppy' option prevents searching floppy devices, which
3122
The `search.file', `search.fs_label', and `search.fs_uuid'
3123
commands are aliases for `search --file', `search --label', and
3124
`search --fs-uuid' respectively.
3127
File: grub.info, Node: sendkey, Next: set, Prev: search, Up: Command-line and menu entry commands
3132
-- Command: sendkey [`--num'|`--caps'|`--scroll'|`--insert'|
3133
`--pause'|`--left-shift'|`--right-shift'|
3134
`--sysrq'|`--numkey'|`--capskey'|`--scrollkey'|
3135
`--insertkey'|`--left-alt'|`--right-alt'|
3136
`--left-ctrl'|`--right-ctrl' `on'|`off']... [`no-led']
3138
Insert keystrokes into the keyboard buffer when booting.
3139
Sometimes an operating system or chainloaded boot loader requires
3140
particular keys to be pressed: for example, one might need to
3141
press a particular key to enter "safe mode", or when chainloading
3142
another boot loader one might send keystrokes to it to navigate
3145
You may provide up to 16 keystrokes (the length of the BIOS
3146
keyboard buffer). Keystroke names may be upper-case or lower-case
3147
letters, digits, or taken from the following table:
3150
---------------------------------------------------------------
3173
control press and release Control
3180
shift press and release left Shift
3189
rshift press and release right Shift
3190
alt press and release Alt
3205
num1 1 (numeric keypad)
3206
num2 2 (numeric keypad)
3207
num3 3 (numeric keypad)
3208
num4 4 (numeric keypad)
3209
num5 5 (numeric keypad)
3210
num6 6 (numeric keypad)
3211
num7 7 (numeric keypad)
3212
num8 8 (numeric keypad)
3213
num9 9 (numeric keypad)
3214
num0 0 (numeric keypad)
3215
numperiod . (numeric keypad)
3216
numend End (numeric keypad)
3217
numdown Down (numeric keypad)
3218
numpgdown Page Down (numeric keypad)
3219
numleft Left (numeric keypad)
3220
numcenter 5 with Num Lock inactive (numeric
3222
numright Right (numeric keypad)
3223
numhome Home (numeric keypad)
3224
numup Up (numeric keypad)
3225
numpgup Page Up (numeric keypad)
3226
numinsert Insert (numeric keypad)
3227
numdelete Delete (numeric keypad)
3228
numasterisk * (numeric keypad)
3229
numminus - (numeric keypad)
3230
numplus + (numeric keypad)
3231
numslash / (numeric keypad)
3232
numenter Enter (numeric keypad)
3244
As well as keystrokes, the `sendkey' command takes various options
3245
that affect the BIOS keyboard status flags. These options take an
3246
`on' or `off' parameter, specifying that the corresponding status
3247
flag be set or unset; omitting the option for a given status flag
3248
will leave that flag at its initial state at boot. The `--num',
3249
`--caps', `--scroll', and `--insert' options emulate setting the
3250
corresponding mode, while the `--numkey', `--capskey',
3251
`--scrollkey', and `--insertkey' options emulate pressing and
3252
holding the corresponding key. The other status flag options are
3255
If the `--no-led' option is given, the status flag options will
3256
have no effect on keyboard LEDs.
3258
If the `sendkey' command is given multiple times, then only the
3259
last invocation has any effect.
3261
Since `sendkey' manipulates the BIOS keyboard buffer, it may cause
3262
hangs, reboots, or other misbehaviour on some systems. If the
3263
operating system or boot loader that runs after GRUB uses its own
3264
keyboard driver rather than the BIOS keyboard functions, then
3265
`sendkey' will have no effect.
3267
This command is only available on PC BIOS systems.
3270
File: grub.info, Node: set, Next: unset, Prev: sendkey, Up: Command-line and menu entry commands
3275
-- Command: set [envvar=value]
3276
Set the environment variable ENVVAR to VALUE. If invoked with no
3277
arguments, print all environment variables with their values.
3280
File: grub.info, Node: unset, Next: uppermem, Prev: set, Up: Command-line and menu entry commands
3285
-- Command: unset envvar
3286
Unset the environment variable ENVVAR.
3289
File: grub.info, Node: uppermem, Prev: unset, Up: Command-line and menu entry commands
3294
This command is not yet implemented for GRUB 2, although it is planned.
3297
File: grub.info, Node: Security, Next: Supported kernels, Prev: Commands, Up: Top
3299
14 Authentication and authorisation
3300
***********************************
3302
By default, the boot loader interface is accessible to anyone with
3303
physical access to the console: anyone can select and edit any menu
3304
entry, and anyone can get direct access to a GRUB shell prompt. For
3305
most systems, this is reasonable since anyone with direct physical
3306
access has a variety of other ways to gain full access, and requiring
3307
authentication at the boot loader level would only serve to make it
3308
difficult to recover broken systems.
3310
However, in some environments, such as kiosks, it may be appropriate
3311
to lock down the boot loader to require authentication before
3312
performing certain operations.
3314
The `password' (*note password::) and `password_pbkdf2' (*note
3315
password_pbkdf2::) commands can be used to define users, each of which
3316
has an associated password. `password' sets the password in plain
3317
text, requiring `grub.cfg' to be secure; `password_pbkdf2' sets the
3318
password hashed using the Password-Based Key Derivation Function (RFC
3319
2898), requiring the use of `grub-mkpasswd-pbkdf2' (*note Invoking
3320
grub-mkpasswd-pbkdf2::) to generate password hashes.
3322
In order to enable authentication support, the `superusers'
3323
environment variable must be set to a list of usernames, separated by
3324
any of spaces, commas, semicolons, pipes, or ampersands. Superusers
3325
are permitted to use the GRUB command line, edit menu entries, and
3326
execute any menu entry. If `superusers' is set, then use of the
3327
command line is automatically restricted to superusers.
3329
Other users may be given access to specific menu entries by giving a
3330
list of usernames (as above) using the `--users' option to the
3331
`menuentry' command (*note menuentry::). If the `--users' option is
3332
not used for a menu entry, then that entry is unrestricted.
3334
Putting this together, a typical `grub.cfg' fragment might look like
3337
set superusers="root"
3338
password_pbkdf2 root grub.pbkdf2.sha512.10000.biglongstring
3339
password user1 insecure
3341
menuentry "May be run by any user" {
3346
menuentry "Superusers only" --users "" {
3348
linux /vmlinuz single
3351
menuentry "May be run by user1 or a superuser" --users user1 {
3356
The `grub-mkconfig' program does not yet have built-in support for
3357
generating configuration files with authentication. You can use
3358
`/etc/grub.d/40_custom' to add simple superuser authentication, by
3359
adding `set superusers=' and `password' or `password_pbkdf2' commands.
3362
File: grub.info, Node: Supported kernels, Next: Troubleshooting, Prev: Security, Up: Top
3364
15 Supported boot targets
3365
*************************
3367
X86 support is summarised in the following table. "Yes" means that the
3368
kernel works on the given platform, "crashes" means an early kernel
3369
crash which we hope will be fixed by concerned kernel developers. "no"
3370
means GRUB doesn't load the given kernel on a given platform.
3371
"headless" means that the kernel works but lacks console drivers (you
3372
can still use serial or network console). In case of "no" and
3373
"crashes" the reason is given in footnote.
3375
BIOS chainloading yes no (1)
3377
FreeBSD bootloader yes crashes (1)
3378
32-bit kFreeBSD yes crashes (2,6)
3379
64-bit kFreeBSD yes crashes (2,6)
3380
32-bit kNetBSD yes crashes (1)
3381
64-bit kNetBSD yes crashes (2)
3382
32-bit kOpenBSD yes yes
3383
64-bit kOpenBSD yes yes
3386
32-bit Linux (legacy protocol) yes no (1)
3387
64-bit Linux (legacy protocol) yes no (1)
3388
32-bit Linux (modern protocol) yes yes
3389
64-bit Linux (modern protocol) yes yes
3392
32-bit EFI chainloader no (3) no (3)
3393
64-bit EFI chainloader no (3) no (3)
3394
Appleloader no (3) no (3)
3397
BIOS chainloading no (1) no (1)
3399
FreeBSD bootloader crashes (1) crashes (1)
3400
32-bit kFreeBSD crashes (6) crashes (6)
3401
64-bit kFreeBSD crashes (6) crashes (6)
3402
32-bit kNetBSD crashes (1) crashes (1)
3403
64-bit kNetBSD yes yes
3404
32-bit kOpenBSD yes yes
3405
64-bit kOpenBSD yes yes
3408
32-bit Linux (legacy protocol) no (1) no (1)
3409
64-bit Linux (legacy protocol) no (1) no (1)
3410
32-bit Linux (modern protocol) yes yes
3411
64-bit Linux (modern protocol) yes yes
3414
32-bit EFI chainloader no (3) no (3)
3415
64-bit EFI chainloader no (3) no (3)
3416
Appleloader no (3) no (3)
3418
32-bit EFI 64-bit EFI
3419
BIOS chainloading no (1) no (1)
3421
FreeBSD bootloader crashes (1) crashes (1)
3422
32-bit kFreeBSD headless headless
3423
64-bit kFreeBSD headless headless
3424
32-bit kNetBSD crashes (1) crashes (1)
3425
64-bit kNetBSD yes yes
3426
32-bit kOpenBSD headless headless
3427
64-bit kOpenBSD headless headless
3430
32-bit Linux (legacy protocol) no (1) no (1)
3431
64-bit Linux (legacy protocol) no (1) no (1)
3432
32-bit Linux (modern protocol) yes yes
3433
64-bit Linux (modern protocol) yes yes
3435
64-bit XNU yes (5) yes
3436
32-bit EFI chainloader yes no (4)
3437
64-bit EFI chainloader no (4) yes
3441
BIOS chainloading no (1)
3443
FreeBSD bootloader crashes (1)
3444
32-bit kFreeBSD crashes (6)
3445
64-bit kFreeBSD crashes (6)
3446
32-bit kNetBSD crashes (1)
3452
32-bit Linux (legacy protocol) no (1)
3453
64-bit Linux (legacy protocol) no (1)
3454
32-bit Linux (modern protocol) ?
3455
64-bit Linux (modern protocol) ?
3458
32-bit EFI chainloader no (3)
3459
64-bit EFI chainloader no (3)
3464
2. Crashes because the memory at 0x0-0x1000 isn't available
3468
4. 32-bit and 64-bit EFI have different structures and work in
3469
different CPU modes so it's not possible to chainload 32-bit
3470
bootloader on 64-bit platform and vice-versa
3472
5. Some modules may need to be disabled
3476
PowerPC and Sparc ports support only Linux. MIPS port supports Linux
3482
As you have seen in previous chapter the support matrix is pretty big
3483
and some of the configurations are only rarely used. To ensure the
3484
quality bootchecks are available for all x86 targets except EFI
3485
chainloader, Appleloader and XNU. All x86 platforms have bootcheck
3486
facility except ieee1275. Multiboot, multiboot2, BIOS chainloader,
3487
ntldr and freebsd-bootloader boot targets are tested only with a fake
3488
kernel images. Only Linux is tested among the payloads using Linux
3491
Following variables must be defined:
3493
GRUB_PAYLOADS_DIR directory containing the required kernels
3494
GRUB_CBFSTOOL cbfstoll from Coreboot package (for coreboot
3496
GRUB_COREBOOT_ROM empty Coreboot ROM
3497
GRUB_QEMU_OPTS additional options to be supplied to QEMU
3501
kfreebsd_env.i386 32-bit kFreeBSD device hints
3502
kfreebsd.i386 32-bit FreeBSD kernel image
3503
kfreebsd.x86_64, same from 64-bit kFreeBSD
3505
knetbsd.i386 32-bit NetBSD kernel image
3506
knetbsd.miniroot.i386 32-bit kNetBSD miniroot.kmod.
3507
knetbsd.x86_64, same from 64-bit kNetBSD
3508
knetbsd.miniroot.x86_64
3509
kopenbsd.i386 32-bit OpenBSD kernel bsd.rd image
3510
kopenbsd.x86_64 same from 64-bit kOpenBSD
3511
linux.i386 32-bit Linux
3512
linux.x86_64 64-bit Linux
3515
File: grub.info, Node: Troubleshooting, Next: Invoking grub-install, Prev: Supported kernels, Up: Top
3517
17 Error messages produced by GRUB
3518
**********************************
3522
* GRUB only offers a rescue shell::
3525
File: grub.info, Node: GRUB only offers a rescue shell, Up: Troubleshooting
3527
17.1 GRUB only offers a rescue shell
3528
====================================
3530
GRUB's normal start-up procedure involves setting the `prefix'
3531
environment variable to a value set in the core image by
3532
`grub-install', setting the `root' variable to match, loading the
3533
`normal' module from the prefix, and running the `normal' command.
3534
This command is responsible for reading `/boot/grub/grub.cfg', running
3535
the menu, and doing all the useful things GRUB is supposed to do.
3537
If, instead, you only get a rescue shell, this usually means that
3538
GRUB failed to load the `normal' module for some reason. It may be
3539
possible to work around this temporarily: for instance, if the reason
3540
for the failure is that `prefix' is wrong (perhaps it refers to the
3541
wrong device, or perhaps the path to `/boot/grub' was not correctly
3542
made relative to the device), then you can correct this and enter
3543
normal mode manually:
3545
# Inspect the current prefix (and other preset variables):
3547
# Set to the correct value, which might be something like this:
3548
set prefix=(hd0,1)/grub
3553
However, any problem that leaves you in the rescue shell probably
3554
means that GRUB was not correctly installed. It may be more useful to
3555
try to reinstall it properly using `grub-install DEVICE' (*note
3556
Invoking grub-install::). When doing this, there are a few things to
3559
* Drive ordering in your operating system may not be the same as the
3560
boot drive ordering used by your firmware. Do not assume that
3561
your first hard drive (e.g. `/dev/sda') is the one that your
3562
firmware will boot from. `device.map' (*note Device map::) can be
3563
used to override this, but it is usually better to use UUIDs or
3564
file system labels and avoid depending on drive ordering entirely.
3566
* At least on BIOS systems, if you tell `grub-install' to install
3567
GRUB to a partition but GRUB has already been installed in the
3568
master boot record, then the GRUB installation in the partition
3571
* If possible, it is generally best to avoid installing GRUB to a
3572
partition (unless it is a special partition for the use of GRUB
3573
alone, such as the BIOS Boot Partition used on GPT). Doing this
3574
means that GRUB may stop being able to read its core image due to
3575
a file system moving blocks around, such as while defragmenting,
3576
running checks, or even during normal operation. Installing to
3577
the whole disk device is normally more robust.
3579
* Check that GRUB actually knows how to read from the device and
3580
file system containing `/boot/grub'. It will not be able to read
3581
from encrypted devices, nor from file systems for which support
3582
has not yet been added to GRUB.
3585
File: grub.info, Node: Invoking grub-install, Next: Invoking grub-mkconfig, Prev: Troubleshooting, Up: Top
3587
18 Invoking grub-install
3588
************************
3590
The program `grub-install' installs GRUB on your drive using
3591
`grub-mkimage' and (on some platforms) `grub-setup'. You must specify
3592
the device name on which you want to install GRUB, like this:
3594
grub-install INSTALL_DEVICE
3596
The device name INSTALL_DEVICE is an OS device name or a GRUB device
3599
`grub-install' accepts the following options:
3602
Print a summary of the command-line options and exit.
3605
Print the version number of GRUB and exit.
3607
`--root-directory=DIR'
3608
Install GRUB images under the directory DIR instead of the root
3609
directory. This option is useful when you want to install GRUB
3610
into a separate partition or a removable disk. Here is an example
3611
in which you have a separate "boot" partition which is mounted on
3614
grub-install --root-directory=/boot hd0
3617
Recheck the device map, even if `/boot/grub/device.map' already
3618
exists. You should use this option whenever you add/remove a disk
3619
into/from your computer.
3622
File: grub.info, Node: Invoking grub-mkconfig, Next: Invoking grub-mkpasswd-pbkdf2, Prev: Invoking grub-install, Up: Top
3624
19 Invoking grub-mkconfig
3625
*************************
3627
The program `grub-mkconfig' generates a configuration file for GRUB
3628
(*note Simple configuration::).
3630
grub-mkconfig -o /boot/grub/grub.cfg
3632
`grub-mkconfig' accepts the following options:
3635
Print a summary of the command-line options and exit.
3638
Print the version number of GRUB and exit.
3642
Send the generated configuration file to FILE. The default is to
3643
send it to standard output.
3646
File: grub.info, Node: Invoking grub-mkpasswd-pbkdf2, Next: Obtaining and Building GRUB, Prev: Invoking grub-mkconfig, Up: Top
3648
20 Invoking grub-mkpasswd-pbkdf2
3649
********************************
3651
The program `grub-mkpasswd-pbkdf2' generates password hashes for GRUB
3654
grub-mkpasswd-pbkdf2
3656
`grub-mkpasswd-pbkdf2' accepts the following options:
3659
`--iteration-count=NUMBER'
3660
Number of iterations of the underlying pseudo-random function.
3665
Length of the generated hash. Defaults to 64.
3669
Length of the salt. Defaults to 64.
3672
File: grub.info, Node: Obtaining and Building GRUB, Next: Reporting bugs, Prev: Invoking grub-mkpasswd-pbkdf2, Up: Top
3674
Appendix A How to obtain and build GRUB
3675
***************************************
3677
*Caution:* GRUB requires binutils-2.9.1.0.23 or later because the
3678
GNU assembler has been changed so that it can produce real 16bits
3679
machine code between 2.9.1 and 2.9.1.0.x. See
3680
`http://sources.redhat.com/binutils/', to obtain information on
3681
how to get the latest version.
3683
GRUB is available from the GNU alpha archive site
3684
`ftp://alpha.gnu.org/gnu/grub' or any of its mirrors. The file will be
3685
named grub-version.tar.gz. The current version is 1.99~20101123-1, so
3686
the file you should grab is:
3688
`ftp://alpha.gnu.org/gnu/grub/grub-1.99~20101123-1.tar.gz'
3690
To unbundle GRUB use the instruction:
3692
zcat grub-1.99~20101123-1.tar.gz | tar xvf -
3694
which will create a directory called `grub-1.99~20101123-1' with all
3695
the sources. You can look at the file `INSTALL' for detailed
3696
instructions on how to build and install GRUB, but you should be able to
3699
cd grub-1.99~20101123-1
3703
Also, the latest version is available using Bazaar. See
3704
`http://www.gnu.org/software/grub/grub-download.en.html' for more
3708
File: grub.info, Node: Reporting bugs, Next: Future, Prev: Obtaining and Building GRUB, Up: Top
3710
Appendix B Reporting bugs
3711
*************************
3713
These are the guideline for how to report bugs. Take a look at this
3714
list below before you submit bugs:
3716
1. Before getting unsettled, read this manual through and through.
3717
Also, see the GNU GRUB FAQ
3718
(http://www.gnu.org/software/grub/grub-faq.html).
3720
2. Always mention the information on your GRUB. The version number
3721
and the configuration are quite important. If you build it
3722
yourself, write the options specified to the configure script and
3723
your operating system, including the versions of gcc and binutils.
3725
3. If you have trouble with the installation, inform us of how you
3726
installed GRUB. Don't omit error messages, if any. Just `GRUB hangs
3727
up when it boots' is not enough.
3729
The information on your hardware is also essential. These are
3730
especially important: the geometries and the partition tables of
3731
your hard disk drives and your BIOS.
3733
4. If GRUB cannot boot your operating system, write down _everything_
3734
you see on the screen. Don't paraphrase them, like `The foo OS
3735
crashes with GRUB, even though it can boot with the bar boot
3736
loader just fine'. Mention the commands you executed, the messages
3737
printed by them, and information on your operating system
3738
including the version number.
3740
5. Explain what you wanted to do. It is very useful to know your
3741
purpose and your wish, and how GRUB didn't satisfy you.
3743
6. If you can investigate the problem yourself, please do. That will
3744
give you and us much more information on the problem. Attaching a
3745
patch is even better.
3747
When you attach a patch, make the patch in unified diff format, and
3748
write ChangeLog entries. But, even when you make a patch, don't
3749
forget to explain the problem, so that we can understand what your
3752
7. Write down anything that you think might be related. Please
3753
understand that we often need to reproduce the same problem you
3754
encounterred in our environment. So your information should be
3755
sufficient for us to do the same thing--Don't forget that we
3756
cannot see your computer directly. If you are not sure whether to
3757
state a fact or leave it out, state it! Reporting too many things
3758
is much better than omitting something important.
3760
If you follow the guideline above, submit a report to the Bug
3761
Tracking System (http://savannah.gnu.org/bugs/?group=grub).
3762
Alternatively, you can submit a report via electronic mail to
3763
<bug-grub@gnu.org>, but we strongly recommend that you use the Bug
3764
Tracking System, because e-mail can be passed over easily.
3766
Once we get your report, we will try to fix the bugs.
3769
File: grub.info, Node: Future, Next: Internals, Prev: Reporting bugs, Up: Top
3771
Appendix C Where GRUB will go
3772
*****************************
3774
We started the next generation of GRUB, GRUB 2. GRUB 2 includes
3775
internationalization, dynamic module loading, real memory management,
3776
multiple architecture support, a scripting language, and many other
3777
nice features. If you are interested in the development of GRUB 2, take
3778
a look at the homepage (http://www.gnu.org/software/grub/grub.html).
3781
File: grub.info, Node: Internals, Next: Copying This Manual, Prev: Future, Up: Top
3783
Appendix D Hacking GRUB
3784
***********************
3788
* Getting the source code::
3789
* Finding your way around::
3792
File: grub.info, Node: Getting the source code, Next: Finding your way around, Up: Internals
3794
D.1 Getting the source code
3795
===========================
3797
GRUB is maintained using the Bazaar revision control system
3798
(http://bazaar-vcs.org/). To fetch the primary development branch:
3800
bzr get http://bzr.savannah.gnu.org/r/grub/trunk/grub
3802
The GRUB developers maintain several other branches with work in
3803
progress. Of these, the most interesting is the experimental branch,
3804
which is a staging area for new code which we expect to eventually
3805
merge into trunk but which is not yet ready:
3807
bzr get http://bzr.savannah.gnu.org/r/grub/branches/experimental
3809
Once you have used `bzr get' to fetch an initial copy of a branch,
3810
you can use `bzr pull' to keep it up to date. If you have modified your
3811
local version, you may need to resolve conflicts when pulling.
3814
File: grub.info, Node: Finding your way around, Prev: Getting the source code, Up: Internals
3816
D.2 Finding your way around
3817
===========================
3819
Here is a brief map of the GRUB code base.
3821
GRUB uses Autoconf, but not (yet) Automake. The top-level build
3822
rules are in `configure.ac', `Makefile.in', and `conf/*.rmk'. Each
3823
`conf/*.rmk' file represents a particular target configuration, and is
3824
processed into GNU Make rules by `genmk.rb' (which you only need to
3825
look at if you are extending the build system). If you are adding a new
3826
module which follows an existing pattern, such as a new command or a new
3827
filesystem implementation, it is usually easiest to grep `conf/*.rmk'
3828
for an existing example of that pattern to find out where it should be
3831
Low-level boot code, such as the MBR implementation on PC BIOS
3832
systems, is in the `boot/' directory.
3834
The GRUB kernel is in `kern/'. This contains core facilities such as
3835
the device, disk, and file frameworks, environment variable handling,
3836
list processing, and so on. The kernel should contain enough to get up
3837
to a rescue prompt. Header files for kernel facilities, among others,
3840
Terminal implementations are in `term/'.
3842
Disk access code is spread across `disk/' (for accessing the disk
3843
devices themselves), `partmap/' (for interpreting partition table
3844
data), and `fs/' (for accessing filesystems). Note that, with the odd
3845
specialised exception, GRUB only contains code to _read_ from
3846
filesystems and tries to avoid containing any code to _write_ to
3847
filesystems; this lets us confidently assure users that GRUB cannot be
3848
responsible for filesystem corruption.
3850
PCI and USB bus handling is in `bus/'.
3852
Video handling code is in `video/'. The graphical menu system uses
3853
this heavily, but is in a separate directory, `gfxmenu/'.
3855
Most commands are implemented by files in `commands/', with the
3856
following exceptions:
3858
* A few core commands live in `kern/corecmd.c'.
3860
* Commands related to normal mode live under `normal/'.
3862
* Commands that load and boot kernels live under `loader/'.
3864
* The `loopback' command is really a disk device, and so lives in
3867
* The `gettext' command lives under `gettext/'.
3869
* The `loadfont' and `lsfonts' commands live under `font/'.
3871
* The `serial', `terminfo', and `background_image' commands live
3874
* The `efiemu_*' commands live under `efiemu/'.
3876
There are a few other special-purpose exceptions; grep for them if
3880
File: grub.info, Node: Copying This Manual, Next: Index, Prev: Internals, Up: Top
3882
Appendix E Copying This Manual
3883
******************************
3887
* GNU Free Documentation License:: License for copying this manual.
3890
File: grub.info, Node: GNU Free Documentation License, Up: Copying This Manual
3892
E.1 GNU Free Documentation License
3893
==================================
3895
Version 1.2, November 2002
3897
Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
3898
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
3900
Everyone is permitted to copy and distribute verbatim copies
3901
of this license document, but changing it is not allowed.
3905
The purpose of this License is to make a manual, textbook, or other
3906
functional and useful document "free" in the sense of freedom: to
3907
assure everyone the effective freedom to copy and redistribute it,
3908
with or without modifying it, either commercially or
3909
noncommercially. Secondarily, this License preserves for the
3910
author and publisher a way to get credit for their work, while not
3911
being considered responsible for modifications made by others.
3913
This License is a kind of "copyleft", which means that derivative
3914
works of the document must themselves be free in the same sense.
3915
It complements the GNU General Public License, which is a copyleft
3916
license designed for free software.
3918
We have designed this License in order to use it for manuals for
3919
free software, because free software needs free documentation: a
3920
free program should come with manuals providing the same freedoms
3921
that the software does. But this License is not limited to
3922
software manuals; it can be used for any textual work, regardless
3923
of subject matter or whether it is published as a printed book.
3924
We recommend this License principally for works whose purpose is
3925
instruction or reference.
3927
1. APPLICABILITY AND DEFINITIONS
3929
This License applies to any manual or other work, in any medium,
3930
that contains a notice placed by the copyright holder saying it
3931
can be distributed under the terms of this License. Such a notice
3932
grants a world-wide, royalty-free license, unlimited in duration,
3933
to use that work under the conditions stated herein. The
3934
"Document", below, refers to any such manual or work. Any member
3935
of the public is a licensee, and is addressed as "you". You
3936
accept the license if you copy, modify or distribute the work in a
3937
way requiring permission under copyright law.
3939
A "Modified Version" of the Document means any work containing the
3940
Document or a portion of it, either copied verbatim, or with
3941
modifications and/or translated into another language.
3943
A "Secondary Section" is a named appendix or a front-matter section
3944
of the Document that deals exclusively with the relationship of the
3945
publishers or authors of the Document to the Document's overall
3946
subject (or to related matters) and contains nothing that could
3947
fall directly within that overall subject. (Thus, if the Document
3948
is in part a textbook of mathematics, a Secondary Section may not
3949
explain any mathematics.) The relationship could be a matter of
3950
historical connection with the subject or with related matters, or
3951
of legal, commercial, philosophical, ethical or political position
3954
The "Invariant Sections" are certain Secondary Sections whose
3955
titles are designated, as being those of Invariant Sections, in
3956
the notice that says that the Document is released under this
3957
License. If a section does not fit the above definition of
3958
Secondary then it is not allowed to be designated as Invariant.
3959
The Document may contain zero Invariant Sections. If the Document
3960
does not identify any Invariant Sections then there are none.
3962
The "Cover Texts" are certain short passages of text that are
3963
listed, as Front-Cover Texts or Back-Cover Texts, in the notice
3964
that says that the Document is released under this License. A
3965
Front-Cover Text may be at most 5 words, and a Back-Cover Text may
3966
be at most 25 words.
3968
A "Transparent" copy of the Document means a machine-readable copy,
3969
represented in a format whose specification is available to the
3970
general public, that is suitable for revising the document
3971
straightforwardly with generic text editors or (for images
3972
composed of pixels) generic paint programs or (for drawings) some
3973
widely available drawing editor, and that is suitable for input to
3974
text formatters or for automatic translation to a variety of
3975
formats suitable for input to text formatters. A copy made in an
3976
otherwise Transparent file format whose markup, or absence of
3977
markup, has been arranged to thwart or discourage subsequent
3978
modification by readers is not Transparent. An image format is
3979
not Transparent if used for any substantial amount of text. A
3980
copy that is not "Transparent" is called "Opaque".
3982
Examples of suitable formats for Transparent copies include plain
3983
ASCII without markup, Texinfo input format, LaTeX input format,
3984
SGML or XML using a publicly available DTD, and
3985
standard-conforming simple HTML, PostScript or PDF designed for
3986
human modification. Examples of transparent image formats include
3987
PNG, XCF and JPG. Opaque formats include proprietary formats that
3988
can be read and edited only by proprietary word processors, SGML or
3989
XML for which the DTD and/or processing tools are not generally
3990
available, and the machine-generated HTML, PostScript or PDF
3991
produced by some word processors for output purposes only.
3993
The "Title Page" means, for a printed book, the title page itself,
3994
plus such following pages as are needed to hold, legibly, the
3995
material this License requires to appear in the title page. For
3996
works in formats which do not have any title page as such, "Title
3997
Page" means the text near the most prominent appearance of the
3998
work's title, preceding the beginning of the body of the text.
4000
A section "Entitled XYZ" means a named subunit of the Document
4001
whose title either is precisely XYZ or contains XYZ in parentheses
4002
following text that translates XYZ in another language. (Here XYZ
4003
stands for a specific section name mentioned below, such as
4004
"Acknowledgements", "Dedications", "Endorsements", or "History".)
4005
To "Preserve the Title" of such a section when you modify the
4006
Document means that it remains a section "Entitled XYZ" according
4009
The Document may include Warranty Disclaimers next to the notice
4010
which states that this License applies to the Document. These
4011
Warranty Disclaimers are considered to be included by reference in
4012
this License, but only as regards disclaiming warranties: any other
4013
implication that these Warranty Disclaimers may have is void and
4014
has no effect on the meaning of this License.
4018
You may copy and distribute the Document in any medium, either
4019
commercially or noncommercially, provided that this License, the
4020
copyright notices, and the license notice saying this License
4021
applies to the Document are reproduced in all copies, and that you
4022
add no other conditions whatsoever to those of this License. You
4023
may not use technical measures to obstruct or control the reading
4024
or further copying of the copies you make or distribute. However,
4025
you may accept compensation in exchange for copies. If you
4026
distribute a large enough number of copies you must also follow
4027
the conditions in section 3.
4029
You may also lend copies, under the same conditions stated above,
4030
and you may publicly display copies.
4032
3. COPYING IN QUANTITY
4034
If you publish printed copies (or copies in media that commonly
4035
have printed covers) of the Document, numbering more than 100, and
4036
the Document's license notice requires Cover Texts, you must
4037
enclose the copies in covers that carry, clearly and legibly, all
4038
these Cover Texts: Front-Cover Texts on the front cover, and
4039
Back-Cover Texts on the back cover. Both covers must also clearly
4040
and legibly identify you as the publisher of these copies. The
4041
front cover must present the full title with all words of the
4042
title equally prominent and visible. You may add other material
4043
on the covers in addition. Copying with changes limited to the
4044
covers, as long as they preserve the title of the Document and
4045
satisfy these conditions, can be treated as verbatim copying in
4048
If the required texts for either cover are too voluminous to fit
4049
legibly, you should put the first ones listed (as many as fit
4050
reasonably) on the actual cover, and continue the rest onto
4053
If you publish or distribute Opaque copies of the Document
4054
numbering more than 100, you must either include a
4055
machine-readable Transparent copy along with each Opaque copy, or
4056
state in or with each Opaque copy a computer-network location from
4057
which the general network-using public has access to download
4058
using public-standard network protocols a complete Transparent
4059
copy of the Document, free of added material. If you use the
4060
latter option, you must take reasonably prudent steps, when you
4061
begin distribution of Opaque copies in quantity, to ensure that
4062
this Transparent copy will remain thus accessible at the stated
4063
location until at least one year after the last time you
4064
distribute an Opaque copy (directly or through your agents or
4065
retailers) of that edition to the public.
4067
It is requested, but not required, that you contact the authors of
4068
the Document well before redistributing any large number of
4069
copies, to give them a chance to provide you with an updated
4070
version of the Document.
4074
You may copy and distribute a Modified Version of the Document
4075
under the conditions of sections 2 and 3 above, provided that you
4076
release the Modified Version under precisely this License, with
4077
the Modified Version filling the role of the Document, thus
4078
licensing distribution and modification of the Modified Version to
4079
whoever possesses a copy of it. In addition, you must do these
4080
things in the Modified Version:
4082
A. Use in the Title Page (and on the covers, if any) a title
4083
distinct from that of the Document, and from those of
4084
previous versions (which should, if there were any, be listed
4085
in the History section of the Document). You may use the
4086
same title as a previous version if the original publisher of
4087
that version gives permission.
4089
B. List on the Title Page, as authors, one or more persons or
4090
entities responsible for authorship of the modifications in
4091
the Modified Version, together with at least five of the
4092
principal authors of the Document (all of its principal
4093
authors, if it has fewer than five), unless they release you
4094
from this requirement.
4096
C. State on the Title page the name of the publisher of the
4097
Modified Version, as the publisher.
4099
D. Preserve all the copyright notices of the Document.
4101
E. Add an appropriate copyright notice for your modifications
4102
adjacent to the other copyright notices.
4104
F. Include, immediately after the copyright notices, a license
4105
notice giving the public permission to use the Modified
4106
Version under the terms of this License, in the form shown in
4109
G. Preserve in that license notice the full lists of Invariant
4110
Sections and required Cover Texts given in the Document's
4113
H. Include an unaltered copy of this License.
4115
I. Preserve the section Entitled "History", Preserve its Title,
4116
and add to it an item stating at least the title, year, new
4117
authors, and publisher of the Modified Version as given on
4118
the Title Page. If there is no section Entitled "History" in
4119
the Document, create one stating the title, year, authors,
4120
and publisher of the Document as given on its Title Page,
4121
then add an item describing the Modified Version as stated in
4122
the previous sentence.
4124
J. Preserve the network location, if any, given in the Document
4125
for public access to a Transparent copy of the Document, and
4126
likewise the network locations given in the Document for
4127
previous versions it was based on. These may be placed in
4128
the "History" section. You may omit a network location for a
4129
work that was published at least four years before the
4130
Document itself, or if the original publisher of the version
4131
it refers to gives permission.
4133
K. For any section Entitled "Acknowledgements" or "Dedications",
4134
Preserve the Title of the section, and preserve in the
4135
section all the substance and tone of each of the contributor
4136
acknowledgements and/or dedications given therein.
4138
L. Preserve all the Invariant Sections of the Document,
4139
unaltered in their text and in their titles. Section numbers
4140
or the equivalent are not considered part of the section
4143
M. Delete any section Entitled "Endorsements". Such a section
4144
may not be included in the Modified Version.
4146
N. Do not retitle any existing section to be Entitled
4147
"Endorsements" or to conflict in title with any Invariant
4150
O. Preserve any Warranty Disclaimers.
4152
If the Modified Version includes new front-matter sections or
4153
appendices that qualify as Secondary Sections and contain no
4154
material copied from the Document, you may at your option
4155
designate some or all of these sections as invariant. To do this,
4156
add their titles to the list of Invariant Sections in the Modified
4157
Version's license notice. These titles must be distinct from any
4158
other section titles.
4160
You may add a section Entitled "Endorsements", provided it contains
4161
nothing but endorsements of your Modified Version by various
4162
parties--for example, statements of peer review or that the text
4163
has been approved by an organization as the authoritative
4164
definition of a standard.
4166
You may add a passage of up to five words as a Front-Cover Text,
4167
and a passage of up to 25 words as a Back-Cover Text, to the end
4168
of the list of Cover Texts in the Modified Version. Only one
4169
passage of Front-Cover Text and one of Back-Cover Text may be
4170
added by (or through arrangements made by) any one entity. If the
4171
Document already includes a cover text for the same cover,
4172
previously added by you or by arrangement made by the same entity
4173
you are acting on behalf of, you may not add another; but you may
4174
replace the old one, on explicit permission from the previous
4175
publisher that added the old one.
4177
The author(s) and publisher(s) of the Document do not by this
4178
License give permission to use their names for publicity for or to
4179
assert or imply endorsement of any Modified Version.
4181
5. COMBINING DOCUMENTS
4183
You may combine the Document with other documents released under
4184
this License, under the terms defined in section 4 above for
4185
modified versions, provided that you include in the combination
4186
all of the Invariant Sections of all of the original documents,
4187
unmodified, and list them all as Invariant Sections of your
4188
combined work in its license notice, and that you preserve all
4189
their Warranty Disclaimers.
4191
The combined work need only contain one copy of this License, and
4192
multiple identical Invariant Sections may be replaced with a single
4193
copy. If there are multiple Invariant Sections with the same name
4194
but different contents, make the title of each such section unique
4195
by adding at the end of it, in parentheses, the name of the
4196
original author or publisher of that section if known, or else a
4197
unique number. Make the same adjustment to the section titles in
4198
the list of Invariant Sections in the license notice of the
4201
In the combination, you must combine any sections Entitled
4202
"History" in the various original documents, forming one section
4203
Entitled "History"; likewise combine any sections Entitled
4204
"Acknowledgements", and any sections Entitled "Dedications". You
4205
must delete all sections Entitled "Endorsements."
4207
6. COLLECTIONS OF DOCUMENTS
4209
You may make a collection consisting of the Document and other
4210
documents released under this License, and replace the individual
4211
copies of this License in the various documents with a single copy
4212
that is included in the collection, provided that you follow the
4213
rules of this License for verbatim copying of each of the
4214
documents in all other respects.
4216
You may extract a single document from such a collection, and
4217
distribute it individually under this License, provided you insert
4218
a copy of this License into the extracted document, and follow
4219
this License in all other respects regarding verbatim copying of
4222
7. AGGREGATION WITH INDEPENDENT WORKS
4224
A compilation of the Document or its derivatives with other
4225
separate and independent documents or works, in or on a volume of
4226
a storage or distribution medium, is called an "aggregate" if the
4227
copyright resulting from the compilation is not used to limit the
4228
legal rights of the compilation's users beyond what the individual
4229
works permit. When the Document is included in an aggregate, this
4230
License does not apply to the other works in the aggregate which
4231
are not themselves derivative works of the Document.
4233
If the Cover Text requirement of section 3 is applicable to these
4234
copies of the Document, then if the Document is less than one half
4235
of the entire aggregate, the Document's Cover Texts may be placed
4236
on covers that bracket the Document within the aggregate, or the
4237
electronic equivalent of covers if the Document is in electronic
4238
form. Otherwise they must appear on printed covers that bracket
4239
the whole aggregate.
4243
Translation is considered a kind of modification, so you may
4244
distribute translations of the Document under the terms of section
4245
4. Replacing Invariant Sections with translations requires special
4246
permission from their copyright holders, but you may include
4247
translations of some or all Invariant Sections in addition to the
4248
original versions of these Invariant Sections. You may include a
4249
translation of this License, and all the license notices in the
4250
Document, and any Warranty Disclaimers, provided that you also
4251
include the original English version of this License and the
4252
original versions of those notices and disclaimers. In case of a
4253
disagreement between the translation and the original version of
4254
this License or a notice or disclaimer, the original version will
4257
If a section in the Document is Entitled "Acknowledgements",
4258
"Dedications", or "History", the requirement (section 4) to
4259
Preserve its Title (section 1) will typically require changing the
4264
You may not copy, modify, sublicense, or distribute the Document
4265
except as expressly provided for under this License. Any other
4266
attempt to copy, modify, sublicense or distribute the Document is
4267
void, and will automatically terminate your rights under this
4268
License. However, parties who have received copies, or rights,
4269
from you under this License will not have their licenses
4270
terminated so long as such parties remain in full compliance.
4272
10. FUTURE REVISIONS OF THIS LICENSE
4274
The Free Software Foundation may publish new, revised versions of
4275
the GNU Free Documentation License from time to time. Such new
4276
versions will be similar in spirit to the present version, but may
4277
differ in detail to address new problems or concerns. See
4278
`http://www.gnu.org/copyleft/'.
4280
Each version of the License is given a distinguishing version
4281
number. If the Document specifies that a particular numbered
4282
version of this License "or any later version" applies to it, you
4283
have the option of following the terms and conditions either of
4284
that specified version or of any later version that has been
4285
published (not as a draft) by the Free Software Foundation. If
4286
the Document does not specify a version number of this License,
4287
you may choose any version ever published (not as a draft) by the
4288
Free Software Foundation.
4290
E.1.1 ADDENDUM: How to use this License for your documents
4291
----------------------------------------------------------
4293
To use this License in a document you have written, include a copy of
4294
the License in the document and put the following copyright and license
4295
notices just after the title page:
4297
Copyright (C) YEAR YOUR NAME.
4298
Permission is granted to copy, distribute and/or modify this document
4299
under the terms of the GNU Free Documentation License, Version 1.2
4300
or any later version published by the Free Software Foundation;
4301
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
4302
Texts. A copy of the license is included in the section entitled ``GNU
4303
Free Documentation License''.
4305
If you have Invariant Sections, Front-Cover Texts and Back-Cover
4306
Texts, replace the "with...Texts." line with this:
4308
with the Invariant Sections being LIST THEIR TITLES, with
4309
the Front-Cover Texts being LIST, and with the Back-Cover Texts
4312
If you have Invariant Sections without Cover Texts, or some other
4313
combination of the three, merge those two alternatives to suit the
4316
If your document contains nontrivial examples of program code, we
4317
recommend releasing these examples in parallel under your choice of
4318
free software license, such as the GNU General Public License, to
4319
permit their use in free software.
4322
File: grub.info, Node: Index, Prev: Copying This Manual, Up: Top