1
This is /home/phcoder/grub2/bzr/mainline/docs/grub.info, produced by
2
makeinfo version 4.13 from
3
/home/phcoder/grub2/bzr/mainline/docs/grub.texi.
5
This manual is for GNU GRUB (version 1.99~rc1, 8 January 2011).
7
Copyright (C) 1999,2000,2001,2002,2004,2006,2008,2009,2010 Free
8
Software Foundation, Inc.
10
Permission is granted to copy, distribute and/or modify this
11
document under the terms of the GNU Free Documentation License,
12
Version 1.2 or any later version published by the Free Software
13
Foundation; with no Invariant Sections.
15
INFO-DIR-SECTION Kernel
17
* GRUB: (grub). The GRand Unified Bootloader
18
* grub-install: (grub)Invoking grub-install. Install GRUB on your drive
19
* grub-mkconfig: (grub)Invoking grub-mkconfig. Generate GRUB configuration
20
* grub-mkpasswd-pbkdf2: (grub)Invoking grub-mkpasswd-pbkdf2.
24
File: grub.info, Node: Top, Next: Introduction, Up: (dir)
29
This is the documentation of GNU GRUB, the GRand Unified Bootloader, a
30
flexible and powerful boot loader program for a wide range of
33
This edition documents version 1.99~rc1.
35
This manual is for GNU GRUB (version 1.99~rc1, 8 January 2011).
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' or `xz'(1)
318
(*note Features-Footnote-1::). This function is both automatic and
319
transparent to the user (i.e. all functions operate upon the
320
uncompressed contents of the specified files). This greatly
321
reduces a file size and loading time, a particularly great benefit
322
for floppies.(2) (*note Features-Footnote-2::)
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) Only CRC32 data integrity check is supported (xz default is
371
CRC64 so one should use -check=crc32 option). LZMA BCJ filters are
374
(2) There are a few pathological cases where loading a very badly
375
organized ELF kernel might take longer, but in practice this never
379
File: grub.info, Node: Role of a boot loader, Prev: Features, Up: Introduction
381
1.5 The role of a boot loader
382
=============================
384
The following is a quotation from Gordon Matzigkeit, a GRUB fanatic:
386
Some people like to acknowledge both the operating system and
387
kernel when they talk about their computers, so they might say
388
they use "GNU/Linux" or "GNU/Hurd". Other people seem to think
389
that the kernel is the most important part of the system, so they
390
like to call their GNU operating systems "Linux systems."
392
I, personally, believe that this is a grave injustice, because the
393
_boot loader_ is the most important software of all. I used to
394
refer to the above systems as either "LILO"(1) (*note Role of a
395
boot loader-Footnote-1::) or "GRUB" systems.
397
Unfortunately, nobody ever understood what I was talking about;
398
now I just use the word "GNU" as a pseudonym for GRUB.
400
So, if you ever hear people talking about their alleged "GNU"
401
systems, remember that they are actually paying homage to the best
402
boot loader around... GRUB!
404
We, the GRUB maintainers, do not (usually) encourage Gordon's level
405
of fanaticism, but it helps to remember that boot loaders deserve
406
recognition. We hope that you enjoy using GNU GRUB as much as we did
410
File: grub.info, Node: Role of a boot loader-Footnotes, Up: Role of a boot loader
412
(1) The LInux LOader, a boot loader that everybody uses, but nobody
416
File: grub.info, Node: Naming convention, Next: Installation, Prev: Introduction, Up: Top
421
The device syntax used in GRUB is a wee bit different from what you may
422
have seen before in your operating system(s), and you need to know it so
423
that you can specify a drive/partition.
425
Look at the following examples and explanations:
429
First of all, GRUB requires that the device name be enclosed with
430
`(' and `)'. The `fd' part means that it is a floppy disk. The number
431
`0' is the drive number, which is counted from _zero_. This expression
432
means that GRUB will use the whole floppy disk.
436
Here, `hd' means it is a hard disk drive. The first integer `0'
437
indicates the drive number, that is, the first hard disk, the string
438
`msdos' indicates the partition scheme, while the second integer, `2',
439
indicates the partition number (or the PC slice number in the BSD
440
terminology). The partition numbers are counted from _one_, not from
441
zero (as was the case in previous versions of GRUB). This expression
442
means the second partition of the first hard disk drive. In this case,
443
GRUB uses one partition of the disk, instead of the whole disk.
447
This specifies the first "extended partition" of the first hard disk
448
drive. Note that the partition numbers for extended partitions are
449
counted from `5', regardless of the actual number of primary partitions
454
This means the BSD `a' partition on first PC slice number of the
457
Of course, to actually access the disks or partitions with GRUB, you
458
need to use the device specification in a command, like `set
459
root=(fd0)' or `parttool (hd0,msdos3) hidden-'. To help you find out
460
which number specifies a partition you want, the GRUB command-line
461
(*note Command-line interface::) options have argument completion. This
462
means that, for example, you only need to type
466
followed by a <TAB>, and GRUB will display the list of drives,
467
partitions, or file names. So it should be quite easy to determine the
468
name of your target partition, even with minimal knowledge of the
471
Note that GRUB does _not_ distinguish IDE from SCSI - it simply
472
counts the drive numbers from zero, regardless of their type. Normally,
473
any IDE drive number is less than any SCSI drive number, although that
474
is not true if you change the boot sequence by swapping IDE and SCSI
477
Now the question is, how to specify a file? Again, consider an
482
This specifies the file named `vmlinuz', found on the first
483
partition of the first hard disk drive. Note that the argument
484
completion works with file names, too.
486
That was easy, admit it. Now read the next chapter, to find out how
487
to actually install GRUB on your drive.
490
File: grub.info, Node: Installation, Next: Booting, Prev: Naming convention, Up: Top
495
In order to install GRUB as your boot loader, you need to first install
496
the GRUB system and utilities under your UNIX-like operating system
497
(*note Obtaining and Building GRUB::). You can do this either from the
498
source tarball, or as a package for your OS.
500
After you have done that, you need to install the boot loader on a
501
drive (floppy or hard disk). There are two ways of doing that - either
502
using the utility `grub-install' (*note Invoking grub-install::) on a
503
UNIX-like OS, or by running GRUB itself from a floppy. These are quite
504
similar, however the utility might probe a wrong BIOS drive, so you
507
Also, if you install GRUB on a UNIX-like OS, please make sure that
508
you have an emergency boot disk ready, so that you can rescue your
509
computer if, by any chance, your hard drive becomes unusable
512
GRUB comes with boot images, which are normally put in the directory
513
`/usr/lib/grub/i386-pc'. Hereafter, the directory where GRUB images are
514
initially placed (normally `/usr/lib/grub/i386-pc') will be called the
515
"image directory", and the directory where the boot loader needs to
516
find them (usually `/boot/grub') will be called the "boot directory".
520
* Installing GRUB using grub-install::
521
* Making a GRUB bootable CD-ROM::
525
File: grub.info, Node: Installing GRUB using grub-install, Next: Making a GRUB bootable CD-ROM, Up: Installation
527
3.1 Installing GRUB using grub-install
528
======================================
530
*Caution:* This procedure is definitely less safe, because there are
531
several ways in which your computer can become unbootable. For example,
532
most operating systems don't tell GRUB how to map BIOS drives to OS
533
devices correctly--GRUB merely "guesses" the mapping. This will succeed
534
in most cases, but not always. Therefore, GRUB provides you with a map
535
file called the "device map", which you must fix if it is wrong. *Note
536
Device map::, for more details.
538
On BIOS platforms GRUB has to use a so-called embedding zone. On
539
msdos partition tables, this is the space between the MBR and the first
540
partition (called the MBR gap or the boot track), while on GPT
541
partition tables it uses a BIOS Boot Partition (a partition with GUID
542
21686148-6449-6e6f-744e656564454649). If you use GRUB on a BIOS system,
543
make sure that the embedding zone is at least 31 KiB (512KiB or more
546
If you still do want to install GRUB under a UNIX-like OS (such as
547
GNU), invoke the program `grub-install' (*note Invoking grub-install::)
548
as the superuser ("root").
550
The usage is basically very simple. You only need to specify one
551
argument to the program, namely, where to install the boot loader. The
552
argument can be either a device file (like `/dev/hda') or a partition
553
specified in GRUB's notation. For example, under Linux the following
554
will install GRUB into the MBR of the first IDE disk:
556
# grub-install /dev/hda
558
Likewise, under GNU/Hurd, this has the same effect:
560
# grub-install /dev/hd0
562
But all the above examples assume that GRUB should use images under
563
the root directory. If you want GRUB to use images under a directory
564
other than the root directory, you need to specify the option
565
`--root-directory'. The typical usage is that you create a GRUB boot
566
floppy with a filesystem. Here is an example:
569
# mount -t ext2 /dev/fd0 /mnt
570
# grub-install --root-directory=/mnt fd0
573
Another example is when you have a separate boot partition which is
574
mounted at `/boot'. Since GRUB is a boot loader, it doesn't know
575
anything about mountpoints at all. Thus, you need to run `grub-install'
578
# grub-install --root-directory=/boot /dev/hda
580
By the way, as noted above, it is quite difficult to guess BIOS
581
drives correctly under a UNIX-like OS. Thus, `grub-install' will prompt
582
you to check if it could really guess the correct mappings, after the
583
installation. The format is defined in *note Device map::. Please be
584
quite careful. If the output is wrong, it is unlikely that your
585
computer will be able to boot with no problem.
587
Some BIOSes have a bug of exposing the first partition of a USB
588
drive as a floppy instead of exposing the USB drive as a hard disk
589
(they call it "USB-FDD" boot). In such cases, you need to install like
592
# losetup /dev/loop0 /dev/sdb1
593
# mount /dev/loop0 /mnt/usb
594
# grub-install --boot-directory=/mnt/usb/bugbios --force --allow-floppy /dev/loop0
596
This install doesn't conflict with standard install as long as they
597
are in separate directories.
599
Note that `grub-install' is actually just a shell script and the
600
real task is done by `grub-mkimage' and `grub-setup'. Therefore, you
601
may run those commands directly to install GRUB, without using
602
`grub-install'. Don't do that, however, unless you are very familiar
603
with the internals of GRUB. Installing a boot loader on a running OS
604
may be extremely dangerous.
607
File: grub.info, Node: Making a GRUB bootable CD-ROM, Next: Device map, Prev: Installing GRUB using grub-install, Up: Installation
609
3.2 Making a GRUB bootable CD-ROM
610
=================================
612
GRUB supports the "no emulation mode" in the El Torito specification(1)
613
(*note Making a GRUB bootable CD-ROM-Footnote-1::). This means that you
614
can use the whole CD-ROM from GRUB and you don't have to make a floppy
615
or hard disk image file, which can cause compatibility problems.
617
For booting from a CD-ROM, GRUB uses a special Stage 2 called
618
`stage2_eltorito'. The only GRUB files you need to have in your
619
bootable CD-ROM are this `stage2_eltorito' and optionally a config file
620
`grub.cfg'. You don't need to use `stage1' or `stage2', because El
621
Torito is quite different from the standard boot process.
623
Here is an example of procedures to make a bootable CD-ROM image.
624
First, make a top directory for the bootable image, say, `iso':
628
Make a directory for GRUB:
630
$ mkdir -p iso/boot/grub
632
Copy the file `stage2_eltorito':
634
$ cp /usr/lib/grub/i386-pc/stage2_eltorito iso/boot/grub
636
If desired, make the config file `grub.cfg' under `iso/boot/grub'
637
(*note Configuration::), and copy any files and directories for the
638
disc to the directory `iso/'.
640
Finally, make a ISO9660 image file like this:
642
$ mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot \
643
-boot-load-size 4 -boot-info-table -o grub.iso iso
645
This produces a file named `grub.iso', which then can be burned into
646
a CD (or a DVD). `mkisofs' has already set up the disc to boot from
647
the `boot/grub/stage2_eltorito' file, so there is no need to setup GRUB
648
on the disc. (Note that the `-boot-load-size 4' bit is required for
649
compatibility with the BIOS on many older machines.)
651
You can use the device `(cd)' to access a CD-ROM in your config
652
file. This is not required; GRUB automatically sets the root device to
653
`(cd)' when booted from a CD-ROM. It is only necessary to refer to
654
`(cd)' if you want to access other drives as well.
657
File: grub.info, Node: Making a GRUB bootable CD-ROM-Footnotes, Up: Making a GRUB bootable CD-ROM
659
(1) El Torito is a specification for bootable CD using BIOS
663
File: grub.info, Node: Device map, Prev: Making a GRUB bootable CD-ROM, Up: Installation
665
3.3 The map between BIOS drives and OS devices
666
==============================================
668
The `grub-mkdevicemap' program can be used to create the "device map
669
file". It is often run automatically by tools such as `grub-install'
670
if the device map file does not already exist. The file name
671
`/boot/grub/device.map' is preferred.
673
If the device map file exists, the GRUB utilities (`grub-probe',
674
`grub-setup', etc.) read it to map BIOS drives to OS devices. This
675
file consists of lines like this:
679
DEVICE is a drive specified in the GRUB syntax (*note Device
680
syntax::), and FILE is an OS file, which is normally a device file.
682
Historically, the device map file was used because GRUB device names
683
had to be used in the configuration file, and they were derived from
684
BIOS drive numbers. The map between BIOS drives and OS devices cannot
685
always be guessed correctly: for example, GRUB will get the order wrong
686
if you exchange the boot sequence between IDE and SCSI in your BIOS.
688
Unfortunately, even OS device names are not always stable. Modern
689
versions of the Linux kernel may probe drives in a different order from
690
boot to boot, and the prefix (`/dev/hd*' versus `/dev/sd*') may change
691
depending on the driver subsystem in use. As a result, the device map
692
file required frequent editing on some systems.
694
GRUB avoids this problem nowadays by using UUIDs or file system
695
labels when generating `grub.cfg', and we advise that you do the same
696
for any custom menu entries you write. If the device map file does not
697
exist, then the GRUB utilities will assume a temporary device map on
698
the fly. This is often good enough, particularly in the common case of
701
However, the device map file is not entirely obsolete yet, and there
702
are still some situations that require it to exist. If necessary, you
703
may edit the file if `grub-mkdevicemap' makes a mistake. You can put
704
any comments in the file if needed, as the GRUB utilities assume that a
705
line is just a comment if the first character is `#'.
708
File: grub.info, Node: Booting, Next: Configuration, Prev: Installation, Up: Top
713
GRUB can load Multiboot-compliant kernels in a consistent way, but for
714
some free operating systems you need to use some OS-specific magic.
718
* General boot methods:: How to boot OSes with GRUB generally
719
* OS-specific notes:: Notes on some operating systems
722
File: grub.info, Node: General boot methods, Next: OS-specific notes, Up: Booting
724
4.1 How to boot operating systems
725
=================================
727
GRUB has two distinct boot methods. One of the two is to load an
728
operating system directly, and the other is to chain-load another boot
729
loader which then will load an operating system actually. Generally
730
speaking, the former is more desirable, because you don't need to
731
install or maintain other boot loaders and GRUB is flexible enough to
732
load an operating system from an arbitrary disk/partition. However, the
733
latter is sometimes required, since GRUB doesn't support all the
734
existing operating systems natively.
738
* Loading an operating system directly::
742
File: grub.info, Node: Loading an operating system directly, Next: Chain-loading, Up: General boot methods
744
4.1.1 How to boot an OS directly with GRUB
745
------------------------------------------
747
Multiboot (*note Multiboot Specification: (multiboot)Top.) is the
748
native format supported by GRUB. For the sake of convenience, there is
749
also support for Linux, FreeBSD, NetBSD and OpenBSD. If you want to
750
boot other operating systems, you will have to chain-load them (*note
753
FIXME: this section is incomplete.
755
1. Run the command `boot' (*note boot::).
757
However, DOS and Windows have some deficiencies, so you might have to
758
use more complicated instructions. *Note DOS/Windows::, for more
762
File: grub.info, Node: Chain-loading, Prev: Loading an operating system directly, Up: General boot methods
764
4.1.2 Chain-loading an OS
765
-------------------------
767
Operating systems that do not support Multiboot and do not have specific
768
support in GRUB (specific support is available for Linux, FreeBSD,
769
NetBSD and OpenBSD) must be chain-loaded, which involves loading
770
another boot loader and jumping to it in real mode.
772
The `chainloader' command (*note chainloader::) is used to set this
773
up. It is normally also necessary to load some GRUB modules and set the
774
appropriate root device. Putting this together, we get something like
775
this, for a Windows system on the first partition of the first hard
778
menuentry "Windows" {
785
On systems with multiple hard disks, an additional workaround may be
786
required. *Note DOS/Windows::.
788
Chain-loading is only supported on PC BIOS and EFI platforms.
791
File: grub.info, Node: OS-specific notes, Prev: General boot methods, Up: Booting
793
4.2 Some caveats on OS-specific issues
794
======================================
796
Here, we describe some caveats on several operating systems.
805
File: grub.info, Node: GNU/Hurd, Next: GNU/Linux, Up: OS-specific notes
810
Since GNU/Hurd is Multiboot-compliant, it is easy to boot it; there is
811
nothing special about it. But do not forget that you have to specify a
812
root partition to the kernel.
814
1. Set GRUB's root device to the same drive as GNU/Hurd's. The
815
command `search --file --set /boot/gnumach.gz' or similar may help
816
you (*note search::).
818
2. Load the kernel and the modules, like this:
820
grub> multiboot /boot/gnumach.gz root=device:hd0s1
821
grub> module /hurd/ext2fs.static ext2fs --readonly \
822
--multiboot-command-line='${kernel-command-line}' \
823
--host-priv-port='${host-port}' \
824
--device-master-port='${device-port}' \
825
--exec-server-task='${exec-task}' -T typed '${root}' \
826
'$(task-create)' '$(task-resume)'
827
grub> module /lib/ld.so.1 exec /hurd/exec '$(exec-task=task-create)'
829
3. Finally, run the command `boot' (*note boot::).
832
File: grub.info, Node: GNU/Linux, Next: DOS/Windows, Prev: GNU/Hurd, Up: OS-specific notes
837
It is relatively easy to boot GNU/Linux from GRUB, because it somewhat
838
resembles to boot a Multiboot-compliant OS.
840
1. Set GRUB's root device to the same drive as GNU/Linux's. The
841
command `search --file --set /vmlinuz' or similar may help you
844
2. Load the kernel using the command `linux' (*note linux::):
846
grub> linux /vmlinuz root=/dev/sda1
848
If you need to specify some kernel parameters, just append them to
849
the command. For example, to set `acpi' to `off', do this:
851
grub> linux /vmlinuz root=/dev/sda1 acpi=off
853
See the documentation in the Linux source tree for complete
854
information on the available options.
856
With `linux' GRUB uses 32-bit protocol. Some BIOS services like APM
857
or EDD aren't available with this protocol. In this case you need
860
grub> linux16 /vmlinuz root=/dev/sda1 acpi=off
862
3. If you use an initrd, execute the command `initrd' (*note initrd::)
867
If you used `linux16' you need to use `initrd16':
869
grub> initrd16 /initrd
871
4. Finally, run the command `boot' (*note boot::).
873
*Caution:* If you use an initrd and specify the `mem=' option to the
874
kernel to let it use less than actual memory size, you will also have
875
to specify the same memory size to GRUB. To let GRUB know the size, run
876
the command `uppermem' _before_ loading the kernel. *Note uppermem::,
877
for more information.
880
File: grub.info, Node: DOS/Windows, Prev: GNU/Linux, Up: OS-specific notes
885
GRUB cannot boot DOS or Windows directly, so you must chain-load them
886
(*note Chain-loading::). However, their boot loaders have some critical
887
deficiencies, so it may not work to just chain-load them. To overcome
888
the problems, GRUB provides you with two helper functions.
890
If you have installed DOS (or Windows) on a non-first hard disk, you
891
have to use the disk swapping technique, because that OS cannot boot
892
from any disks but the first one. The workaround used in GRUB is the
893
command `drivemap' (*note drivemap::), like this:
895
drivemap -s (hd0) (hd1)
897
This performs a "virtual" swap between your first and second hard
900
*Caution:* This is effective only if DOS (or Windows) uses BIOS to
901
access the swapped disks. If that OS uses a special driver for the
902
disks, this probably won't work.
904
Another problem arises if you installed more than one set of
905
DOS/Windows onto one disk, because they could be confused if there are
906
more than one primary partitions for DOS/Windows. Certainly you should
907
avoid doing this, but there is a solution if you do want to do so. Use
908
the partition hiding/unhiding technique.
910
If GRUB "hides" a DOS (or Windows) partition (*note parttool::), DOS
911
(or Windows) will ignore the partition. If GRUB "unhides" a DOS (or
912
Windows) partition, DOS (or Windows) will detect the partition. Thus,
913
if you have installed DOS (or Windows) on the first and the second
914
partition of the first hard disk, and you want to boot the copy on the
915
first partition, do the following:
917
parttool (hd0,1) hidden-
918
parttool (hd0,2) hidden+
921
parttool ${root} boot+
925
File: grub.info, Node: Configuration, Next: Theme file format, Prev: Booting, Up: Top
927
5 Writing your own configuration file
928
*************************************
930
GRUB is configured using `grub.cfg', usually located under
931
`/boot/grub'. This file is quite flexible, but most users will not
932
need to write the whole thing by hand.
936
* Simple configuration:: Recommended for most users
937
* Shell-like scripting:: For power users and developers
938
* Embedded configuration:: Embedding a configuration file into GRUB
941
File: grub.info, Node: Simple configuration, Next: Shell-like scripting, Up: Configuration
943
5.1 Simple configuration handling
944
=================================
946
The program `grub-mkconfig' (*note Invoking grub-mkconfig::) generates
947
`grub.cfg' files suitable for most cases. It is suitable for use when
948
upgrading a distribution, and will discover available kernels and
949
attempt to generate menu entries for them.
951
The file `/etc/default/grub' controls the operation of
952
`grub-mkconfig'. It is sourced by a shell script, and so must be valid
953
POSIX shell input; normally, it will just be a sequence of `KEY=value'
954
lines, but if the value contains spaces or other special characters
955
then it must be quoted. For example:
957
GRUB_TERMINAL_INPUT="console serial"
959
Valid keys in `/etc/default/grub' are as follows:
962
The default menu entry. This may be a number, in which case it
963
identifies the Nth entry in the generated menu counted from zero,
964
or the full name of a menu entry, or the special string `saved'.
965
Using the full name may be useful if you want to set a menu entry
966
as the default even though there may be a variable number of
969
If you set this to `saved', then the default menu entry will be
970
that saved by `GRUB_SAVEDEFAULT', `grub-set-default', or
976
If this option is set to `true', then, when an entry is selected,
977
save it as a new default entry for use by future runs of GRUB.
978
This is only useful if `GRUB_DEFAULT=saved'; it is a separate
979
option because `GRUB_DEFAULT=saved' is useful without this option,
980
in conjunction with `grub-set-default' or `grub-reboot'. Unset by
981
default. The remarks of *note Changes from GRUB Legacy:: on the
982
availability of `save_env' apply.
985
Boot the default entry this many seconds after the menu is
986
displayed, unless a key is pressed. The default is `5'. Set to
987
`0' to boot immediately without displaying the menu, or to `-1' to
990
`GRUB_HIDDEN_TIMEOUT'
991
Wait this many seconds for a key to be pressed before displaying
992
the menu. If no key is pressed during that time, boot
993
immediately. Unset by default.
995
`GRUB_HIDDEN_TIMEOUT_QUIET'
996
In conjunction with `GRUB_HIDDEN_TIMEOUT', set this to `true' to
997
suppress the verbose countdown while waiting for a key to be
998
pressed before displaying the menu. Unset by default.
1000
`GRUB_DEFAULT_BUTTON'
1001
`GRUB_TIMEOUT_BUTTON'
1002
`GRUB_HIDDEN_TIMEOUT_BUTTON'
1003
`GRUB_BUTTON_CMOS_ADDRESS'
1004
Variants of the corresponding variables without the `_BUTTON'
1005
suffix, used to support vendor-specific power buttons. *Note
1006
Vendor power-on keys::.
1009
Set by distributors of GRUB to their identifying name. This is
1010
used to generate more informative menu entry titles.
1012
`GRUB_TERMINAL_INPUT'
1013
Select the terminal input device. You may select multiple devices
1014
here, separated by spaces.
1016
Valid terminal input names depend on the platform, but may include
1017
`console' (PC BIOS and EFI consoles), `serial' (serial terminal),
1018
`ofconsole' (Open Firmware console), `at_keyboard' (PC AT
1019
keyboard, mainly useful with Coreboot), or `usb_keyboard' (USB
1020
keyboard using the HID Boot Protocol, for cases where the firmware
1021
does not handle this).
1023
The default is to use the platform's native terminal input.
1025
`GRUB_TERMINAL_OUTPUT'
1026
Select the terminal output device. You may select multiple
1027
devices here, separated by spaces.
1029
Valid terminal output names depend on the platform, but may include
1030
`console' (PC BIOS and EFI consoles), `serial' (serial terminal),
1031
`gfxterm' (graphics-mode output), `ofconsole' (Open Firmware
1032
console), or `vga_text' (VGA text output, mainly useful with
1035
The default is to use the platform's native terminal output.
1038
If this option is set, it overrides both `GRUB_TERMINAL_INPUT' and
1039
`GRUB_TERMINAL_OUTPUT' to the same value.
1041
`GRUB_SERIAL_COMMAND'
1042
A command to configure the serial port when using the serial
1043
console. *Note serial::. Defaults to `serial'.
1045
`GRUB_CMDLINE_LINUX'
1046
Command-line arguments to add to menu entries for the Linux kernel.
1048
`GRUB_CMDLINE_LINUX_DEFAULT'
1049
Unless `GRUB_DISABLE_RECOVERY' is set to `true', two menu entries
1050
will be generated for each Linux kernel: one default entry and one
1051
entry for recovery mode. This option lists command-line arguments
1052
to add only to the default menu entry, after those listed in
1053
`GRUB_CMDLINE_LINUX'.
1055
`GRUB_CMDLINE_NETBSD'
1056
`GRUB_CMDLINE_NETBSD_DEFAULT'
1057
As `GRUB_CMDLINE_LINUX' and `GRUB_CMDLINE_LINUX_DEFAULT', but for
1061
`GRUB_CMDLINE_XEN_DEFAULT'
1062
As `GRUB_CMDLINE_LINUX' and `GRUB_CMDLINE_LINUX_DEFAULT', but for
1065
`GRUB_DISABLE_LINUX_UUID'
1066
Normally, `grub-mkconfig' will generate menu entries that use
1067
universally-unique identifiers (UUIDs) to identify the root
1068
filesystem to the Linux kernel, using a `root=UUID=...' kernel
1069
parameter. This is usually more reliable, but in some cases it
1070
may not be appropriate. To disable the use of UUIDs, set this
1073
`GRUB_DISABLE_RECOVERY'
1074
If this option is set to `true', disable the generation of recovery
1077
`GRUB_VIDEO_BACKEND'
1078
If graphical video support is required, either because the
1079
`gfxterm' graphical terminal is in use or because
1080
`GRUB_GFXPAYLOAD_LINUX' is set, then `grub-mkconfig' will normally
1081
load all available GRUB video drivers and use the one most
1082
appropriate for your hardware. If you need to override this for
1083
some reason, then you can set this option.
1085
After `grub-install' has been run, the available video drivers are
1086
listed in `/boot/grub/video.lst'.
1089
Set the resolution used on the `gfxterm' graphical terminal. Note
1090
that you can only use modes which your graphics card supports via
1091
VESA BIOS Extensions (VBE), so for example native LCD panel
1092
resolutions may not be available. The default is `640x480'.
1095
Set a background image for use with the `gfxterm' graphical
1096
terminal. The value of this option must be a file readable by
1097
GRUB at boot time, and it must end with `.png', `.tga', `.jpg', or
1098
`.jpeg'. The image will be scaled if necessary to fit the screen.
1101
Set a theme for use with the `gfxterm' graphical terminal.
1103
`GRUB_GFXPAYLOAD_LINUX'
1104
Set to `text' to force the Linux kernel to boot in normal text
1105
mode, `keep' to preserve the graphics mode set using
1106
`GRUB_GFXMODE', `WIDTHxHEIGHT'[`xDEPTH'] to set a particular
1107
graphics mode, or a sequence of these separated by commas or
1108
semicolons to try several modes in sequence.
1110
Depending on your kernel, your distribution, your graphics card,
1111
and the phase of the moon, note that using this option may cause
1112
GNU/Linux to suffer from various display problems, particularly
1113
during the early part of the boot sequence. If you have problems,
1114
set this option to `text' and GRUB will tell Linux to boot in
1117
`GRUB_DISABLE_OS_PROBER'
1118
Normally, `grub-mkconfig' will try to use the external `os-prober'
1119
program, if installed, to discover other operating systems
1120
installed on the same system and generate appropriate menu entries
1121
for them. Set this option to `true' to disable this.
1124
Play a tune on the speaker when GRUB starts. This is particularly
1125
useful for users unable to see the screen. The value of this
1126
option is passed directly to *note play::.
1129
If this option is set, GRUB will issue a *note badram:: command to
1130
filter out specified regions of RAM.
1133
For more detailed customisation of `grub-mkconfig''s output, you may
1134
edit the scripts in `/etc/grub.d' directly. `/etc/grub.d/40_custom' is
1135
particularly useful for adding entire custom menu entries; simply type
1136
the menu entries you want to add at the end of that file, making sure
1137
to leave at least the first two lines intact.
1140
File: grub.info, Node: Shell-like scripting, Next: Embedded configuration, Prev: Simple configuration, Up: Configuration
1142
5.2 Writing full configuration files directly
1143
=============================================
1145
`grub.cfg' is written in GRUB's built-in scripting language, which has
1146
a syntax quite similar to that of GNU Bash and other Bourne shell
1152
A "word" is a sequence of characters considered as a single unit by
1153
GRUB. Words are separated by "metacharacters", which are the following
1154
plus space, tab, and newline:
1158
Quoting may be used to include metacharacters in words; see below.
1163
Reserved words have a special meaning to GRUB. The following words are
1164
recognised as reserved when unquoted and either the first word of a
1165
simple command or the third word of a `for' command:
1168
case do done elif else esac fi for function
1169
if in menuentry select then time until while
1171
Not all of these reserved words have a useful purpose yet; some are
1172
reserved for future expansion.
1177
Quoting is used to remove the special meaning of certain characters or
1178
words. It can be used to treat metacharacters as part of a word, to
1179
prevent reserved words from being recognised as such, and to prevent
1182
There are three quoting mechanisms: the escape character, single
1183
quotes, and double quotes.
1185
A non-quoted backslash (\) is the "escape character". It preserves
1186
the literal value of the next character that follows, with the
1187
exception of newline.
1189
Enclosing characters in single quotes preserves the literal value of
1190
each character within the quotes. A single quote may not occur between
1191
single quotes, even when preceded by a backslash.
1193
Enclosing characters in double quotes preserves the literal value of
1194
all characters within the quotes, with the exception of `$' and `\'.
1195
The `$' character retains its special meaning within double quotes.
1196
The backslash retains its special meaning only when followed by one of
1197
the following characters: `$', `"', `\', or newline. A
1198
backslash-newline pair is treated as a line continuation (that is, it is
1199
removed from the input stream and effectively ignored(1) (*note
1200
Shell-like scripting-Footnote-1::)). A double quote may be quoted
1201
within double quotes by preceding it with a backslash.
1206
The `$' character introduces variable expansion. The variable name to
1207
be expanded may be enclosed in braces, which are optional but serve to
1208
protect the variable to be expanded from characters immediately
1209
following it which could be interpreted as part of the name.
1211
Normal variable names begin with an alphabetic character, followed
1212
by zero or more alphanumeric characters.
1214
Positional variable names consist of one or more digits. They
1215
represent parameters passed to function calls, with `$1' representing
1216
the first parameter, and so on.
1218
The special variable name `?' expands to the exit status of the most
1219
recently executed command. When positional variable names are active,
1220
other special variable names `@', `*' and `#' are defined and they
1221
expand to all positional parameters with necessary quoting, positional
1222
parameters without any quoting, and positional parameter count
1228
A word beginning with `#' causes that word and all remaining characters
1229
on that line to be ignored.
1234
A "simple command" is a sequence of words separated by spaces or tabs
1235
and terminated by a semicolon or a newline. The first word specifies
1236
the command to be executed. The remaining words are passed as
1237
arguments to the invoked command.
1239
The return value of a simple command is its exit status. If the
1240
reserved word `!' precedes the command, then the return value is
1241
instead the logical negation of the command's exit status.
1246
A "compound command" is one of the following:
1248
for NAME in WORD ...; do LIST; done
1249
The list of words following `in' is expanded, generating a list of
1250
items. The variable NAME is set to each element of this list in
1251
turn, and LIST is executed each time. The return value is the
1252
exit status of the last command that executes. If the expansion
1253
of the items following `in' results in an empty list, no commands
1254
are executed, and the return status is 0.
1256
if LIST; then LIST; [elif LIST; then LIST;] ... [else LIST;] fi
1257
The `if' LIST is executed. If its exit status is zero, the `then'
1258
LIST is executed. Otherwise, each `elif' LIST is executed in
1259
turn, and if its exit status is zero, the corresponding `then'
1260
LIST is executed and the command completes. Otherwise, the `else'
1261
LIST is executed, if present. The exit status is the exit status
1262
of the last command executed, or zero if no condition tested true.
1264
while COND; do LIST; done
1265
until COND; do LIST; done
1266
The `while' command continuously executes the `do' LIST as long as
1267
the last command in COND returns an exit status of zero. The
1268
`until' command is identical to the `while' command, except that
1269
the test is negated; the `do' LIST is executed as long as the last
1270
command in COND returns a non-zero exit status. The exit status
1271
of the `while' and `until' commands is the exit status of the last
1272
`do' LIST command executed, or zero if none was executed.
1274
function NAME { COMMAND; ... }
1275
This defines a function named NAME. The "body" of the function is
1276
the list of commands within braces, each of which must be
1277
terminated with a semicolon or a newline. This list of commands
1278
will be executed whenever NAME is specified as the name of a
1279
simple command. Function definitions do not affect the exit
1280
status in `$?'. When executed, the exit status of a function is
1281
the exit status of the last command executed in the body.
1283
menuentry TITLE [`--class=class' ...] [`--users=users'] [`--hotkey=key'] { COMMAND; ... }
1289
Some built-in commands are also provided by GRUB script to help script
1290
writers perform actions that are otherwise not possible. For example,
1291
these include commands to jump out of a loop without fully completing
1295
Exit from within a `for', `while', or `until' loop. If `n' is
1296
specified, break `n' levels. `n' must be greater than or equal to
1297
1. If `n' is greater than the number of enclosing loops, all
1298
enclosing loops are exited. The return value is 0 unless `n' is
1299
not greater than or equal to 1.
1302
Resume the next iteration of the enclosing `for', `while' or
1303
`until' loop. If `n' is specified, resume at the `n'th enclosing
1304
loop. `n' must be greater than or equal to 1. If `n' is greater
1305
than the number of enclosing loops, the last enclosing loop (the
1306
"top-level" loop) is resumed. The return value is 0 unless `n' is
1307
not greater than or equal to 1.
1310
Causes a function to exit with the return value specified by `n'.
1311
If `n' is omitted, the return status is that of the last command
1312
executed in the function body. If used outside a function the
1313
return status is false.
1316
The positional parameters from `n'+1 ... are renamed to `$1'....
1317
Parameters represented by the numbers `$#' down to `$#'-`n'+1 are
1318
unset. `n' must be a non-negative number less than or equal to
1319
`$#'. If `n' is 0, no parameters are changed. If `n' is not
1320
given, it is assumed to be 1. If `n' is greater than `$#', the
1321
positional parameters are not changed. The return status is
1322
greater than zero if `n' is greater than `$#' or less than zero;
1327
File: grub.info, Node: Shell-like scripting-Footnotes, Up: Shell-like scripting
1329
(1) Currently a backslash-newline pair within a variable name is not
1330
handled properly, so use this feature with some care.
1333
File: grub.info, Node: Embedded configuration, Prev: Shell-like scripting, Up: Configuration
1335
5.3 Embedding a configuration file into GRUB
1336
============================================
1338
GRUB supports embedding a configuration file directly into the core
1339
image, so that it is loaded before entering normal mode. This is
1340
useful, for example, when it is not straightforward to find the real
1341
configuration file, or when you need to debug problems with loading
1342
that file. `grub-install' uses this feature when it is not using BIOS
1343
disk functions or when installing to a different disk from the one
1344
containing `/boot/grub', in which case it needs to use the `search'
1345
command (*note search::) to find `/boot/grub'.
1347
To embed a configuration file, use the `-c' option to
1348
`grub-mkimage'. The file is copied into the core image, so it may
1349
reside anywhere on the file system, and may be removed after running
1352
After the embedded configuration file (if any) is executed, GRUB
1353
will load the `normal' module, which will then read the real
1354
configuration file from `$prefix/grub.cfg'. By this point, the `root'
1355
variable will also have been set to the root device name. For example,
1356
`prefix' might be set to `(hd0,1)/boot/grub', and `root' might be set to
1357
`hd0,1'. Thus, in most cases, the embedded configuration file only
1358
needs to set the `prefix' and `root' variables, and then drop through
1359
to GRUB's normal processing. A typical example of this might look like
1362
search.fs_uuid 01234567-89ab-cdef-0123-456789abcdef root
1363
set prefix=($root)/boot/grub
1365
(The `search_fs_uuid' module must be included in the core image for
1366
this example to work.)
1368
In more complex cases, it may be useful to read other configuration
1369
files directly from the embedded configuration file. This allows such
1370
things as reading files not called `grub.cfg', or reading files from a
1371
directory other than that where GRUB's loadable modules are installed.
1372
To do this, include the `configfile' and `normal' modules in the core
1373
image, and embed a configuration file that uses the `configfile'
1374
command to load another file. The following example of this also
1375
requires the `echo', `search_label', and `test' modules to be included
1378
search.fs_label grub root
1379
if [ -e /boot/grub/example/test1.cfg ]; then
1380
set prefix=($root)/boot/grub
1381
configfile /boot/grub/example/test1.cfg
1383
if [ -e /boot/grub/example/test2.cfg ]; then
1384
set prefix=($root)/boot/grub
1385
configfile /boot/grub/example/test2.cfg
1387
echo "Could not find an example configuration file!"
1391
The embedded configuration file may not contain menu entries
1392
directly, but may only read them from elsewhere using `configfile'.
1395
File: grub.info, Node: Theme file format, Next: Network, Prev: Configuration, Up: Top
1403
The GRUB graphical menu supports themes that can customize the layout
1404
and appearance of the GRUB boot menu. The theme is configured through
1405
a plain text file that specifies the layout of the various GUI
1406
components (including the boot menu, timeout progress bar, and text
1407
messages) as well as the appearance using colors, fonts, and images.
1408
Example is available in docs/example_theme.txt
1416
Colors can be specified in several ways:
1418
* HTML-style "#RRGGBB" or "#RGB" format, where *R*, *G*, and *B* are
1419
hexadecimal digits (e.g., "#8899FF")
1421
* as comma-separated decimal RGB values (e.g., "128, 128, 255")
1423
* with "SVG 1.0 color names" (e.g., "cornflowerblue") which must be
1424
specified in lowercase.
1429
The fonts GRUB uses "PFF2 font format" bitmap fonts. Fonts are
1430
specified with full font names. Currently there is no provision for a
1431
preference list of fonts, or deriving one font from another. Fonts are
1432
loaded with the "loadfont" command in GRUB. To see the list of loaded
1433
fonts, execute the "lsfonts" command. If there are too many fonts to
1434
fit on screen, do "set pager=1" before executing "lsfonts".
1443
Progress bars are used to display the remaining time before GRUB
1444
boots the default menu entry. To create a progress bar that will
1445
display the remaining time before automatic boot, simply create a
1446
"progress_bar" component with the id "__timeout__". This indicates to
1447
GRUB that the progress bar should be updated as time passes, and it
1448
should be made invisible if the countdown to automatic boot is
1449
interrupted by the user.
1451
Progress bars may optionally have text displayed on them. This is
1452
controlled through the "show_text" property, which can be set to either
1453
"true" or "false" to control whether text is displayed. When GRUB is
1454
counting down to automatic boot, the text informs the user of the
1455
number of seconds remaining.
1457
6.2.4 Circular Progress Indicator
1458
---------------------------------
1460
The circular progress indicator functions similarly to the progress
1461
bar. When given an id of "__timeout__", GRUB updates the circular
1462
progress indicator's value to indicate the time remaining. For the
1463
circular progress indicator, there are two images used to render it:
1464
the *center* image, and the *tick* image. The center image is rendered
1465
in the center of the component, while the tick image is used to render
1466
each mark along the circumference of the indicator.
1471
Text labels can be placed on the boot screen. The font, color, and
1472
horizontal alignment can be specified for labels. If a label is given
1473
the id "__timeout__", then the "text" property for that label is also
1474
updated with a message informing the user of the number of seconds
1475
remaining until automatic boot. This is useful in case you want the
1476
text displayed somewhere else instead of directly on the progress bar.
1481
The boot menu where GRUB displays the menu entries from the "grub.cfg"
1482
file. It is a list of items, where each item has a title and an
1483
optional icon. The icon is selected based on the *classes* specified
1484
for the menu entry. If there is a PNG file named "myclass.png" in the
1485
"grub/themes/icons" directory, it will be displayed for items which
1486
have the class *myclass*. The boot menu can be customized in several
1487
ways, such as the font and color used for the menu entry title, and by
1488
specifying styled boxes for the menu itself and for the selected item
1494
One of the most important features for customizing the layout is the
1495
use of *styled boxes*. A styled box is composed of 9 rectangular (and
1496
potentially empty) regions, which are used to seamlessly draw the
1497
styled box on screen:
1499
Northwest (nw) North (n) Northeast (ne)
1500
West (w) Center (c) East (e)
1501
Southwest (sw) South (s) Southeast (se)
1503
To support any size of box on screen, the center slice and the
1504
slices for the top, bottom, and sides are all scaled to the correct
1505
size for the component on screen, using the following rules:
1507
1. The edge slices (north, south, east, and west) are scaled in the
1508
direction of the edge they are adjacent to. For instance, the
1509
west slice is scaled vertically.
1511
2. The corner slices (northwest, northeast, southeast, and southwest)
1514
3. The center slice is scaled to fill the remaining space in the
1517
As an example of how an image might be sliced up, consider the
1518
styled box used for a terminal view.
1522
6.2.8 Creating Styled Box Images
1523
--------------------------------
1525
The Inkscape_ scalable vector graphics editor is a very useful tool for
1526
creating styled box images. One process that works well for slicing a
1527
drawing into the necessary image slices is:
1529
1. Create or open the drawing you'd like use.
1531
2. Create a new layer on the top of the layer stack. Make it
1532
visible. Select this layer as the current layer.
1534
3. Draw 9 rectangles on your drawing where you'd like the slices to
1535
be. Clear the fill option, and set the stroke to 1 pixel wide
1536
solid stroke. The corners of the slices must meet precisely; if
1537
it is off by a single pixel, it will probably be evident when the
1538
styled box is rendered in the GRUB menu. You should probably go
1539
to File | Document Properties | Grids and enable a grid or create
1540
a guide (click on one of the rulers next to the drawing and drag
1541
over the drawing; release the mouse button to place the guide) to
1542
help place the rectangles precisely.
1544
4. Right click on the center slice rectangle and choose Object
1545
Properties. Change the "Id" to "slice_c" and click Set. Repeat
1546
this for the remaining 8 rectangles, giving them Id values of
1547
"slice_n", "slice_ne", "slice_e", and so on according to the
1550
5. Save the drawing.
1552
6. Select all the slice rectangles. With the slice layer selected,
1553
you can simply press Ctrl+A to select all rectangles. The status
1554
bar should indicate that 9 rectangles are selected.
1556
7. Click the layer hide icon for the slice layer in the layer
1557
palette. The rectangles will remain selected, even though they
1560
8. Choose File | Export Bitmap and check the *Batch export 9 selected
1561
objects* box. Make sure that *Hide all except selected* is
1562
unchecked. click *Export*. This will create PNG files in the same
1563
directory as the drawing, named after the slices. These can now
1564
be used for a styled box in a GRUB theme.
1566
6.3 Theme File Manual
1567
=====================
1569
The theme file is a plain text file. Lines that begin with "#" are
1570
ignored and considered comments. (Note: This may not be the case if
1571
the previous line ended where a value was expected.)
1573
The theme file contains two types of statements:
1574
1. Global properties.
1576
2. Component construction.
1578
6.3.1 Global Properties
1579
-----------------------
1584
Global properties are specified with the simple format:
1587
* name2: "value which may contain spaces"
1591
In this example, name3 is assigned a color value.
1593
6.3.3 Global Property List
1594
--------------------------
1596
title-text Specifies the text to display at the top
1597
center of the screen as a title.
1598
title-font Defines the font used for the title
1599
message at the top of the screen.
1600
title-color Defines the color of the title message.
1601
message-font Defines the font used for messages, such
1602
as when GRUB is unable to automatically
1604
message-color Defines the color of the message text.
1605
message-bg-color Defines the background color of the
1607
desktop-image Specifies the image to use as the
1608
background. It will be scaled to fit the
1610
desktop-color Specifies the color for the background if
1611
*desktop-image* is not specified.
1612
terminal-box Specifies the file name pattern for the
1613
styled box slices used for the command
1614
line terminal window. For example,
1615
"terminal-box: terminal_*.png" will use
1616
the images "terminal_c.png" as the center
1617
area, "terminal_n.png" as the north (top)
1618
edge, "terminal_nw.png" as the northwest
1619
(upper left) corner, and so on. If the
1620
image for any slice is not found, it will
1621
simply be left empty.
1623
6.3.4 Component Construction
1624
----------------------------
1626
Greater customizability comes is provided by components. A tree of
1627
components forms the user interface. *Containers* are components that
1628
can contain other components, and there is always a single root
1629
component which is an instance of a *canvas* container.
1631
Components are created in the theme file by prefixing the type of
1632
component with a '+' sign:
1634
` + label { text="GRUB" font="aqui 11" color="#8FF" } '
1636
properties of a component are specified as "name = value" (whitespace
1637
surrounding tokens is optional and is ignored) where *value* may be:
1638
* a single word (e.g., "align = center", "color = #FF8080"),
1640
* a quoted string (e.g., "text = "Hello, World!""), or
1642
* a tuple (e.g., "preferred_size = (120, 80)").
1644
6.3.5 Component List
1645
--------------------
1647
The following is a list of the components and the properties they
1650
* label A label displays a line of text.
1653
text The text to display.
1654
font The font to use for text display.
1655
color The color of the text.
1656
align The horizontal alignment of the text within
1657
the component. Options are "left", "center",
1660
* image A component that displays an image. The image is scaled
1661
to fit the component, although the preferred size defaults to
1662
the image's original size unless the "preferred_size" property
1667
file The full path to the image file to load.
1669
* progress_bar Displays a horizontally oriented progress bar. It
1670
can be rendered using simple solid filled rectangles, or using
1671
a pair of pixmap styled boxes.
1675
fg_color The foreground color for plain solid color
1677
bg_color The background color for plain solid color
1679
border_color The border color for plain solid color
1681
text_color The text color.
1682
show_text Boolean value indicating whether or not text
1683
should be displayed on the progress bar. If
1684
set to *false*, then no text will be displayed
1685
on the bar. If set to any other value, text
1686
will be displayed on the bar.
1687
bar_style The styled box specification for the frame of
1688
the progress bar. Example:
1689
"progress_frame_*.png"
1690
highlight_styleThe styled box specification for the
1691
highlighted region of the progress bar. This
1692
box will be used to paint just the highlighted
1693
region of the bar, and will be increased in
1694
size as the bar nears completion. Example:
1695
"progress_hl_*.png".
1696
text The text to display on the progress bar. If
1697
the progress bar's ID is set to "__timeout__",
1698
then GRUB will updated this property with an
1699
informative message as the timeout approaches.
1700
value The progress bar current value. Normally not
1702
start The progress bar start value. Normally not
1704
end The progress bar end value. Normally not set
1707
* circular_progress Displays a circular progress indicator. The
1708
appearance of this component is determined by two images: the
1709
*center* image and the *tick* image. The center image is
1710
generally larger and will be drawn in the center of the
1711
component. Around the circumference of a circle within the
1712
component, the tick image will be drawn a certain number of
1713
times, depending on the properties of the component.
1717
center_bitmap The file name of the image to draw in
1718
the center of the component.
1719
tick_bitmap The file name of the image to draw for
1721
num_ticks The number of ticks that make up a full
1723
ticks_disappear Boolean value indicating whether tick
1724
marks should progressively appear,
1725
or progressively disappear as *value*
1726
approaches *end*. Specify "true"
1728
value The progress indicator current value.
1729
Normally not set manually.
1730
start The progress indicator start value.
1731
Normally not set manually.
1732
end The progress indicator end value.
1733
Normally not set manually.
1735
* boot_menu Displays the GRUB boot menu. It allows selecting
1736
items and executing them.
1740
item_font The font to use for the menu item
1742
selected_item_font The font to use for the selected
1743
menu item, or "inherit" (the
1744
default) to use "item_font"
1745
for the selected menu item as
1747
item_color The color to use for the menu
1749
selected_item_color The color to use for the selected
1750
menu item, or "inherit" (the
1752
"item_color" for the selected
1754
icon_width The width of menu item icons.
1755
Icons are scaled to the specified
1757
icon_height The height of menu item icons.
1758
item_height The height of each menu item in
1760
item_padding The amount of space in pixels to
1761
leave on each side of the menu
1763
item_icon_space The space between an item's icon
1764
and the title text, in pixels.
1765
item_spacing The amount of space to leave
1766
between menu items, in pixels.
1767
menu_pixmap_style The image file pattern for the
1768
menu frame styled box.
1769
Example: "menu_*.png" (this will
1770
use images such as "menu_c.png",
1771
"menu_w.png", `menu_nw.png",
1773
selected_item_pixmap_style The image file pattern for the
1774
selected item highlight styled
1776
scrollbar Boolean value indicating whether
1777
the scroll bar should be drawn if
1778
the frame and thumb styled
1779
boxes are configured.
1780
scrollbar_frame The image file pattern for the
1782
Example: "scrollbar_*.png"
1783
scrollbar_thumb The image file pattern for the
1784
scroll bar thumb (the part of the
1785
scroll bar that moves as
1787
Example: "scrollbar_thumb_*.png"
1788
max_items_shown The maximum number of items to
1789
show on the menu. If there are
1790
more than *max_items_shown*
1791
items in the menu, the list will
1792
scroll to make all items
1795
* canvas Canvas is a container that allows manual placement of
1796
components within it. It does not alter the positions of its
1797
child components. It assigns all child components their
1800
* hbox The *hbox* container lays out its children from left to
1801
right, giving each one its preferred width. The height of each
1802
child is set to the maximum of the preferred heights of all
1805
* vbox The *vbox* container lays out its children from top to
1806
bottom, giving each one its preferred height. The width of
1807
each child is set to the maximum of the preferred widths of all
1810
6.3.6 Common properties
1811
-----------------------
1813
The following properties are supported by all components:
1815
The distance from the left border of container to left border of
1816
the object in either of three formats:
1819
p%+x mixture of both
1822
The distance from the left border of container to left border of
1823
the object in same format.
1826
The width of object in same format.
1829
The height of object in same format.
1832
The identifier for the component. This can be any arbitrary
1833
string. The ID can be used by scripts to refer to various
1834
components in the GUI component tree. Currently, there is one
1835
special ID value that GRUB recognizes:
1837
"__timeout__" Any component with this ID will have its
1838
*text*, *start*, *end*, *value*, and *visible*
1839
properties set by GRUB when it is counting
1840
down to an automatic boot of the default menu
1844
File: grub.info, Node: Network, Next: Serial terminal, Prev: Theme file format, Up: Top
1846
7 Booting GRUB from the network
1847
*******************************
1849
The following instructions only work on PC BIOS systems where the
1850
Preboot eXecution Environment (PXE) is available.
1852
To generate a PXE boot image, run:
1854
grub-mkimage --format=i386-pc-pxe --output=grub.pxe --prefix='(pxe)/boot/grub' pxe pxecmd
1856
Copy `grub.pxe', `/boot/grub/*.mod', and `/boot/grub/*.lst' to the
1857
PXE (TFTP) server, ensuring that `*.mod' and `*.lst' are accessible via
1858
the `/boot/grub/' path from the TFTP server root. Set the DHCP server
1859
configuration to offer `grub.pxe' as the boot file (the `filename'
1860
option in ISC dhcpd).
1862
You can also use the `grub-mknetdir' utility to generate an image
1863
and a GRUB directory tree, rather than copying files around manually.
1865
After GRUB has started, files on the TFTP server will be accessible
1866
via the `(pxe)' device.
1868
The server and gateway IP address can be controlled by changing the
1869
`(pxe)' device name to `(pxe:SERVER-IP)' or
1870
`(pxe:SERVER-IP:GATEWAY-IP)'. Note that this should be changed both in
1871
the prefix and in any references to the device name in the
1874
GRUB provides several environment variables which may be used to
1875
inspect or change the behaviour of the PXE device:
1878
The IP address of this machine. Read-only.
1881
The network interface's MAC address. Read-only.
1884
The client host name provided by DHCP. Read-only.
1887
The client domain name provided by DHCP. Read-only.
1890
The path to the client's root disk provided by DHCP. Read-only.
1892
`net_pxe_extensionspath'
1893
The path to additional DHCP vendor extensions provided by DHCP.
1897
The boot file name provided by DHCP. Read-only.
1899
`net_pxe_dhcp_server_name'
1900
The name of the DHCP server responsible for these boot parameters.
1904
The PXE transfer block size. Read-write, defaults to 512.
1906
`pxe_default_server'
1907
The default PXE server. Read-write, although setting this is only
1908
useful before opening a PXE device.
1910
`pxe_default_gateway'
1911
The default gateway to use when contacting the PXE server.
1912
Read-write, although setting this is only useful before opening a
1916
File: grub.info, Node: Serial terminal, Next: Vendor power-on keys, Prev: Network, Up: Top
1918
8 Using GRUB via a serial line
1919
******************************
1921
This chapter describes how to use the serial terminal support in GRUB.
1923
If you have many computers or computers with no display/keyboard, it
1924
could be very useful to control the computers through serial
1925
communications. To connect one computer with another via a serial line,
1926
you need to prepare a null-modem (cross) serial cable, and you may need
1927
to have multiport serial boards, if your computer doesn't have extra
1928
serial ports. In addition, a terminal emulator is also required, such as
1929
minicom. Refer to a manual of your operating system, for more
1932
As for GRUB, the instruction to set up a serial terminal is quite
1933
simple. Here is an example:
1935
grub> serial --unit=0 --speed=9600
1936
grub> terminal_input serial; terminal_output serial
1938
The command `serial' initializes the serial unit 0 with the speed
1939
9600bps. The serial unit 0 is usually called `COM1', so, if you want to
1940
use COM2, you must specify `--unit=1' instead. This command accepts
1941
many other options, so please refer to *note serial::, for more details.
1943
The commands `terminal_input' (*note terminal_input::) and
1944
`terminal_output' (*note terminal_output::) choose which type of
1945
terminal you want to use. In the case above, the terminal will be a
1946
serial terminal, but you can also pass `console' to the command, as
1947
`terminal serial console'. In this case, a terminal in which you press
1948
any key will be selected as a GRUB terminal. In the example above, note
1949
that you need to put both commands on the same command line, as you
1950
will lose the ability to type commands on the console after the first
1953
However, note that GRUB assumes that your terminal emulator is
1954
compatible with VT100 by default. This is true for most terminal
1955
emulators nowadays, but you should pass the option `--dumb' to the
1956
command if your terminal emulator is not VT100-compatible or implements
1957
few VT100 escape sequences. If you specify this option then GRUB
1958
provides you with an alternative menu interface, because the normal
1959
menu requires several fancy features of your terminal.
1962
File: grub.info, Node: Vendor power-on keys, Next: Images, Prev: Serial terminal, Up: Top
1964
9 Using GRUB with vendor power-on keys
1965
**************************************
1967
Some laptop vendors provide an additional power-on button which boots
1968
another OS. GRUB supports such buttons with the `GRUB_TIMEOUT_BUTTON',
1969
`GRUB_DEFAULT_BUTTON', `GRUB_HIDDEN_TIMEOUT_BUTTON' and
1970
`GRUB_BUTTON_CMOS_ADDRESS' variables in default/grub (*note Simple
1971
configuration::). `GRUB_TIMEOUT_BUTTON', `GRUB_DEFAULT_BUTTON' and
1972
`GRUB_HIDDEN_TIMEOUT_BUTTON' are used instead of the corresponding
1973
variables without the `_BUTTON' suffix when powered on using the special
1974
button. `GRUB_BUTTON_CMOS_ADDRESS' is vendor-specific and partially
1975
model-specific. Values known to the GRUB team are:
1983
To take full advantage of this function, install GRUB into the MBR
1984
(*note Installing GRUB using grub-install::).
1987
File: grub.info, Node: Images, Next: Filesystem, Prev: Vendor power-on keys, Up: Top
1992
GRUB consists of several images: a variety of bootstrap images for
1993
starting GRUB in various ways, a kernel image, and a set of modules
1994
which are combined with the kernel image to form a core image. Here is
1995
a short overview of them.
1998
On PC BIOS systems, this image is the first part of GRUB to start.
1999
It is written to a master boot record (MBR) or to the boot sector
2000
of a partition. Because a PC boot sector is 512 bytes, the size
2001
of this image is exactly 512 bytes.
2003
The sole function of `boot.img' is to read the first sector of the
2004
core image from a local disk and jump to it. Because of the size
2005
restriction, `boot.img' cannot understand any file system
2006
structure, so `grub-setup' hardcodes the location of the first
2007
sector of the core image into `boot.img' when installing GRUB.
2010
This image is used as the first sector of the core image when
2011
booting from a hard disk. It reads the rest of the core image
2012
into memory and starts the kernel. Since file system handling is
2013
not yet available, it encodes the location of the core image using
2014
a block list format.
2017
This image is used as the first sector of the core image when
2018
booting from a CD-ROM drive. It performs a similar function to
2022
This image is used as the start of the core image when booting
2023
from the network using PXE. *Note Network::.
2026
This image may be placed at the start of the core image in order
2027
to make GRUB look enough like a Linux kernel that it can be booted
2028
by LILO using an `image=' section.
2031
This image contains GRUB's basic run-time facilities: frameworks
2032
for device and file handling, environment variables, the rescue
2033
mode command-line parser, and so on. It is rarely used directly,
2034
but is built into all core images.
2037
This is the core image of GRUB. It is built dynamically from the
2038
kernel image and an arbitrary list of modules by the `grub-mkimage'
2039
program. Usually, it contains enough modules to access
2040
`/boot/grub', and loads everything else (including menu handling,
2041
the ability to load target operating systems, and so on) from the
2042
file system at run-time. The modular design allows the core image
2043
to be kept small, since the areas of disk where it must be
2044
installed are often as small as 32KB.
2046
On PC systems using the traditional MBR partition table format,
2047
the core image is usually installed in the "MBR gap" between the
2048
master boot record and the first partition, or sometimes it is
2049
installed in a file system and read directly from that. The
2050
latter is not recommended because GRUB needs to encode the
2051
location of all the core image sectors in `diskboot.img', and if
2052
the file system ever moves the core image around (as it is entitled
2053
to do) then GRUB must be reinstalled; it also means that GRUB will
2054
not be able to reliably find the core image if it resides on a
2055
different disk than the one to which `boot.img' was installed.
2057
On PC systems using the more recent GUID Partition Table (GPT)
2058
format, the core image should be installed to a BIOS Boot
2059
Partition. This may be created by GNU Parted using a command such
2062
# parted /dev/DISK set PARTITION-NUMBER bios_grub on
2064
*Caution:* Be very careful which partition you select! When GRUB
2065
finds a BIOS Boot Partition during installation, it will
2066
automatically overwrite part of it. Make sure that the partition
2067
does not contain any other data.
2070
Everything else in GRUB resides in dynamically loadable modules.
2071
These are often loaded automatically, or built into the core image
2072
if they are essential, but may also be loaded manually using the
2073
`insmod' command (*note insmod::).
2075
For GRUB Legacy users
2076
=====================
2078
GRUB 2 has a different design from GRUB Legacy, and so correspondences
2079
with the images it used cannot be exact. Nevertheless, GRUB Legacy
2080
users often ask questions in the terms they are familiar with, and so
2081
here is a brief guide to how GRUB 2's images relate to that.
2084
Stage 1 from GRUB Legacy was very similar to `boot.img' in GRUB 2,
2085
and they serve the same function.
2088
In GRUB Legacy, Stage 1.5's function was to include enough
2089
filesystem code to allow the much larger Stage 2 to be read from
2090
an ordinary filesystem. In this respect, its function was similar
2091
to `core.img' in GRUB 2. However, `core.img' is much more capable
2092
than Stage 1.5 was; since it offers a rescue shell, it is
2093
sometimes possible to recover manually in the event that it is
2094
unable to load any other modules, for example if partition numbers
2095
have changed. `core.img' is built in a more flexible way,
2096
allowing GRUB 2 to support reading modules from advanced disk
2097
types such as LVM and RAID.
2099
GRUB Legacy could run with only Stage 1 and Stage 2 in some limited
2100
configurations, while GRUB 2 requires `core.img' and cannot work
2104
GRUB 2 has no single Stage 2 image. Instead, it loads modules from
2105
`/boot/grub' at run-time.
2108
In GRUB 2, images for booting from CD-ROM drives are now
2109
constructed using `cdboot.img' and `core.img', making sure that
2110
the core image contains the `iso9660' module. It is usually best
2111
to use the `grub-mkrescue' program for this.
2114
There is as yet no equivalent for `nbgrub' in GRUB 2; it was used
2115
by Etherboot and some other network boot loaders.
2118
In GRUB 2, images for PXE network booting are now constructed using
2119
`pxeboot.img' and `core.img', making sure that the core image
2120
contains the `pxe' and `pxecmd' modules. *Note Network::.
2123
File: grub.info, Node: Filesystem, Next: Interface, Prev: Images, Up: Top
2125
11 Filesystem syntax and semantics
2126
**********************************
2128
GRUB uses a special syntax for specifying disk drives which can be
2129
accessed by BIOS. Because of BIOS limitations, GRUB cannot distinguish
2130
between IDE, ESDI, SCSI, or others. You must know yourself which BIOS
2131
device is equivalent to which OS device. Normally, that will be clear if
2132
you see the files in a device or use the command `search' (*note
2137
* Device syntax:: How to specify devices
2138
* File name syntax:: How to specify files
2139
* Block list syntax:: How to specify block lists
2142
File: grub.info, Node: Device syntax, Next: File name syntax, Up: Filesystem
2144
11.1 How to specify devices
2145
===========================
2147
The device syntax is like this:
2149
`(DEVICE[,PART-NUM][,BSD-SUBPART-LETTER])'
2151
`[]' means the parameter is optional. DEVICE should be either `fd'
2152
or `hd' followed by a digit, like `fd0'. But you can also set DEVICE
2153
to a hexadecimal or a decimal number which is a BIOS drive number, so
2154
the following are equivalent:
2160
PART-NUM represents the partition number of DEVICE, starting from
2161
one for primary partitions and from five for extended partitions, and
2162
BSD-SUBPART-LETTER represents the BSD disklabel subpartition, such as
2165
A shortcut for specifying BSD subpartitions is
2166
`(DEVICE,BSD-SUBPART-LETTER)', in this case, GRUB searches for the
2167
first PC partition containing a BSD disklabel, then finds the
2168
subpartition BSD-SUBPART-LETTER. Here is an example:
2172
The syntax `(hd0)' represents using the entire disk (or the MBR when
2173
installing GRUB), while the syntax `(hd0,1)' represents using the first
2174
partition of the disk (or the boot sector of the partition when
2177
If you enabled the network support, the special drive `(pxe)' is
2178
also available. Before using the network drive, you must initialize the
2179
network. *Note Network::, for more information.
2181
If you boot GRUB from a CD-ROM, `(cd)' is available. *Note Making a
2182
GRUB bootable CD-ROM::, for details.
2185
File: grub.info, Node: File name syntax, Next: Block list syntax, Prev: Device syntax, Up: Filesystem
2187
11.2 How to specify files
2188
=========================
2190
There are two ways to specify files, by "absolute file name" and by
2193
An absolute file name resembles a Unix absolute file name, using `/'
2194
for the directory separator (not `\' as in DOS). One example is
2195
`(hd0,1)/boot/grub/grub.cfg'. This means the file `/boot/grub/grub.cfg'
2196
in the first partition of the first hard disk. If you omit the device
2197
name in an absolute file name, GRUB uses GRUB's "root device"
2198
implicitly. So if you set the root device to, say, `(hd1,1)' by the
2199
command `set root=(hd1,1)' (*note set::), then `/boot/kernel' is the
2200
same as `(hd1,1)/boot/kernel'.
2203
File: grub.info, Node: Block list syntax, Prev: File name syntax, Up: Filesystem
2205
11.3 How to specify block lists
2206
===============================
2208
A block list is used for specifying a file that doesn't appear in the
2209
filesystem, like a chainloader. The syntax is
2210
`[OFFSET]+LENGTH[,[OFFSET]+LENGTH]...'. Here is an example:
2212
`0+100,200+1,300+300'
2214
This represents that GRUB should read blocks 0 through 99, block 200,
2215
and blocks 300 through 599. If you omit an offset, then GRUB assumes
2218
Like the file name syntax (*note File name syntax::), if a blocklist
2219
does not contain a device name, then GRUB uses GRUB's "root device". So
2220
`(hd0,2)+1' is the same as `+1' when the root device is `(hd0,2)'.
2223
File: grub.info, Node: Interface, Next: Commands, Prev: Filesystem, Up: Top
2225
12 GRUB's user interface
2226
************************
2228
GRUB has both a simple menu interface for choosing preset entries from a
2229
configuration file, and a highly flexible command-line for performing
2230
any desired combination of boot commands.
2232
GRUB looks for its configuration file as soon as it is loaded. If one
2233
is found, then the full menu interface is activated using whatever
2234
entries were found in the file. If you choose the "command-line" menu
2235
option, or if the configuration file was not found, then GRUB drops to
2236
the command-line interface.
2240
* Command-line interface:: The flexible command-line interface
2241
* Menu interface:: The simple menu interface
2242
* Menu entry editor:: Editing a menu entry
2245
File: grub.info, Node: Command-line interface, Next: Menu interface, Up: Interface
2247
12.1 The flexible command-line interface
2248
========================================
2250
The command-line interface provides a prompt and after it an editable
2251
text area much like a command-line in Unix or DOS. Each command is
2252
immediately executed after it is entered(1) (*note Command-line
2253
interface-Footnote-1::). The commands (*note Command-line and menu
2254
entry commands::) are a subset of those available in the configuration
2255
file, used with exactly the same syntax.
2257
Cursor movement and editing of the text on the line can be done via a
2258
subset of the functions available in the Bash shell:
2262
Move forward one character.
2266
Move back one character.
2270
Move to the start of the line.
2274
Move the the end of the line.
2278
Delete the character underneath the cursor.
2282
Delete the character to the left of the cursor.
2285
Kill the text from the current cursor position to the end of the
2289
Kill backward from the cursor to the beginning of the line.
2292
Yank the killed text back into the buffer at the cursor.
2296
Move up through the history list.
2300
Move down through the history list.
2302
When typing commands interactively, if the cursor is within or before
2303
the first word in the command-line, pressing the <TAB> key (or <C-i>)
2304
will display a listing of the available commands, and if the cursor is
2305
after the first word, the `<TAB>' will provide a completion listing of
2306
disks, partitions, and file names depending on the context. Note that
2307
to obtain a list of drives, one must open a parenthesis, as `root ('.
2309
Note that you cannot use the completion functionality in the TFTP
2310
filesystem. This is because TFTP doesn't support file name listing for
2314
File: grub.info, Node: Command-line interface-Footnotes, Up: Command-line interface
2316
(1) However, this behavior will be changed in the future version, in
2317
a user-invisible way.
2320
File: grub.info, Node: Menu interface, Next: Menu entry editor, Prev: Command-line interface, Up: Interface
2322
12.2 The simple menu interface
2323
==============================
2325
The menu interface is quite easy to use. Its commands are both
2326
reasonably intuitive and described on screen.
2328
Basically, the menu interface provides a list of "boot entries" to
2329
the user to choose from. Use the arrow keys to select the entry of
2330
choice, then press <RET> to run it. An optional timeout is available
2331
to boot the default entry (the first one if not set), which is aborted
2332
by pressing any key.
2334
Commands are available to enter a bare command-line by pressing <c>
2335
(which operates exactly like the non-config-file version of GRUB, but
2336
allows one to return to the menu if desired by pressing <ESC>) or to
2337
edit any of the "boot entries" by pressing <e>.
2339
If you protect the menu interface with a password (*note Security::),
2340
all you can do is choose an entry by pressing <RET>, or press <p> to
2344
File: grub.info, Node: Menu entry editor, Prev: Menu interface, Up: Interface
2346
12.3 Editing a menu entry
2347
=========================
2349
The menu entry editor looks much like the main menu interface, but the
2350
lines in the menu are individual commands in the selected entry instead
2353
If an <ESC> is pressed in the editor, it aborts all the changes made
2354
to the configuration entry and returns to the main menu interface.
2356
Each line in the menu entry can be edited freely, and you can add
2357
new lines by pressing <RET> at the end of a line. To boot the edited
2358
entry, press <Ctrl-x>.
2360
Although GRUB unfortunately does not support "undo", you can do
2361
almost the same thing by just returning to the main menu using <ESC>.
2364
File: grub.info, Node: Commands, Next: Security, Prev: Interface, Up: Top
2366
13 The list of available commands
2367
*********************************
2369
In this chapter, we list all commands that are available in GRUB.
2371
Commands belong to different groups. A few can only be used in the
2372
global section of the configuration file (or "menu"); most of them can
2373
be entered on the command-line and can be used either anywhere in the
2374
menu or specifically in the menu entries.
2376
In rescue mode, only the `insmod' (*note insmod::), `ls' (*note
2377
ls::), `set' (*note set::), and `unset' (*note unset::) commands are
2382
* Menu-specific commands::
2383
* General commands::
2384
* Command-line and menu entry commands::
2387
File: grub.info, Node: Menu-specific commands, Next: General commands, Up: Commands
2389
13.1 The list of commands for the menu only
2390
===========================================
2392
The semantics used in parsing the configuration file are the following:
2394
* The menu-specific commands have to be used before any others.
2396
* The files _must_ be in plain-text format.
2398
* `#' at the beginning of a line in a configuration file means it is
2401
* Options are separated by spaces.
2403
* All numbers can be either decimal or hexadecimal. A hexadecimal
2404
number must be preceded by `0x', and is case-insensitive.
2406
* Extra options or text at the end of the line are ignored unless
2407
otherwise specified.
2409
* Unrecognized commands are added to the current entry, except
2410
before entries start, where they are ignored.
2412
These commands can only be used in the menu:
2416
* menuentry:: Start a menu entry
2419
File: grub.info, Node: menuentry, Up: Menu-specific commands
2424
-- Command: menuentry TITLE [`--class=class' ...] [`--users=users']
2425
[`--hotkey=key'] { COMMAND; ... }
2426
This defines a GRUB menu entry named TITLE. When this entry is
2427
selected from the menu, GRUB will set the CHOSEN environment
2428
variable to TITLE, execute the list of commands given within
2429
braces, and if the last command in the list returned successfully
2430
and a kernel was loaded it will execute the `boot' command.
2432
The `--class' option may be used any number of times to group menu
2433
entries into classes. Menu themes may display different classes
2434
using different styles.
2436
The `--users' option grants specific users access to specific menu
2437
entries. *Note Security::.
2439
The `--hotkey' option associates a hotkey with a menu entry. KEY
2440
may be a single letter, or one of the aliases `backspace', `tab',
2444
File: grub.info, Node: General commands, Next: Command-line and menu entry commands, Prev: Menu-specific commands, Up: Commands
2446
13.2 The list of general commands
2447
=================================
2449
Commands usable anywhere in the menu and in the command-line.
2453
* serial:: Set up a serial device
2454
* terminal_input:: Manage input terminals
2455
* terminal_output:: Manage output terminals
2456
* terminfo:: Define terminal type
2459
File: grub.info, Node: serial, Next: terminal_input, Up: General commands
2464
-- Command: serial [`--unit=unit'] [`--port=port'] [`--speed=speed']
2465
[`--word=word'] [`--parity=parity'] [`--stop=stop']
2466
Initialize a serial device. UNIT is a number in the range 0-3
2467
specifying which serial port to use; default is 0, which
2468
corresponds to the port often called COM1. PORT is the I/O port
2469
where the UART is to be found; if specified it takes precedence
2470
over UNIT. SPEED is the transmission speed; default is 9600. WORD
2471
and STOP are the number of data bits and stop bits. Data bits must
2472
be in the range 5-8 and stop bits must be 1 or 2. Default is 8 data
2473
bits and one stop bit. PARITY is one of `no', `odd', `even' and
2476
The serial port is not used as a communication channel unless the
2477
`terminal_input' or `terminal_output' command is used (*note
2478
terminal_input::, *note terminal_output::).
2480
See also *note Serial terminal::.
2483
File: grub.info, Node: terminal_input, Next: terminal_output, Prev: serial, Up: General commands
2485
13.2.2 terminal_input
2486
---------------------
2488
-- Command: terminal_input [`--append'|`--remove'] [terminal1]
2490
List or select an input terminal.
2492
With no arguments, list the active and available input terminals.
2494
With `--append', add the named terminals to the list of active
2495
input terminals; any of these may be used to provide input to GRUB.
2497
With `--remove', remove the named terminals from the active list.
2499
With no options but a list of terminal names, make only the listed
2500
terminal names active.
2503
File: grub.info, Node: terminal_output, Next: terminfo, Prev: terminal_input, Up: General commands
2505
13.2.3 terminal_output
2506
----------------------
2508
-- Command: terminal_output [`--append'|`--remove'] [terminal1]
2510
List or select an output terminal.
2512
With no arguments, list the active and available output terminals.
2514
With `--append', add the named terminals to the list of active
2515
output terminals; all of these will receive output from GRUB.
2517
With `--remove', remove the named terminals from the active list.
2519
With no options but a list of terminal names, make only the listed
2520
terminal names active.
2523
File: grub.info, Node: terminfo, Prev: terminal_output, Up: General commands
2528
-- Command: terminfo [-a|-u|-v] [term]
2529
Define the capabilities of your terminal by giving the name of an
2530
entry in the terminfo database, which should correspond roughly to
2531
a `TERM' environment variable in Unix.
2533
The currently available terminal types are `vt100', `vt100-color',
2534
`ieee1275', and `dumb'. If you need other terminal types, please
2535
contact us to discuss the best way to include support for these in
2538
The `-a' (`--ascii'), `-u' (`--utf8'), and `-v' (`--visual-utf8')
2539
options control how non-ASCII text is displayed. `-a' specifies
2540
an ASCII-only terminal; `-u' specifies logically-ordered UTF-8;
2541
and `-v' specifies "visually-ordered UTF-8" (in other words,
2542
arranged such that a terminal emulator without bidirectional text
2543
support will display right-to-left text in the proper order; this
2544
is not really proper UTF-8, but a workaround).
2546
If no option or terminal type is specified, the current terminal
2550
File: grub.info, Node: Command-line and menu entry commands, Prev: General commands, Up: Commands
2552
13.3 The list of command-line and menu entry commands
2553
=====================================================
2555
These commands are usable in the command-line and in menu entries. If
2556
you forget a command, you can run the command `help' (*note help::).
2560
* acpi:: Load ACPI tables
2561
* badram:: Filter out bad regions of RAM
2562
* blocklist:: Print a block list
2563
* boot:: Start up your operating system
2564
* cat:: Show the contents of a file
2565
* chainloader:: Chain-load another boot loader
2566
* cmp:: Compare two files
2567
* configfile:: Load a configuration file
2568
* cpuid:: Check for CPU features
2569
* crc:: Calculate CRC32 checksums
2570
* date:: Display or set current date and time
2571
* drivemap:: Map a drive to another
2572
* echo:: Display a line of text
2573
* export:: Export an environment variable
2574
* gettext:: Translate a string
2575
* gptsync:: Fill an MBR based on GPT entries
2576
* halt:: Shut down your computer
2577
* help:: Show help messages
2578
* initrd:: Load a Linux initrd
2579
* initrd16:: Load a Linux initrd (16-bit mode)
2580
* insmod:: Insert a module
2581
* keystatus:: Check key modifier status
2582
* linux:: Load a Linux kernel
2583
* linux16:: Load a Linux kernel (16-bit mode)
2584
* ls:: List devices or files
2585
* parttool:: Modify partition table entries
2586
* password:: Set a clear-text password
2587
* password_pbkdf2:: Set a hashed password
2588
* play:: Play a tune
2589
* pxe_unload:: Unload the PXE environment
2590
* reboot:: Reboot your computer
2591
* search:: Search devices by file, label, or UUID
2592
* sendkey:: Emulate keystrokes
2593
* set:: Set an environment variable
2594
* unset:: Unset an environment variable
2595
* uppermem:: Set the upper memory size
2598
File: grub.info, Node: acpi, Next: badram, Up: Command-line and menu entry commands
2603
-- Command: acpi [`-1'|`-2']
2604
[`--exclude=table1,...'|`--load-only=table1,...']
2605
[`--oemid=id'] [`--oemtable=table'] [`--oemtablerev=rev']
2606
[`--oemtablecreator=creator'] [`--oemtablecreatorrev=rev']
2607
[`--no-ebda'] filename ...
2608
Modern BIOS systems normally implement the Advanced Configuration
2609
and Power Interface (ACPI), and define various tables that
2610
describe the interface between an ACPI-compliant operating system
2611
and the firmware. In some cases, the tables provided by default
2612
only work well with certain operating systems, and it may be
2613
necessary to replace some of them.
2615
Normally, this command will replace the Root System Description
2616
Pointer (RSDP) in the Extended BIOS Data Area to point to the new
2617
tables. If the `--no-ebda' option is used, the new tables will be
2618
known only to GRUB, but may be used by GRUB's EFI emulation.
2621
File: grub.info, Node: badram, Next: blocklist, Prev: acpi, Up: Command-line and menu entry commands
2626
-- Command: badram addr,mask[,addr,mask...]
2629
This command notifies the memory manager that specified regions of
2630
RAM ought to be filtered out (usually, because they're damaged). This
2631
remains in effect after a payload kernel has been loaded by GRUB, as
2632
long as the loaded kernel obtains its memory map from GRUB. Kernels
2633
that support this include Linux, GNU Mach, the kernel of FreeBSD and
2634
Multiboot kernels in general.
2636
Syntax is the same as provided by the Memtest86+ utility
2637
(http://www.memtest.org/): a list of address/mask pairs. Given a
2638
page-aligned address and a base address / mask pair, if all the bits of
2639
the page-aligned address that are enabled by the mask match with the
2640
base address, it means this page is to be filtered. This syntax makes
2641
it easy to represent patterns that are often result of memory damage,
2642
due to physical distribution of memory cells.
2645
File: grub.info, Node: blocklist, Next: boot, Prev: badram, Up: Command-line and menu entry commands
2650
-- Command: blocklist file
2651
Print a block list (*note Block list syntax::) for FILE.
2654
File: grub.info, Node: boot, Next: cat, Prev: blocklist, Up: Command-line and menu entry commands
2660
Boot the OS or chain-loader which has been loaded. Only necessary
2661
if running the fully interactive command-line (it is implicit at
2662
the end of a menu entry).
2665
File: grub.info, Node: cat, Next: chainloader, Prev: boot, Up: Command-line and menu entry commands
2670
-- Command: cat [`--dos'] file
2671
Display the contents of the file FILE. This command may be useful
2672
to remind you of your OS's root partition:
2674
grub> cat /etc/fstab
2676
If the `--dos' option is used, then carriage return / new line
2677
pairs will be displayed as a simple new line. Otherwise, the
2678
carriage return will be displayed as a control character (`<d>')
2679
to make it easier to see when boot problems are caused by a file
2680
formatted using DOS-style line endings.
2683
File: grub.info, Node: chainloader, Next: cmp, Prev: cat, Up: Command-line and menu entry commands
2688
-- Command: chainloader [`--force'] file
2689
Load FILE as a chain-loader. Like any other file loaded by the
2690
filesystem code, it can use the blocklist notation (*note Block
2691
list syntax::) to grab the first sector of the current partition
2692
with `+1'. If you specify the option `--force', then load FILE
2693
forcibly, whether it has a correct signature or not. This is
2694
required when you want to load a defective boot loader, such as
2698
File: grub.info, Node: cmp, Next: configfile, Prev: chainloader, Up: Command-line and menu entry commands
2703
-- Command: cmp file1 file2
2704
Compare the file FILE1 with the file FILE2. If they differ in
2705
size, print the sizes like this:
2707
Differ in size: 0x1234 [foo], 0x4321 [bar]
2709
If the sizes are equal but the bytes at an offset differ, then
2710
print the bytes like this:
2712
Differ at the offset 777: 0xbe [foo], 0xef [bar]
2714
If they are completely identical, nothing will be printed.
2717
File: grub.info, Node: configfile, Next: cpuid, Prev: cmp, Up: Command-line and menu entry commands
2722
-- Command: configfile file
2723
Load FILE as a configuration file. If FILE defines any menu
2724
entries, then show a menu containing them immediately.
2727
File: grub.info, Node: cpuid, Next: crc, Prev: configfile, Up: Command-line and menu entry commands
2732
-- Command: cpuid [-l]
2733
Check for CPU features. This command is only available on x86
2736
With the `-l' option, return true if the CPU supports long mode
2739
If invoked without options, this command currently behaves as if
2740
it had been invoked with `-l'. This may change in the future.
2743
File: grub.info, Node: crc, Next: date, Prev: cpuid, Up: Command-line and menu entry commands
2748
-- Command: crc file
2749
Display the CRC32 checksum of FILE.
2752
File: grub.info, Node: date, Next: drivemap, Prev: crc, Up: Command-line and menu entry commands
2757
-- Command: date [[year-]month-day] [hour:minute[:second]]
2758
With no arguments, print the current date and time.
2760
Otherwise, take the current date and time, change any elements
2761
specified as arguments, and set the result as the new date and
2762
time. For example, `date 01-01' will set the current month and
2763
day to January 1, but leave the year, hour, minute, and second
2767
File: grub.info, Node: drivemap, Next: echo, Prev: date, Up: Command-line and menu entry commands
2772
-- Command: drivemap `-l'|`-r'|[`-s'] from_drive to_drive
2773
Without options, map the drive FROM_DRIVE to the drive TO_DRIVE.
2774
This is necessary when you chain-load some operating systems, such
2775
as DOS, if such an OS resides at a non-first drive. For
2776
convenience, any partition suffix on the drive is ignored, so you
2777
can safely use ${root} as a drive specification.
2779
With the `-s' option, perform the reverse mapping as well, swapping
2782
With the `-l' option, list the current mappings.
2784
With the `-r' option, reset all mappings to the default values.
2788
drivemap -s (hd0) (hd1)
2791
File: grub.info, Node: echo, Next: export, Prev: drivemap, Up: Command-line and menu entry commands
2796
-- Command: echo [`-n'] [`-e'] string ...
2797
Display the requested text and, unless the `-n' option is used, a
2798
trailing new line. If there is more than one string, they are
2799
separated by spaces in the output. As usual in GRUB commands,
2800
variables may be substituted using `${var}'.
2802
The `-e' option enables interpretation of backslash escapes. The
2803
following sequences are recognised:
2812
suppress trailing new line
2829
When interpreting backslash escapes, backslash followed by any
2830
other character will print that character.
2833
File: grub.info, Node: export, Next: gettext, Prev: echo, Up: Command-line and menu entry commands
2838
-- Command: export envvar
2839
Export the environment variable ENVVAR. Exported variables are
2840
visible to subsidiary configuration files loaded using
2844
File: grub.info, Node: gettext, Next: gptsync, Prev: export, Up: Command-line and menu entry commands
2849
-- Command: gettext string
2850
Translate STRING into the current language.
2852
The current language code is stored in the `lang' variable in
2853
GRUB's environment. Translation files in MO format are read from
2854
`locale_dir', usually `/boot/grub/locale'.
2857
File: grub.info, Node: gptsync, Next: halt, Prev: gettext, Up: Command-line and menu entry commands
2862
-- Command: gptsync device [partition[+/-[type]]] ...
2863
Disks using the GUID Partition Table (GPT) also have a legacy
2864
Master Boot Record (MBR) partition table for compatibility with
2865
the BIOS and with older operating systems. The legacy MBR can
2866
only represent a limited subset of GPT partition entries.
2868
This command populates the legacy MBR with the specified PARTITION
2869
entries on DEVICE. Up to three partitions may be used.
2871
TYPE is an MBR partition type code; prefix with `0x' if you want
2872
to enter this in hexadecimal. The separator between PARTITION and
2873
TYPE may be `+' to make the partition active, or `-' to make it
2874
inactive; only one partition may be active. If both the separator
2875
and type are omitted, then the partition will be inactive.
2878
File: grub.info, Node: halt, Next: help, Prev: gptsync, Up: Command-line and menu entry commands
2883
-- Command: halt `--no-apm'
2884
The command halts the computer. If the `--no-apm' option is
2885
specified, no APM BIOS call is performed. Otherwise, the computer
2886
is shut down using APM.
2889
File: grub.info, Node: help, Next: initrd, Prev: halt, Up: Command-line and menu entry commands
2894
-- Command: help [pattern ...]
2895
Display helpful information about builtin commands. If you do not
2896
specify PATTERN, this command shows short descriptions of all
2899
If you specify any PATTERNS, it displays longer information about
2900
each of the commands whose names begin with those PATTERNS.
2903
File: grub.info, Node: initrd, Next: initrd16, Prev: help, Up: Command-line and menu entry commands
2908
-- Command: initrd file
2909
Load an initial ramdisk for a Linux kernel image, and set the
2910
appropriate parameters in the Linux setup area in memory. This
2911
may only be used after the `linux' command (*note linux::) has
2912
been run. See also *note GNU/Linux::.
2915
File: grub.info, Node: initrd16, Next: insmod, Prev: initrd, Up: Command-line and menu entry commands
2920
-- Command: initrd16 file
2921
Load an initial ramdisk for a Linux kernel image to be booted in
2922
16-bit mode, and set the appropriate parameters in the Linux setup
2923
area in memory. This may only be used after the `linux16' command
2924
(*note linux16::) has been run. See also *note GNU/Linux::.
2926
This command is only available on x86 systems.
2929
File: grub.info, Node: insmod, Next: keystatus, Prev: initrd16, Up: Command-line and menu entry commands
2934
-- Command: insmod module
2935
Insert the dynamic GRUB module called MODULE.
2938
File: grub.info, Node: keystatus, Next: linux, Prev: insmod, Up: Command-line and menu entry commands
2943
-- Command: keystatus [`--shift'] [`--ctrl'] [`--alt']
2944
Return true if the Shift, Control, or Alt modifier keys are held
2945
down, as requested by options. This is useful in scripting, to
2946
allow some user control over behaviour without having to wait for
2949
Checking key modifier status is only supported on some platforms.
2950
If invoked without any options, the `keystatus' command returns
2951
true if and only if checking key modifier status is supported.
2954
File: grub.info, Node: linux, Next: linux16, Prev: keystatus, Up: Command-line and menu entry commands
2959
-- Command: linux file ...
2960
Load a Linux kernel image from FILE. The rest of the line is
2961
passed verbatim as the "kernel command-line". Any initrd must be
2962
reloaded after using this command (*note initrd::).
2964
On x86 systems, the kernel will be booted using the 32-bit boot
2965
protocol. Note that this means that the `vga=' boot option will
2966
not work; if you want to set a special video mode, you will need
2967
to use GRUB commands such as `set gfxpayload=1024x768' or `set
2968
gfxpayload=keep' (to keep the same mode as used in GRUB) instead.
2969
GRUB can automatically detect some uses of `vga=' and translate
2970
them to appropriate settings of `gfxpayload'. The `linux16'
2971
command (*note linux16::) avoids this restriction.
2974
File: grub.info, Node: linux16, Next: ls, Prev: linux, Up: Command-line and menu entry commands
2979
-- Command: linux16 file ...
2980
Load a Linux kernel image from FILE in 16-bit mode. The rest of
2981
the line is passed verbatim as the "kernel command-line". Any
2982
initrd must be reloaded after using this command (*note
2985
The kernel will be booted using the traditional 16-bit boot
2986
protocol. As well as bypassing problems with `vga=' described in
2987
*note linux::, this permits booting some other programs that
2988
implement the Linux boot protocol for the sake of convenience.
2990
This command is only available on x86 systems.
2993
File: grub.info, Node: ls, Next: parttool, Prev: linux16, Up: Command-line and menu entry commands
2998
-- Command: ls [arg ...]
2999
List devices or files.
3001
With no arguments, print all devices known to GRUB.
3003
If the argument is a device name enclosed in parentheses (*note
3004
Device syntax::), then list all files at the root directory of
3007
If the argument is a directory given as an absolute file name
3008
(*note File name syntax::), then list the contents of that
3012
File: grub.info, Node: parttool, Next: password, Prev: ls, Up: Command-line and menu entry commands
3017
-- Command: parttool partition commands
3018
Make various modifications to partition table entries.
3020
Each COMMAND is either a boolean option, in which case it must be
3021
followed with `+' or `-' (with no intervening space) to enable or
3022
disable that option, or else it takes a value in the form
3025
Currently, `parttool' is only useful on DOS partition tables (also
3026
known as Master Boot Record, or MBR). On these partition tables,
3027
the following commands are available:
3030
When enabled, this makes the selected partition be the active
3031
(bootable) partition on its disk, clearing the active flag on
3032
all other partitions. This command is limited to _primary_
3036
Change the type of an existing partition. The value must be
3037
a number in the range 0-0xFF (prefix with `0x' to enter it in
3041
When enabled, this hides the selected partition by setting
3042
the "hidden" bit in its partition type code; when disabled,
3043
unhides the selected partition by clearing this bit. This is
3044
useful only when booting DOS or Wwindows and multiple primary
3045
FAT partitions exist in one disk. See also *note
3049
File: grub.info, Node: password, Next: password_pbkdf2, Prev: parttool, Up: Command-line and menu entry commands
3054
-- Command: password user clear-password
3055
Define a user named USER with password CLEAR-PASSWORD. *Note
3059
File: grub.info, Node: password_pbkdf2, Next: play, Prev: password, Up: Command-line and menu entry commands
3061
13.3.28 password_pbkdf2
3062
-----------------------
3064
-- Command: password_pbkdf2 user hashed-password
3065
Define a user named USER with password hash HASHED-PASSWORD. Use
3066
`grub-mkpasswd-pbkdf2' (*note Invoking grub-mkpasswd-pbkdf2::) to
3067
generate password hashes. *Note Security::.
3070
File: grub.info, Node: play, Next: pxe_unload, Prev: password_pbkdf2, Up: Command-line and menu entry commands
3075
-- Command: play file | tempo [pitch1 duration1] [pitch2 duration2] ...
3078
If the argument is a file name (*note File name syntax::), play
3079
the tune recorded in it. The file format is first the tempo as an
3080
unsigned 32bit little-endian number, then pairs of unsigned 16bit
3081
little-endian numbers for pitch and duration pairs.
3083
If the arguments are a series of numbers, play the inline tune.
3085
The tempo is the base for all note durations. 60 gives a 1-second
3086
base, 120 gives a half-second base, etc. Pitches are Hz. Set
3087
pitch to 0 to produce a rest.
3090
File: grub.info, Node: pxe_unload, Next: reboot, Prev: play, Up: Command-line and menu entry commands
3095
-- Command: pxe_unload
3096
Unload the PXE environment (*note Network::).
3098
This command is only available on PC BIOS systems.
3101
File: grub.info, Node: reboot, Next: search, Prev: pxe_unload, Up: Command-line and menu entry commands
3107
Reboot the computer.
3110
File: grub.info, Node: search, Next: sendkey, Prev: reboot, Up: Command-line and menu entry commands
3115
-- Command: search [`--file'|`--label'|`--fs-uuid'] [`--set' [var]]
3116
[`--no-floppy'] name
3117
Search devices by file (`-f', `--file'), filesystem label (`-l',
3118
`--label'), or filesystem UUID (`-u', `--fs-uuid').
3120
If the `--set' option is used, the first device found is set as the
3121
value of environment variable VAR. The default variable is `root'.
3123
The `--no-floppy' option prevents searching floppy devices, which
3126
The `search.file', `search.fs_label', and `search.fs_uuid'
3127
commands are aliases for `search --file', `search --label', and
3128
`search --fs-uuid' respectively.
3131
File: grub.info, Node: sendkey, Next: set, Prev: search, Up: Command-line and menu entry commands
3136
-- Command: sendkey [`--num'|`--caps'|`--scroll'|`--insert'|
3137
`--pause'|`--left-shift'|`--right-shift'|
3138
`--sysrq'|`--numkey'|`--capskey'|`--scrollkey'|
3139
`--insertkey'|`--left-alt'|`--right-alt'|
3140
`--left-ctrl'|`--right-ctrl' `on'|`off']... [`no-led']
3142
Insert keystrokes into the keyboard buffer when booting.
3143
Sometimes an operating system or chainloaded boot loader requires
3144
particular keys to be pressed: for example, one might need to
3145
press a particular key to enter "safe mode", or when chainloading
3146
another boot loader one might send keystrokes to it to navigate
3149
You may provide up to 16 keystrokes (the length of the BIOS
3150
keyboard buffer). Keystroke names may be upper-case or lower-case
3151
letters, digits, or taken from the following table:
3154
---------------------------------------------------------------
3177
control press and release Control
3184
shift press and release left Shift
3193
rshift press and release right Shift
3194
alt press and release Alt
3209
num1 1 (numeric keypad)
3210
num2 2 (numeric keypad)
3211
num3 3 (numeric keypad)
3212
num4 4 (numeric keypad)
3213
num5 5 (numeric keypad)
3214
num6 6 (numeric keypad)
3215
num7 7 (numeric keypad)
3216
num8 8 (numeric keypad)
3217
num9 9 (numeric keypad)
3218
num0 0 (numeric keypad)
3219
numperiod . (numeric keypad)
3220
numend End (numeric keypad)
3221
numdown Down (numeric keypad)
3222
numpgdown Page Down (numeric keypad)
3223
numleft Left (numeric keypad)
3224
numcenter 5 with Num Lock inactive (numeric
3226
numright Right (numeric keypad)
3227
numhome Home (numeric keypad)
3228
numup Up (numeric keypad)
3229
numpgup Page Up (numeric keypad)
3230
numinsert Insert (numeric keypad)
3231
numdelete Delete (numeric keypad)
3232
numasterisk * (numeric keypad)
3233
numminus - (numeric keypad)
3234
numplus + (numeric keypad)
3235
numslash / (numeric keypad)
3236
numenter Enter (numeric keypad)
3248
As well as keystrokes, the `sendkey' command takes various options
3249
that affect the BIOS keyboard status flags. These options take an
3250
`on' or `off' parameter, specifying that the corresponding status
3251
flag be set or unset; omitting the option for a given status flag
3252
will leave that flag at its initial state at boot. The `--num',
3253
`--caps', `--scroll', and `--insert' options emulate setting the
3254
corresponding mode, while the `--numkey', `--capskey',
3255
`--scrollkey', and `--insertkey' options emulate pressing and
3256
holding the corresponding key. The other status flag options are
3259
If the `--no-led' option is given, the status flag options will
3260
have no effect on keyboard LEDs.
3262
If the `sendkey' command is given multiple times, then only the
3263
last invocation has any effect.
3265
Since `sendkey' manipulates the BIOS keyboard buffer, it may cause
3266
hangs, reboots, or other misbehaviour on some systems. If the
3267
operating system or boot loader that runs after GRUB uses its own
3268
keyboard driver rather than the BIOS keyboard functions, then
3269
`sendkey' will have no effect.
3271
This command is only available on PC BIOS systems.
3274
File: grub.info, Node: set, Next: unset, Prev: sendkey, Up: Command-line and menu entry commands
3279
-- Command: set [envvar=value]
3280
Set the environment variable ENVVAR to VALUE. If invoked with no
3281
arguments, print all environment variables with their values.
3284
File: grub.info, Node: unset, Next: uppermem, Prev: set, Up: Command-line and menu entry commands
3289
-- Command: unset envvar
3290
Unset the environment variable ENVVAR.
3293
File: grub.info, Node: uppermem, Prev: unset, Up: Command-line and menu entry commands
3298
This command is not yet implemented for GRUB 2, although it is planned.
3301
File: grub.info, Node: Security, Next: Supported kernels, Prev: Commands, Up: Top
3303
14 Authentication and authorisation
3304
***********************************
3306
By default, the boot loader interface is accessible to anyone with
3307
physical access to the console: anyone can select and edit any menu
3308
entry, and anyone can get direct access to a GRUB shell prompt. For
3309
most systems, this is reasonable since anyone with direct physical
3310
access has a variety of other ways to gain full access, and requiring
3311
authentication at the boot loader level would only serve to make it
3312
difficult to recover broken systems.
3314
However, in some environments, such as kiosks, it may be appropriate
3315
to lock down the boot loader to require authentication before
3316
performing certain operations.
3318
The `password' (*note password::) and `password_pbkdf2' (*note
3319
password_pbkdf2::) commands can be used to define users, each of which
3320
has an associated password. `password' sets the password in plain
3321
text, requiring `grub.cfg' to be secure; `password_pbkdf2' sets the
3322
password hashed using the Password-Based Key Derivation Function (RFC
3323
2898), requiring the use of `grub-mkpasswd-pbkdf2' (*note Invoking
3324
grub-mkpasswd-pbkdf2::) to generate password hashes.
3326
In order to enable authentication support, the `superusers'
3327
environment variable must be set to a list of usernames, separated by
3328
any of spaces, commas, semicolons, pipes, or ampersands. Superusers
3329
are permitted to use the GRUB command line, edit menu entries, and
3330
execute any menu entry. If `superusers' is set, then use of the
3331
command line is automatically restricted to superusers.
3333
Other users may be given access to specific menu entries by giving a
3334
list of usernames (as above) using the `--users' option to the
3335
`menuentry' command (*note menuentry::). If the `--users' option is
3336
not used for a menu entry, then that entry is unrestricted.
3338
Putting this together, a typical `grub.cfg' fragment might look like
3341
set superusers="root"
3342
password_pbkdf2 root grub.pbkdf2.sha512.10000.biglongstring
3343
password user1 insecure
3345
menuentry "May be run by any user" {
3350
menuentry "Superusers only" --users "" {
3352
linux /vmlinuz single
3355
menuentry "May be run by user1 or a superuser" --users user1 {
3360
The `grub-mkconfig' program does not yet have built-in support for
3361
generating configuration files with authentication. You can use
3362
`/etc/grub.d/40_custom' to add simple superuser authentication, by
3363
adding `set superusers=' and `password' or `password_pbkdf2' commands.
3366
File: grub.info, Node: Supported kernels, Next: Troubleshooting, Prev: Security, Up: Top
3368
15 Supported boot targets
3369
*************************
3371
X86 support is summarised in the following table. "Yes" means that the
3372
kernel works on the given platform, "crashes" means an early kernel
3373
crash which we hope will be fixed by concerned kernel developers. "no"
3374
means GRUB doesn't load the given kernel on a given platform.
3375
"headless" means that the kernel works but lacks console drivers (you
3376
can still use serial or network console). In case of "no" and
3377
"crashes" the reason is given in footnote.
3379
BIOS chainloading yes no (1)
3381
FreeBSD bootloader yes crashes (1)
3382
32-bit kFreeBSD yes crashes (2,6)
3383
64-bit kFreeBSD yes crashes (2,6)
3384
32-bit kNetBSD yes crashes (1)
3385
64-bit kNetBSD yes crashes (2)
3386
32-bit kOpenBSD yes yes
3387
64-bit kOpenBSD yes yes
3390
32-bit Linux (legacy protocol) yes no (1)
3391
64-bit Linux (legacy protocol) yes no (1)
3392
32-bit Linux (modern protocol) yes yes
3393
64-bit Linux (modern protocol) yes yes
3396
32-bit EFI chainloader no (3) no (3)
3397
64-bit EFI chainloader no (3) no (3)
3398
Appleloader no (3) no (3)
3401
BIOS chainloading no (1) no (1)
3403
FreeBSD bootloader crashes (1) crashes (1)
3404
32-bit kFreeBSD crashes (6) crashes (6)
3405
64-bit kFreeBSD crashes (6) crashes (6)
3406
32-bit kNetBSD crashes (1) crashes (1)
3407
64-bit kNetBSD yes yes
3408
32-bit kOpenBSD yes yes
3409
64-bit kOpenBSD yes yes
3412
32-bit Linux (legacy protocol) no (1) no (1)
3413
64-bit Linux (legacy protocol) no (1) no (1)
3414
32-bit Linux (modern protocol) yes yes
3415
64-bit Linux (modern protocol) yes yes
3418
32-bit EFI chainloader no (3) no (3)
3419
64-bit EFI chainloader no (3) no (3)
3420
Appleloader no (3) no (3)
3422
32-bit EFI 64-bit EFI
3423
BIOS chainloading no (1) no (1)
3425
FreeBSD bootloader crashes (1) crashes (1)
3426
32-bit kFreeBSD headless headless
3427
64-bit kFreeBSD headless headless
3428
32-bit kNetBSD crashes (1) crashes (1)
3429
64-bit kNetBSD yes yes
3430
32-bit kOpenBSD headless headless
3431
64-bit kOpenBSD headless headless
3434
32-bit Linux (legacy protocol) no (1) no (1)
3435
64-bit Linux (legacy protocol) no (1) no (1)
3436
32-bit Linux (modern protocol) yes yes
3437
64-bit Linux (modern protocol) yes yes
3439
64-bit XNU yes (5) yes
3440
32-bit EFI chainloader yes no (4)
3441
64-bit EFI chainloader no (4) yes
3445
BIOS chainloading no (1)
3447
FreeBSD bootloader crashes (1)
3448
32-bit kFreeBSD crashes (6)
3449
64-bit kFreeBSD crashes (6)
3450
32-bit kNetBSD crashes (1)
3456
32-bit Linux (legacy protocol) no (1)
3457
64-bit Linux (legacy protocol) no (1)
3458
32-bit Linux (modern protocol) ?
3459
64-bit Linux (modern protocol) ?
3462
32-bit EFI chainloader no (3)
3463
64-bit EFI chainloader no (3)
3468
2. Crashes because the memory at 0x0-0x1000 isn't available
3472
4. 32-bit and 64-bit EFI have different structures and work in
3473
different CPU modes so it's not possible to chainload 32-bit
3474
bootloader on 64-bit platform and vice-versa
3476
5. Some modules may need to be disabled
3480
PowerPC and Sparc ports support only Linux. MIPS port supports Linux
3486
As you have seen in previous chapter the support matrix is pretty big
3487
and some of the configurations are only rarely used. To ensure the
3488
quality bootchecks are available for all x86 targets except EFI
3489
chainloader, Appleloader and XNU. All x86 platforms have bootcheck
3490
facility except ieee1275. Multiboot, multiboot2, BIOS chainloader,
3491
ntldr and freebsd-bootloader boot targets are tested only with a fake
3492
kernel images. Only Linux is tested among the payloads using Linux
3495
Following variables must be defined:
3497
GRUB_PAYLOADS_DIR directory containing the required kernels
3498
GRUB_CBFSTOOL cbfstoll from Coreboot package (for coreboot
3500
GRUB_COREBOOT_ROM empty Coreboot ROM
3501
GRUB_QEMU_OPTS additional options to be supplied to QEMU
3505
kfreebsd_env.i386 32-bit kFreeBSD device hints
3506
kfreebsd.i386 32-bit FreeBSD kernel image
3507
kfreebsd.x86_64, same from 64-bit kFreeBSD
3509
knetbsd.i386 32-bit NetBSD kernel image
3510
knetbsd.miniroot.i386 32-bit kNetBSD miniroot.kmod.
3511
knetbsd.x86_64, same from 64-bit kNetBSD
3512
knetbsd.miniroot.x86_64
3513
kopenbsd.i386 32-bit OpenBSD kernel bsd.rd image
3514
kopenbsd.x86_64 same from 64-bit kOpenBSD
3515
linux.i386 32-bit Linux
3516
linux.x86_64 64-bit Linux
3519
File: grub.info, Node: Troubleshooting, Next: Invoking grub-install, Prev: Supported kernels, Up: Top
3521
17 Error messages produced by GRUB
3522
**********************************
3526
* GRUB only offers a rescue shell::
3529
File: grub.info, Node: GRUB only offers a rescue shell, Up: Troubleshooting
3531
17.1 GRUB only offers a rescue shell
3532
====================================
3534
GRUB's normal start-up procedure involves setting the `prefix'
3535
environment variable to a value set in the core image by
3536
`grub-install', setting the `root' variable to match, loading the
3537
`normal' module from the prefix, and running the `normal' command.
3538
This command is responsible for reading `/boot/grub/grub.cfg', running
3539
the menu, and doing all the useful things GRUB is supposed to do.
3541
If, instead, you only get a rescue shell, this usually means that
3542
GRUB failed to load the `normal' module for some reason. It may be
3543
possible to work around this temporarily: for instance, if the reason
3544
for the failure is that `prefix' is wrong (perhaps it refers to the
3545
wrong device, or perhaps the path to `/boot/grub' was not correctly
3546
made relative to the device), then you can correct this and enter
3547
normal mode manually:
3549
# Inspect the current prefix (and other preset variables):
3551
# Set to the correct value, which might be something like this:
3552
set prefix=(hd0,1)/grub
3557
However, any problem that leaves you in the rescue shell probably
3558
means that GRUB was not correctly installed. It may be more useful to
3559
try to reinstall it properly using `grub-install DEVICE' (*note
3560
Invoking grub-install::). When doing this, there are a few things to
3563
* Drive ordering in your operating system may not be the same as the
3564
boot drive ordering used by your firmware. Do not assume that
3565
your first hard drive (e.g. `/dev/sda') is the one that your
3566
firmware will boot from. `device.map' (*note Device map::) can be
3567
used to override this, but it is usually better to use UUIDs or
3568
file system labels and avoid depending on drive ordering entirely.
3570
* At least on BIOS systems, if you tell `grub-install' to install
3571
GRUB to a partition but GRUB has already been installed in the
3572
master boot record, then the GRUB installation in the partition
3575
* If possible, it is generally best to avoid installing GRUB to a
3576
partition (unless it is a special partition for the use of GRUB
3577
alone, such as the BIOS Boot Partition used on GPT). Doing this
3578
means that GRUB may stop being able to read its core image due to
3579
a file system moving blocks around, such as while defragmenting,
3580
running checks, or even during normal operation. Installing to
3581
the whole disk device is normally more robust.
3583
* Check that GRUB actually knows how to read from the device and
3584
file system containing `/boot/grub'. It will not be able to read
3585
from encrypted devices, nor from file systems for which support
3586
has not yet been added to GRUB.
3589
File: grub.info, Node: Invoking grub-install, Next: Invoking grub-mkconfig, Prev: Troubleshooting, Up: Top
3591
18 Invoking grub-install
3592
************************
3594
The program `grub-install' installs GRUB on your drive using
3595
`grub-mkimage' and (on some platforms) `grub-setup'. You must specify
3596
the device name on which you want to install GRUB, like this:
3598
grub-install INSTALL_DEVICE
3600
The device name INSTALL_DEVICE is an OS device name or a GRUB device
3603
`grub-install' accepts the following options:
3606
Print a summary of the command-line options and exit.
3609
Print the version number of GRUB and exit.
3611
`--root-directory=DIR'
3612
Install GRUB images under the directory DIR instead of the root
3613
directory. This option is useful when you want to install GRUB
3614
into a separate partition or a removable disk. Here is an example
3615
in which you have a separate "boot" partition which is mounted on
3618
grub-install --root-directory=/boot hd0
3621
Recheck the device map, even if `/boot/grub/device.map' already
3622
exists. You should use this option whenever you add/remove a disk
3623
into/from your computer.
3626
File: grub.info, Node: Invoking grub-mkconfig, Next: Invoking grub-mkpasswd-pbkdf2, Prev: Invoking grub-install, Up: Top
3628
19 Invoking grub-mkconfig
3629
*************************
3631
The program `grub-mkconfig' generates a configuration file for GRUB
3632
(*note Simple configuration::).
3634
grub-mkconfig -o /boot/grub/grub.cfg
3636
`grub-mkconfig' accepts the following options:
3639
Print a summary of the command-line options and exit.
3642
Print the version number of GRUB and exit.
3646
Send the generated configuration file to FILE. The default is to
3647
send it to standard output.
3650
File: grub.info, Node: Invoking grub-mkpasswd-pbkdf2, Next: Obtaining and Building GRUB, Prev: Invoking grub-mkconfig, Up: Top
3652
20 Invoking grub-mkpasswd-pbkdf2
3653
********************************
3655
The program `grub-mkpasswd-pbkdf2' generates password hashes for GRUB
3658
grub-mkpasswd-pbkdf2
3660
`grub-mkpasswd-pbkdf2' accepts the following options:
3663
`--iteration-count=NUMBER'
3664
Number of iterations of the underlying pseudo-random function.
3669
Length of the generated hash. Defaults to 64.
3673
Length of the salt. Defaults to 64.
3676
File: grub.info, Node: Obtaining and Building GRUB, Next: Reporting bugs, Prev: Invoking grub-mkpasswd-pbkdf2, Up: Top
3678
Appendix A How to obtain and build GRUB
3679
***************************************
3681
*Caution:* GRUB requires binutils-2.9.1.0.23 or later because the
3682
GNU assembler has been changed so that it can produce real 16bits
3683
machine code between 2.9.1 and 2.9.1.0.x. See
3684
`http://sources.redhat.com/binutils/', to obtain information on
3685
how to get the latest version.
3687
GRUB is available from the GNU alpha archive site
3688
`ftp://alpha.gnu.org/gnu/grub' or any of its mirrors. The file will be
3689
named grub-version.tar.gz. The current version is 1.99~rc1, so the file
3692
`ftp://alpha.gnu.org/gnu/grub/grub-1.99~rc1.tar.gz'
3694
To unbundle GRUB use the instruction:
3696
zcat grub-1.99~rc1.tar.gz | tar xvf -
3698
which will create a directory called `grub-1.99~rc1' with all the
3699
sources. You can look at the file `INSTALL' for detailed instructions
3700
on how to build and install GRUB, but you should be able to just do:
3706
Also, the latest version is available using Bazaar. See
3707
`http://www.gnu.org/software/grub/grub-download.en.html' for more
3711
File: grub.info, Node: Reporting bugs, Next: Future, Prev: Obtaining and Building GRUB, Up: Top
3713
Appendix B Reporting bugs
3714
*************************
3716
These are the guideline for how to report bugs. Take a look at this
3717
list below before you submit bugs:
3719
1. Before getting unsettled, read this manual through and through.
3720
Also, see the GNU GRUB FAQ
3721
(http://www.gnu.org/software/grub/grub-faq.html).
3723
2. Always mention the information on your GRUB. The version number
3724
and the configuration are quite important. If you build it
3725
yourself, write the options specified to the configure script and
3726
your operating system, including the versions of gcc and binutils.
3728
3. If you have trouble with the installation, inform us of how you
3729
installed GRUB. Don't omit error messages, if any. Just `GRUB hangs
3730
up when it boots' is not enough.
3732
The information on your hardware is also essential. These are
3733
especially important: the geometries and the partition tables of
3734
your hard disk drives and your BIOS.
3736
4. If GRUB cannot boot your operating system, write down _everything_
3737
you see on the screen. Don't paraphrase them, like `The foo OS
3738
crashes with GRUB, even though it can boot with the bar boot
3739
loader just fine'. Mention the commands you executed, the messages
3740
printed by them, and information on your operating system
3741
including the version number.
3743
5. Explain what you wanted to do. It is very useful to know your
3744
purpose and your wish, and how GRUB didn't satisfy you.
3746
6. If you can investigate the problem yourself, please do. That will
3747
give you and us much more information on the problem. Attaching a
3748
patch is even better.
3750
When you attach a patch, make the patch in unified diff format, and
3751
write ChangeLog entries. But, even when you make a patch, don't
3752
forget to explain the problem, so that we can understand what your
3755
7. Write down anything that you think might be related. Please
3756
understand that we often need to reproduce the same problem you
3757
encounterred in our environment. So your information should be
3758
sufficient for us to do the same thing--Don't forget that we
3759
cannot see your computer directly. If you are not sure whether to
3760
state a fact or leave it out, state it! Reporting too many things
3761
is much better than omitting something important.
3763
If you follow the guideline above, submit a report to the Bug
3764
Tracking System (http://savannah.gnu.org/bugs/?group=grub).
3765
Alternatively, you can submit a report via electronic mail to
3766
<bug-grub@gnu.org>, but we strongly recommend that you use the Bug
3767
Tracking System, because e-mail can be passed over easily.
3769
Once we get your report, we will try to fix the bugs.
3772
File: grub.info, Node: Future, Next: Internals, Prev: Reporting bugs, Up: Top
3774
Appendix C Where GRUB will go
3775
*****************************
3777
We started the next generation of GRUB, GRUB 2. GRUB 2 includes
3778
internationalization, dynamic module loading, real memory management,
3779
multiple architecture support, a scripting language, and many other
3780
nice features. If you are interested in the development of GRUB 2, take
3781
a look at the homepage (http://www.gnu.org/software/grub/grub.html).
3784
File: grub.info, Node: Internals, Next: Copying This Manual, Prev: Future, Up: Top
3786
Appendix D Hacking GRUB
3787
***********************
3791
* Getting the source code::
3792
* Finding your way around::
3795
File: grub.info, Node: Getting the source code, Next: Finding your way around, Up: Internals
3797
D.1 Getting the source code
3798
===========================
3800
GRUB is maintained using the Bazaar revision control system
3801
(http://bazaar-vcs.org/). To fetch the primary development branch:
3803
bzr get http://bzr.savannah.gnu.org/r/grub/trunk/grub
3805
The GRUB developers maintain several other branches with work in
3806
progress. Of these, the most interesting is the experimental branch,
3807
which is a staging area for new code which we expect to eventually
3808
merge into trunk but which is not yet ready:
3810
bzr get http://bzr.savannah.gnu.org/r/grub/branches/experimental
3812
Once you have used `bzr get' to fetch an initial copy of a branch,
3813
you can use `bzr pull' to keep it up to date. If you have modified your
3814
local version, you may need to resolve conflicts when pulling.
3817
File: grub.info, Node: Finding your way around, Prev: Getting the source code, Up: Internals
3819
D.2 Finding your way around
3820
===========================
3822
Here is a brief map of the GRUB code base.
3824
GRUB uses Autoconf, but not (yet) Automake. The top-level build
3825
rules are in `configure.ac', `Makefile.in', and `conf/*.rmk'. Each
3826
`conf/*.rmk' file represents a particular target configuration, and is
3827
processed into GNU Make rules by `genmk.rb' (which you only need to
3828
look at if you are extending the build system). If you are adding a new
3829
module which follows an existing pattern, such as a new command or a new
3830
filesystem implementation, it is usually easiest to grep `conf/*.rmk'
3831
for an existing example of that pattern to find out where it should be
3834
Low-level boot code, such as the MBR implementation on PC BIOS
3835
systems, is in the `boot/' directory.
3837
The GRUB kernel is in `kern/'. This contains core facilities such as
3838
the device, disk, and file frameworks, environment variable handling,
3839
list processing, and so on. The kernel should contain enough to get up
3840
to a rescue prompt. Header files for kernel facilities, among others,
3843
Terminal implementations are in `term/'.
3845
Disk access code is spread across `disk/' (for accessing the disk
3846
devices themselves), `partmap/' (for interpreting partition table
3847
data), and `fs/' (for accessing filesystems). Note that, with the odd
3848
specialised exception, GRUB only contains code to _read_ from
3849
filesystems and tries to avoid containing any code to _write_ to
3850
filesystems; this lets us confidently assure users that GRUB cannot be
3851
responsible for filesystem corruption.
3853
PCI and USB bus handling is in `bus/'.
3855
Video handling code is in `video/'. The graphical menu system uses
3856
this heavily, but is in a separate directory, `gfxmenu/'.
3858
Most commands are implemented by files in `commands/', with the
3859
following exceptions:
3861
* A few core commands live in `kern/corecmd.c'.
3863
* Commands related to normal mode live under `normal/'.
3865
* Commands that load and boot kernels live under `loader/'.
3867
* The `loopback' command is really a disk device, and so lives in
3870
* The `gettext' command lives under `gettext/'.
3872
* The `loadfont' and `lsfonts' commands live under `font/'.
3874
* The `serial', `terminfo', and `background_image' commands live
3877
* The `efiemu_*' commands live under `efiemu/'.
3879
There are a few other special-purpose exceptions; grep for them if
3883
File: grub.info, Node: Copying This Manual, Next: Index, Prev: Internals, Up: Top
3885
Appendix E Copying This Manual
3886
******************************
3890
* GNU Free Documentation License:: License for copying this manual.
3893
File: grub.info, Node: GNU Free Documentation License, Up: Copying This Manual
3895
E.1 GNU Free Documentation License
3896
==================================
3898
Version 1.2, November 2002
3900
Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
3901
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
3903
Everyone is permitted to copy and distribute verbatim copies
3904
of this license document, but changing it is not allowed.
3908
The purpose of this License is to make a manual, textbook, or other
3909
functional and useful document "free" in the sense of freedom: to
3910
assure everyone the effective freedom to copy and redistribute it,
3911
with or without modifying it, either commercially or
3912
noncommercially. Secondarily, this License preserves for the
3913
author and publisher a way to get credit for their work, while not
3914
being considered responsible for modifications made by others.
3916
This License is a kind of "copyleft", which means that derivative
3917
works of the document must themselves be free in the same sense.
3918
It complements the GNU General Public License, which is a copyleft
3919
license designed for free software.
3921
We have designed this License in order to use it for manuals for
3922
free software, because free software needs free documentation: a
3923
free program should come with manuals providing the same freedoms
3924
that the software does. But this License is not limited to
3925
software manuals; it can be used for any textual work, regardless
3926
of subject matter or whether it is published as a printed book.
3927
We recommend this License principally for works whose purpose is
3928
instruction or reference.
3930
1. APPLICABILITY AND DEFINITIONS
3932
This License applies to any manual or other work, in any medium,
3933
that contains a notice placed by the copyright holder saying it
3934
can be distributed under the terms of this License. Such a notice
3935
grants a world-wide, royalty-free license, unlimited in duration,
3936
to use that work under the conditions stated herein. The
3937
"Document", below, refers to any such manual or work. Any member
3938
of the public is a licensee, and is addressed as "you". You
3939
accept the license if you copy, modify or distribute the work in a
3940
way requiring permission under copyright law.
3942
A "Modified Version" of the Document means any work containing the
3943
Document or a portion of it, either copied verbatim, or with
3944
modifications and/or translated into another language.
3946
A "Secondary Section" is a named appendix or a front-matter section
3947
of the Document that deals exclusively with the relationship of the
3948
publishers or authors of the Document to the Document's overall
3949
subject (or to related matters) and contains nothing that could
3950
fall directly within that overall subject. (Thus, if the Document
3951
is in part a textbook of mathematics, a Secondary Section may not
3952
explain any mathematics.) The relationship could be a matter of
3953
historical connection with the subject or with related matters, or
3954
of legal, commercial, philosophical, ethical or political position
3957
The "Invariant Sections" are certain Secondary Sections whose
3958
titles are designated, as being those of Invariant Sections, in
3959
the notice that says that the Document is released under this
3960
License. If a section does not fit the above definition of
3961
Secondary then it is not allowed to be designated as Invariant.
3962
The Document may contain zero Invariant Sections. If the Document
3963
does not identify any Invariant Sections then there are none.
3965
The "Cover Texts" are certain short passages of text that are
3966
listed, as Front-Cover Texts or Back-Cover Texts, in the notice
3967
that says that the Document is released under this License. A
3968
Front-Cover Text may be at most 5 words, and a Back-Cover Text may
3969
be at most 25 words.
3971
A "Transparent" copy of the Document means a machine-readable copy,
3972
represented in a format whose specification is available to the
3973
general public, that is suitable for revising the document
3974
straightforwardly with generic text editors or (for images
3975
composed of pixels) generic paint programs or (for drawings) some
3976
widely available drawing editor, and that is suitable for input to
3977
text formatters or for automatic translation to a variety of
3978
formats suitable for input to text formatters. A copy made in an
3979
otherwise Transparent file format whose markup, or absence of
3980
markup, has been arranged to thwart or discourage subsequent
3981
modification by readers is not Transparent. An image format is
3982
not Transparent if used for any substantial amount of text. A
3983
copy that is not "Transparent" is called "Opaque".
3985
Examples of suitable formats for Transparent copies include plain
3986
ASCII without markup, Texinfo input format, LaTeX input format,
3987
SGML or XML using a publicly available DTD, and
3988
standard-conforming simple HTML, PostScript or PDF designed for
3989
human modification. Examples of transparent image formats include
3990
PNG, XCF and JPG. Opaque formats include proprietary formats that
3991
can be read and edited only by proprietary word processors, SGML or
3992
XML for which the DTD and/or processing tools are not generally
3993
available, and the machine-generated HTML, PostScript or PDF
3994
produced by some word processors for output purposes only.
3996
The "Title Page" means, for a printed book, the title page itself,
3997
plus such following pages as are needed to hold, legibly, the
3998
material this License requires to appear in the title page. For
3999
works in formats which do not have any title page as such, "Title
4000
Page" means the text near the most prominent appearance of the
4001
work's title, preceding the beginning of the body of the text.
4003
A section "Entitled XYZ" means a named subunit of the Document
4004
whose title either is precisely XYZ or contains XYZ in parentheses
4005
following text that translates XYZ in another language. (Here XYZ
4006
stands for a specific section name mentioned below, such as
4007
"Acknowledgements", "Dedications", "Endorsements", or "History".)
4008
To "Preserve the Title" of such a section when you modify the
4009
Document means that it remains a section "Entitled XYZ" according
4012
The Document may include Warranty Disclaimers next to the notice
4013
which states that this License applies to the Document. These
4014
Warranty Disclaimers are considered to be included by reference in
4015
this License, but only as regards disclaiming warranties: any other
4016
implication that these Warranty Disclaimers may have is void and
4017
has no effect on the meaning of this License.
4021
You may copy and distribute the Document in any medium, either
4022
commercially or noncommercially, provided that this License, the
4023
copyright notices, and the license notice saying this License
4024
applies to the Document are reproduced in all copies, and that you
4025
add no other conditions whatsoever to those of this License. You
4026
may not use technical measures to obstruct or control the reading
4027
or further copying of the copies you make or distribute. However,
4028
you may accept compensation in exchange for copies. If you
4029
distribute a large enough number of copies you must also follow
4030
the conditions in section 3.
4032
You may also lend copies, under the same conditions stated above,
4033
and you may publicly display copies.
4035
3. COPYING IN QUANTITY
4037
If you publish printed copies (or copies in media that commonly
4038
have printed covers) of the Document, numbering more than 100, and
4039
the Document's license notice requires Cover Texts, you must
4040
enclose the copies in covers that carry, clearly and legibly, all
4041
these Cover Texts: Front-Cover Texts on the front cover, and
4042
Back-Cover Texts on the back cover. Both covers must also clearly
4043
and legibly identify you as the publisher of these copies. The
4044
front cover must present the full title with all words of the
4045
title equally prominent and visible. You may add other material
4046
on the covers in addition. Copying with changes limited to the
4047
covers, as long as they preserve the title of the Document and
4048
satisfy these conditions, can be treated as verbatim copying in
4051
If the required texts for either cover are too voluminous to fit
4052
legibly, you should put the first ones listed (as many as fit
4053
reasonably) on the actual cover, and continue the rest onto
4056
If you publish or distribute Opaque copies of the Document
4057
numbering more than 100, you must either include a
4058
machine-readable Transparent copy along with each Opaque copy, or
4059
state in or with each Opaque copy a computer-network location from
4060
which the general network-using public has access to download
4061
using public-standard network protocols a complete Transparent
4062
copy of the Document, free of added material. If you use the
4063
latter option, you must take reasonably prudent steps, when you
4064
begin distribution of Opaque copies in quantity, to ensure that
4065
this Transparent copy will remain thus accessible at the stated
4066
location until at least one year after the last time you
4067
distribute an Opaque copy (directly or through your agents or
4068
retailers) of that edition to the public.
4070
It is requested, but not required, that you contact the authors of
4071
the Document well before redistributing any large number of
4072
copies, to give them a chance to provide you with an updated
4073
version of the Document.
4077
You may copy and distribute a Modified Version of the Document
4078
under the conditions of sections 2 and 3 above, provided that you
4079
release the Modified Version under precisely this License, with
4080
the Modified Version filling the role of the Document, thus
4081
licensing distribution and modification of the Modified Version to
4082
whoever possesses a copy of it. In addition, you must do these
4083
things in the Modified Version:
4085
A. Use in the Title Page (and on the covers, if any) a title
4086
distinct from that of the Document, and from those of
4087
previous versions (which should, if there were any, be listed
4088
in the History section of the Document). You may use the
4089
same title as a previous version if the original publisher of
4090
that version gives permission.
4092
B. List on the Title Page, as authors, one or more persons or
4093
entities responsible for authorship of the modifications in
4094
the Modified Version, together with at least five of the
4095
principal authors of the Document (all of its principal
4096
authors, if it has fewer than five), unless they release you
4097
from this requirement.
4099
C. State on the Title page the name of the publisher of the
4100
Modified Version, as the publisher.
4102
D. Preserve all the copyright notices of the Document.
4104
E. Add an appropriate copyright notice for your modifications
4105
adjacent to the other copyright notices.
4107
F. Include, immediately after the copyright notices, a license
4108
notice giving the public permission to use the Modified
4109
Version under the terms of this License, in the form shown in
4112
G. Preserve in that license notice the full lists of Invariant
4113
Sections and required Cover Texts given in the Document's
4116
H. Include an unaltered copy of this License.
4118
I. Preserve the section Entitled "History", Preserve its Title,
4119
and add to it an item stating at least the title, year, new
4120
authors, and publisher of the Modified Version as given on
4121
the Title Page. If there is no section Entitled "History" in
4122
the Document, create one stating the title, year, authors,
4123
and publisher of the Document as given on its Title Page,
4124
then add an item describing the Modified Version as stated in
4125
the previous sentence.
4127
J. Preserve the network location, if any, given in the Document
4128
for public access to a Transparent copy of the Document, and
4129
likewise the network locations given in the Document for
4130
previous versions it was based on. These may be placed in
4131
the "History" section. You may omit a network location for a
4132
work that was published at least four years before the
4133
Document itself, or if the original publisher of the version
4134
it refers to gives permission.
4136
K. For any section Entitled "Acknowledgements" or "Dedications",
4137
Preserve the Title of the section, and preserve in the
4138
section all the substance and tone of each of the contributor
4139
acknowledgements and/or dedications given therein.
4141
L. Preserve all the Invariant Sections of the Document,
4142
unaltered in their text and in their titles. Section numbers
4143
or the equivalent are not considered part of the section
4146
M. Delete any section Entitled "Endorsements". Such a section
4147
may not be included in the Modified Version.
4149
N. Do not retitle any existing section to be Entitled
4150
"Endorsements" or to conflict in title with any Invariant
4153
O. Preserve any Warranty Disclaimers.
4155
If the Modified Version includes new front-matter sections or
4156
appendices that qualify as Secondary Sections and contain no
4157
material copied from the Document, you may at your option
4158
designate some or all of these sections as invariant. To do this,
4159
add their titles to the list of Invariant Sections in the Modified
4160
Version's license notice. These titles must be distinct from any
4161
other section titles.
4163
You may add a section Entitled "Endorsements", provided it contains
4164
nothing but endorsements of your Modified Version by various
4165
parties--for example, statements of peer review or that the text
4166
has been approved by an organization as the authoritative
4167
definition of a standard.
4169
You may add a passage of up to five words as a Front-Cover Text,
4170
and a passage of up to 25 words as a Back-Cover Text, to the end
4171
of the list of Cover Texts in the Modified Version. Only one
4172
passage of Front-Cover Text and one of Back-Cover Text may be
4173
added by (or through arrangements made by) any one entity. If the
4174
Document already includes a cover text for the same cover,
4175
previously added by you or by arrangement made by the same entity
4176
you are acting on behalf of, you may not add another; but you may
4177
replace the old one, on explicit permission from the previous
4178
publisher that added the old one.
4180
The author(s) and publisher(s) of the Document do not by this
4181
License give permission to use their names for publicity for or to
4182
assert or imply endorsement of any Modified Version.
4184
5. COMBINING DOCUMENTS
4186
You may combine the Document with other documents released under
4187
this License, under the terms defined in section 4 above for
4188
modified versions, provided that you include in the combination
4189
all of the Invariant Sections of all of the original documents,
4190
unmodified, and list them all as Invariant Sections of your
4191
combined work in its license notice, and that you preserve all
4192
their Warranty Disclaimers.
4194
The combined work need only contain one copy of this License, and
4195
multiple identical Invariant Sections may be replaced with a single
4196
copy. If there are multiple Invariant Sections with the same name
4197
but different contents, make the title of each such section unique
4198
by adding at the end of it, in parentheses, the name of the
4199
original author or publisher of that section if known, or else a
4200
unique number. Make the same adjustment to the section titles in
4201
the list of Invariant Sections in the license notice of the
4204
In the combination, you must combine any sections Entitled
4205
"History" in the various original documents, forming one section
4206
Entitled "History"; likewise combine any sections Entitled
4207
"Acknowledgements", and any sections Entitled "Dedications". You
4208
must delete all sections Entitled "Endorsements."
4210
6. COLLECTIONS OF DOCUMENTS
4212
You may make a collection consisting of the Document and other
4213
documents released under this License, and replace the individual
4214
copies of this License in the various documents with a single copy
4215
that is included in the collection, provided that you follow the
4216
rules of this License for verbatim copying of each of the
4217
documents in all other respects.
4219
You may extract a single document from such a collection, and
4220
distribute it individually under this License, provided you insert
4221
a copy of this License into the extracted document, and follow
4222
this License in all other respects regarding verbatim copying of
4225
7. AGGREGATION WITH INDEPENDENT WORKS
4227
A compilation of the Document or its derivatives with other
4228
separate and independent documents or works, in or on a volume of
4229
a storage or distribution medium, is called an "aggregate" if the
4230
copyright resulting from the compilation is not used to limit the
4231
legal rights of the compilation's users beyond what the individual
4232
works permit. When the Document is included in an aggregate, this
4233
License does not apply to the other works in the aggregate which
4234
are not themselves derivative works of the Document.
4236
If the Cover Text requirement of section 3 is applicable to these
4237
copies of the Document, then if the Document is less than one half
4238
of the entire aggregate, the Document's Cover Texts may be placed
4239
on covers that bracket the Document within the aggregate, or the
4240
electronic equivalent of covers if the Document is in electronic
4241
form. Otherwise they must appear on printed covers that bracket
4242
the whole aggregate.
4246
Translation is considered a kind of modification, so you may
4247
distribute translations of the Document under the terms of section
4248
4. Replacing Invariant Sections with translations requires special
4249
permission from their copyright holders, but you may include
4250
translations of some or all Invariant Sections in addition to the
4251
original versions of these Invariant Sections. You may include a
4252
translation of this License, and all the license notices in the
4253
Document, and any Warranty Disclaimers, provided that you also
4254
include the original English version of this License and the
4255
original versions of those notices and disclaimers. In case of a
4256
disagreement between the translation and the original version of
4257
this License or a notice or disclaimer, the original version will
4260
If a section in the Document is Entitled "Acknowledgements",
4261
"Dedications", or "History", the requirement (section 4) to
4262
Preserve its Title (section 1) will typically require changing the
4267
You may not copy, modify, sublicense, or distribute the Document
4268
except as expressly provided for under this License. Any other
4269
attempt to copy, modify, sublicense or distribute the Document is
4270
void, and will automatically terminate your rights under this
4271
License. However, parties who have received copies, or rights,
4272
from you under this License will not have their licenses
4273
terminated so long as such parties remain in full compliance.
4275
10. FUTURE REVISIONS OF THIS LICENSE
4277
The Free Software Foundation may publish new, revised versions of
4278
the GNU Free Documentation License from time to time. Such new
4279
versions will be similar in spirit to the present version, but may
4280
differ in detail to address new problems or concerns. See
4281
`http://www.gnu.org/copyleft/'.
4283
Each version of the License is given a distinguishing version
4284
number. If the Document specifies that a particular numbered
4285
version of this License "or any later version" applies to it, you
4286
have the option of following the terms and conditions either of
4287
that specified version or of any later version that has been
4288
published (not as a draft) by the Free Software Foundation. If
4289
the Document does not specify a version number of this License,
4290
you may choose any version ever published (not as a draft) by the
4291
Free Software Foundation.
4293
E.1.1 ADDENDUM: How to use this License for your documents
4294
----------------------------------------------------------
4296
To use this License in a document you have written, include a copy of
4297
the License in the document and put the following copyright and license
4298
notices just after the title page:
4300
Copyright (C) YEAR YOUR NAME.
4301
Permission is granted to copy, distribute and/or modify this document
4302
under the terms of the GNU Free Documentation License, Version 1.2
4303
or any later version published by the Free Software Foundation;
4304
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
4305
Texts. A copy of the license is included in the section entitled ``GNU
4306
Free Documentation License''.
4308
If you have Invariant Sections, Front-Cover Texts and Back-Cover
4309
Texts, replace the "with...Texts." line with this:
4311
with the Invariant Sections being LIST THEIR TITLES, with
4312
the Front-Cover Texts being LIST, and with the Back-Cover Texts
4315
If you have Invariant Sections without Cover Texts, or some other
4316
combination of the three, merge those two alternatives to suit the
4319
If your document contains nontrivial examples of program code, we
4320
recommend releasing these examples in parallel under your choice of
4321
free software license, such as the GNU General Public License, to
4322
permit their use in free software.
4325
File: grub.info, Node: Index, Prev: Copying This Manual, Up: Top