source: grub-pc/trunk/fuentes/docs/grub.texi @ 22

Last change on this file since 22 was 22, checked in by mabarracus, 5 years ago

updated version and apply net.ifnames=0 into debian/rules

File size: 237.5 KB
Line 
1\input texinfo
2@c -*-texinfo-*-
3@c %**start of header
4@setfilename grub.info
5@include version.texi
6@settitle GNU GRUB Manual @value{VERSION}
7@c Unify all our little indices for now.
8@syncodeindex fn cp
9@syncodeindex vr cp
10@syncodeindex ky cp
11@syncodeindex pg cp
12@syncodeindex tp cp
13@c %**end of header
14
15@footnotestyle separate
16@paragraphindent 3
17@finalout
18
19@copying
20This manual is for GNU GRUB (version @value{VERSION},
21@value{UPDATED}).
22
23Copyright @copyright{} 1999,2000,2001,2002,2004,2006,2008,2009,2010,2011,2012,2013 Free Software Foundation, Inc.
24
25@quotation
26Permission is granted to copy, distribute and/or modify this document
27under the terms of the GNU Free Documentation License, Version 1.2 or
28any later version published by the Free Software Foundation; with no
29Invariant Sections.
30@end quotation
31@end copying
32
33@dircategory Kernel
34@direntry
35* GRUB: (grub).                 The GRand Unified Bootloader
36* grub-install: (grub)Invoking grub-install.    Install GRUB on your drive
37* grub-mkconfig: (grub)Invoking grub-mkconfig.  Generate GRUB configuration
38* grub-mkpasswd-pbkdf2: (grub)Invoking grub-mkpasswd-pbkdf2.
39* grub-mkrelpath: (grub)Invoking grub-mkrelpath.
40* grub-mkrescue: (grub)Invoking grub-mkrescue.  Make a GRUB rescue image
41* grub-mount: (grub)Invoking grub-mount.        Mount a file system using GRUB
42* grub-probe: (grub)Invoking grub-probe.        Probe device information
43* grub-script-check: (grub)Invoking grub-script-check.
44@end direntry
45
46@setchapternewpage odd
47
48@titlepage
49@sp 10
50@title the GNU GRUB manual
51@subtitle The GRand Unified Bootloader, version @value{VERSION}, @value{UPDATED}.
52@author Gordon Matzigkeit
53@author Yoshinori K. Okuji
54@author Colin Watson
55@author Colin D. Bennett
56@c The following two commands start the copyright page.
57@page
58@vskip 0pt plus 1filll
59@insertcopying
60@end titlepage
61
62@c Output the table of contents at the beginning.
63@contents
64
65@finalout
66@headings double
67
68@ifnottex
69@node Top
70@top GNU GRUB manual
71
72This is the documentation of GNU GRUB, the GRand Unified Bootloader,
73a flexible and powerful boot loader program for a wide range of
74architectures.
75
76This edition documents version @value{VERSION}.
77
78@insertcopying
79@end ifnottex
80
81@menu
82* Introduction::                Capturing the spirit of GRUB
83* Naming convention::           Names of your drives in GRUB
84* OS-specific notes about grub tools::
85                                Some notes about OS-specific behaviour of GRUB
86                                tools
87* Installation::                Installing GRUB on your drive
88* Booting::                     How to boot different operating systems
89* Configuration::               Writing your own configuration file
90* Theme file format::           Format of GRUB theme files
91* Network::                     Downloading OS images from a network
92* Serial terminal::             Using GRUB via a serial line
93* Vendor power-on keys::        Changing GRUB behaviour on vendor power-on keys
94* Images::                      GRUB image files
95* Core image size limitation::  GRUB image files size limitations
96* Filesystem::                  Filesystem syntax and semantics
97* Interface::                   The menu and the command-line
98* Environment::                 GRUB environment variables
99* Commands::                    The list of available builtin commands
100* Internationalisation::        Topics relating to language support
101* Security::                    Authentication, authorisation, and signatures
102* Platform limitations::        The list of platform-specific limitations
103* Platform-specific operations:: Platform-specific operations
104* Supported kernels::           The list of supported kernels
105* Troubleshooting::             Error messages produced by GRUB
106* Invoking grub-install::       How to use the GRUB installer
107* Invoking grub-mkconfig::      Generate a GRUB configuration file
108* Invoking grub-mkpasswd-pbkdf2::
109                                Generate GRUB password hashes
110* Invoking grub-mkrelpath::     Make system path relative to its root
111* Invoking grub-mkrescue::      Make a GRUB rescue image
112* Invoking grub-mount::         Mount a file system using GRUB
113* Invoking grub-probe::         Probe device information for GRUB
114* Invoking grub-script-check::  Check GRUB script file for syntax errors
115* Obtaining and Building GRUB:: How to obtain and build GRUB
116* Reporting bugs::              Where you should send a bug report
117* Future::                      Some future plans on GRUB
118* Copying This Manual::         Copying This Manual
119* Index::
120@end menu
121
122
123@node Introduction
124@chapter Introduction to GRUB
125
126@menu
127* Overview::                    What exactly GRUB is and how to use it
128* History::                     From maggot to house fly
129* Changes from GRUB Legacy::    Differences from previous versions
130* Features::                    GRUB features
131* Role of a boot loader::       The role of a boot loader
132@end menu
133
134
135@node Overview
136@section Overview
137
138Briefly, a @dfn{boot loader} is the first software program that runs when
139a computer starts.  It is responsible for loading and transferring
140control to an operating system @dfn{kernel} software (such as Linux or
141GNU Mach).  The kernel, in turn, initializes the rest of the operating
142system (e.g. a GNU system).
143
144GNU GRUB is a very powerful boot loader, which can load a wide variety
145of free operating systems, as well as proprietary operating systems with
146chain-loading@footnote{@dfn{chain-load} is the mechanism for loading
147unsupported operating systems by loading another boot loader. It is
148typically used for loading DOS or Windows.}. GRUB is designed to
149address the complexity of booting a personal computer; both the
150program and this manual are tightly bound to that computer platform,
151although porting to other platforms may be addressed in the future.
152
153One of the important features in GRUB is flexibility; GRUB understands
154filesystems and kernel executable formats, so you can load an arbitrary
155operating system the way you like, without recording the physical
156position of your kernel on the disk. Thus you can load the kernel
157just by specifying its file name and the drive and partition where the
158kernel resides.
159
160When booting with GRUB, you can use either a command-line interface
161(@pxref{Command-line interface}), or a menu interface (@pxref{Menu
162interface}). Using the command-line interface, you type the drive
163specification and file name of the kernel manually. In the menu
164interface, you just select an OS using the arrow keys. The menu is
165based on a configuration file which you prepare beforehand
166(@pxref{Configuration}). While in the menu, you can switch to the
167command-line mode, and vice-versa. You can even edit menu entries
168before using them.
169
170In the following chapters, you will learn how to specify a drive, a
171partition, and a file name (@pxref{Naming convention}) to GRUB, how to
172install GRUB on your drive (@pxref{Installation}), and how to boot your
173OSes (@pxref{Booting}), step by step.
174
175
176@node History
177@section History of GRUB
178
179GRUB originated in 1995 when Erich Boleyn was trying to boot the GNU
180Hurd with the University of Utah's Mach 4 microkernel (now known as GNU
181Mach).  Erich and Brian Ford designed the Multiboot Specification
182(@pxref{Top, Multiboot Specification, Motivation, multiboot, The Multiboot
183Specification}), because they were determined not to add to the large
184number of mutually-incompatible PC boot methods.
185
186Erich then began modifying the FreeBSD boot loader so that it would
187understand Multiboot. He soon realized that it would be a lot easier
188to write his own boot loader from scratch than to keep working on the
189FreeBSD boot loader, and so GRUB was born.
190
191Erich added many features to GRUB, but other priorities prevented him
192from keeping up with the demands of its quickly-expanding user base. In
1931999, Gordon Matzigkeit and Yoshinori K. Okuji adopted GRUB as an
194official GNU package, and opened its development by making the latest
195sources available via anonymous CVS. @xref{Obtaining and Building
196GRUB}, for more information.
197
198Over the next few years, GRUB was extended to meet many needs, but it
199quickly became clear that its design was not keeping up with the extensions
200being made to it, and we reached the point where it was very difficult to
201make any further changes without breaking existing features.  Around 2002,
202Yoshinori K. Okuji started work on PUPA (Preliminary Universal Programming
203Architecture for GNU GRUB), aiming to rewrite the core of GRUB to make it
204cleaner, safer, more robust, and more powerful.  PUPA was eventually renamed
205to GRUB 2, and the original version of GRUB was renamed to GRUB Legacy.
206Small amounts of maintenance continued to be done on GRUB Legacy, but the
207last release (0.97) was made in 2005 and at the time of writing it seems
208unlikely that there will be another.
209
210By around 2007, GNU/Linux distributions started to use GRUB 2 to limited
211extents, and by the end of 2009 multiple major distributions were installing
212it by default.
213
214
215@node Changes from GRUB Legacy
216@section Differences from previous versions
217
218GRUB 2 is a rewrite of GRUB (@pxref{History}), although it shares many
219characteristics with the previous version, now known as GRUB Legacy.  Users
220of GRUB Legacy may need some guidance to find their way around this new
221version.
222
223@itemize @bullet
224@item
225The configuration file has a new name (@file{grub.cfg} rather than
226@file{menu.lst} or @file{grub.conf}), new syntax (@pxref{Configuration}) and
227many new commands (@pxref{Commands}).  Configuration cannot be copied over
228directly, although most GRUB Legacy users should not find the syntax too
229surprising.
230
231@item
232@file{grub.cfg} is typically automatically generated by
233@command{grub-mkconfig} (@pxref{Simple configuration}).  This makes it
234easier to handle versioned kernel upgrades.
235
236@item
237Partition numbers in GRUB device names now start at 1, not 0 (@pxref{Naming
238convention}).
239
240@item
241The configuration file is now written in something closer to a full
242scripting language: variables, conditionals, and loops are available.
243
244@item
245A small amount of persistent storage is available across reboots, using the
246@command{save_env} and @command{load_env} commands in GRUB and the
247@command{grub-editenv} utility.  This is not available in all configurations
248(@pxref{Environment block}).
249
250@item
251GRUB 2 has more reliable ways to find its own files and those of target
252kernels on multiple-disk systems, and has commands (@pxref{search}) to find
253devices using file system labels or Universally Unique Identifiers (UUIDs).
254
255@item
256GRUB 2 is available for several other types of system in addition to the PC
257BIOS systems supported by GRUB Legacy: PC EFI, PC coreboot, PowerPC, SPARC,
258and MIPS Lemote Yeeloong are all supported.
259
260@item
261Many more file systems are supported, including but not limited to ext4,
262HFS+, and NTFS.
263
264@item
265GRUB 2 can read files directly from LVM and RAID devices.
266
267@item
268A graphical terminal and a graphical menu system are available.
269
270@item
271GRUB 2's interface can be translated, including menu entry names.
272
273@item
274The image files (@pxref{Images}) that make up GRUB have been reorganised;
275Stage 1, Stage 1.5, and Stage 2 are no more.
276
277@item
278GRUB 2 puts many facilities in dynamically loaded modules, allowing the core
279image to be smaller, and allowing the core image to be built in more
280flexible ways.
281@end itemize
282
283
284@node Features
285@section GRUB features
286
287The primary requirement for GRUB is that it be compliant with the
288@dfn{Multiboot Specification}, which is described in @ref{Top, Multiboot
289Specification, Motivation, multiboot, The Multiboot Specification}.
290
291The other goals, listed in approximate order of importance, are:
292
293@itemize @bullet{}
294@item
295Basic functions must be straightforward for end-users.
296
297@item
298Rich functionality to support kernel experts and designers.
299
300@item
301Backward compatibility for booting FreeBSD, NetBSD, OpenBSD, and
302Linux. Proprietary kernels (such as DOS, Windows NT, and OS/2) are
303supported via a chain-loading function.
304@end itemize
305
306Except for specific compatibility modes (chain-loading and the Linux
307@dfn{piggyback} format), all kernels will be started in much the same
308state as in the Multiboot Specification. Only kernels loaded at 1 megabyte
309or above are presently supported. Any attempt to load below that
310boundary will simply result in immediate failure and an error message
311reporting the problem.
312
313In addition to the requirements above, GRUB has the following features
314(note that the Multiboot Specification doesn't require all the features
315that GRUB supports):
316
317@table @asis
318@item Recognize multiple executable formats
319Support many of the @dfn{a.out} variants plus @dfn{ELF}. Symbol
320tables are also loaded.
321
322@item Support non-Multiboot kernels
323Support many of the various free 32-bit kernels that lack Multiboot
324compliance (primarily FreeBSD, NetBSD@footnote{The NetBSD/i386 kernel
325is Multiboot-compliant, but lacks support for Multiboot modules.},
326OpenBSD, and Linux). Chain-loading of other boot loaders is also
327supported.
328
329@item Load multiples modules
330Fully support the Multiboot feature of loading multiple modules.
331
332@item Load a configuration file
333Support a human-readable text configuration file with preset boot
334commands. You can also load another configuration file dynamically and
335embed a preset configuration file in a GRUB image file. The list of
336commands (@pxref{Commands}) are a superset of those supported on the
337command-line. An example configuration file is provided in
338@ref{Configuration}.
339
340@item Provide a menu interface
341A menu interface listing preset boot commands, with a programmable
342timeout, is available. There is no fixed limit on the number of boot
343entries, and the current implementation has space for several hundred.
344
345@item Have a flexible command-line interface
346A fairly flexible command-line interface, accessible from the menu,
347is available to edit any preset commands, or write a new boot command
348set from scratch. If no configuration file is present, GRUB drops to
349the command-line.
350
351The list of commands (@pxref{Commands}) are a subset of those supported
352for configuration files. Editing commands closely resembles the Bash
353command-line (@pxref{Command Line Editing, Bash, Command Line Editing,
354features, Bash Features}), with @key{TAB}-completion of commands,
355devices, partitions, and files in a directory depending on context.
356
357@item Support multiple filesystem types
358Support multiple filesystem types transparently, plus a useful explicit
359blocklist notation. The currently supported filesystem types are @dfn{Amiga
360Fast FileSystem (AFFS)}, @dfn{AtheOS fs}, @dfn{BeFS},
361@dfn{BtrFS} (including raid0, raid1, raid10, gzip and lzo),
362@dfn{cpio} (little- and big-endian bin, odc and newc variants),
363@dfn{Linux ext2/ext3/ext4}, @dfn{DOS FAT12/FAT16/FAT32}, @dfn{exFAT}, @dfn{HFS},
364@dfn{HFS+}, @dfn{ISO9660} (including Joliet, Rock-ridge and multi-chunk files),
365@dfn{JFS}, @dfn{Minix fs} (versions 1, 2 and 3), @dfn{nilfs2},
366@dfn{NTFS} (including compression), @dfn{ReiserFS}, @dfn{ROMFS},
367@dfn{Amiga Smart FileSystem (SFS)}, @dfn{Squash4}, @dfn{tar}, @dfn{UDF},
368@dfn{BSD UFS/UFS2}, @dfn{XFS}, and @dfn{ZFS} (including lzjb, gzip,
369zle, mirror, stripe, raidz1/2/3 and encryption in AES-CCM and AES-GCM).
370@xref{Filesystem}, for more information.
371
372@item Support automatic decompression
373Can decompress files which were compressed by @command{gzip} or
374@command{xz}@footnote{Only CRC32 data integrity check is supported (xz default
375is CRC64 so one should use --check=crc32 option). LZMA BCJ filters are
376supported.}. This function is both automatic and transparent to the user
377(i.e. all functions operate upon the uncompressed contents of the specified
378files). This greatly reduces a file size and loading time, a
379particularly great benefit for floppies.@footnote{There are a few
380pathological cases where loading a very badly organized ELF kernel might
381take longer, but in practice this never happen.}
382
383It is conceivable that some kernel modules should be loaded in a
384compressed state, so a different module-loading command can be specified
385to avoid uncompressing the modules.
386
387@item Access data on any installed device
388Support reading data from any or all floppies or hard disk(s) recognized
389by the BIOS, independent of the setting of the root device.
390
391@item Be independent of drive geometry translations
392Unlike many other boot loaders, GRUB makes the particular drive
393translation irrelevant. A drive installed and running with one
394translation may be converted to another translation without any adverse
395effects or changes in GRUB's configuration.
396
397@item Detect all installed @sc{ram}
398GRUB can generally find all the installed @sc{ram} on a PC-compatible
399machine. It uses an advanced BIOS query technique for finding all
400memory regions. As described on the Multiboot Specification (@pxref{Top,
401Multiboot Specification, Motivation, multiboot, The Multiboot
402Specification}), not all kernels make use of this information, but GRUB
403provides it for those who do.
404
405@item Support Logical Block Address mode
406In traditional disk calls (called @dfn{CHS mode}), there is a geometry
407translation problem, that is, the BIOS cannot access over 1024
408cylinders, so the accessible space is limited to at least 508 MB and to
409at most 8GB. GRUB can't universally solve this problem, as there is no
410standard interface used in all machines. However, several newer machines
411have the new interface, Logical Block Address (@dfn{LBA}) mode. GRUB
412automatically detects if LBA mode is available and uses it if
413available. In LBA mode, GRUB can access the entire disk.
414
415@item Support network booting
416GRUB is basically a disk-based boot loader but also has network
417support. You can load OS images from a network by using the @dfn{TFTP}
418protocol.
419
420@item Support remote terminals
421To support computers with no console, GRUB provides remote terminal
422support, so that you can control GRUB from a remote host. Only serial
423terminal support is implemented at the moment.
424@end table
425
426
427@node Role of a boot loader
428@section The role of a boot loader
429
430The following is a quotation from Gordon Matzigkeit, a GRUB fanatic:
431
432@quotation
433Some people like to acknowledge both the operating system and kernel when
434they talk about their computers, so they might say they use
435``GNU/Linux'' or ``GNU/Hurd''.  Other people seem to think that the
436kernel is the most important part of the system, so they like to call
437their GNU operating systems ``Linux systems.''
438
439I, personally, believe that this is a grave injustice, because the
440@emph{boot loader} is the most important software of all. I used to
441refer to the above systems as either ``LILO''@footnote{The LInux LOader,
442a boot loader that everybody uses, but nobody likes.} or ``GRUB''
443systems.
444
445Unfortunately, nobody ever understood what I was talking about; now I
446just use the word ``GNU'' as a pseudonym for GRUB.
447
448So, if you ever hear people talking about their alleged ``GNU'' systems,
449remember that they are actually paying homage to the best boot loader
450around@dots{} GRUB!
451@end quotation
452
453We, the GRUB maintainers, do not (usually) encourage Gordon's level of
454fanaticism, but it helps to remember that boot loaders deserve
455recognition.  We hope that you enjoy using GNU GRUB as much as we did
456writing it.
457
458
459@node Naming convention
460@chapter Naming convention
461
462The device syntax used in GRUB is a wee bit different from what you may
463have seen before in your operating system(s), and you need to know it so
464that you can specify a drive/partition.
465
466Look at the following examples and explanations:
467
468@example
469(fd0)
470@end example
471
472First of all, GRUB requires that the device name be enclosed with
473@samp{(} and @samp{)}. The @samp{fd} part means that it is a floppy
474disk. The number @samp{0} is the drive number, which is counted from
475@emph{zero}. This expression means that GRUB will use the whole floppy
476disk.
477
478@example
479(hd0,msdos2)
480@end example
481
482Here, @samp{hd} means it is a hard disk drive. The first integer
483@samp{0} indicates the drive number, that is, the first hard disk,
484the string @samp{msdos} indicates the partition scheme, while
485the second integer, @samp{2}, indicates the partition number (or the
486@sc{pc} slice number in the BSD terminology). The partition numbers are
487counted from @emph{one}, not from zero (as was the case in previous
488versions of GRUB). This expression means the second partition of the
489first hard disk drive. In this case, GRUB uses one partition of the
490disk, instead of the whole disk.
491
492@example
493(hd0,msdos5)
494@end example
495
496This specifies the first @dfn{extended partition} of the first hard disk
497drive. Note that the partition numbers for extended partitions are
498counted from @samp{5}, regardless of the actual number of primary
499partitions on your hard disk.
500
501@example
502(hd1,msdos1,bsd1)
503@end example
504
505This means the BSD @samp{a} partition on first @sc{pc} slice number
506of the second hard disk.
507
508Of course, to actually access the disks or partitions with GRUB, you
509need to use the device specification in a command, like @samp{set
510root=(fd0)} or @samp{parttool (hd0,msdos3) hidden-}. To help you find out
511which number specifies a partition you want, the GRUB command-line
512(@pxref{Command-line interface}) options have argument
513completion. This means that, for example, you only need to type
514
515@example
516set root=(
517@end example
518
519followed by a @key{TAB}, and GRUB will display the list of drives,
520partitions, or file names. So it should be quite easy to determine the
521name of your target partition, even with minimal knowledge of the
522syntax.
523
524Note that GRUB does @emph{not} distinguish IDE from SCSI - it simply
525counts the drive numbers from zero, regardless of their type. Normally,
526any IDE drive number is less than any SCSI drive number, although that
527is not true if you change the boot sequence by swapping IDE and SCSI
528drives in your BIOS.
529
530Now the question is, how to specify a file? Again, consider an
531example:
532
533@example
534(hd0,msdos1)/vmlinuz
535@end example
536
537This specifies the file named @samp{vmlinuz}, found on the first
538partition of the first hard disk drive. Note that the argument
539completion works with file names, too.
540
541That was easy, admit it. Now read the next chapter, to find out how to
542actually install GRUB on your drive.
543
544@node OS-specific notes about grub tools
545@chapter OS-specific notes about grub tools
546
547On OS which have device nodes similar to Unix-like OS GRUB tools use the
548OS name. E.g. for GNU/Linux:
549
550@example
551# @kbd{grub-install /dev/sda}
552@end example
553
554On AROS we use another syntax. For volumes:
555
556@example
557//:<volume name>
558@end example
559
560E.g.
561
562@example
563//:DH0
564@end example
565
566For disks we use syntax:
567@example
568//:<driver name>/unit/flags
569@end example
570
571E.g.
572
573@example
574# @kbd{grub-install //:ata.device/0/0}
575@end example
576
577On Windows we use UNC path. For volumes it's typically
578
579@example
580\\?\Volume@{<GUID>@}
581\\?\<drive letter>:
582@end example
583
584E.g.
585
586@example
587\\?\Volume@{17f34d50-cf64-4b02-800e-51d79c3aa2ff@}
588\\?\C:
589@end example
590
591
592For disks it's
593
594@example
595\\?\PhysicalDrive<number>
596@end example
597
598E.g.
599
600@example
601# @kbd{grub-install \\?\PhysicalDrive0}
602@end example
603
604Beware that you may need to further escape the backslashes depending on your
605shell.
606
607When compiled with cygwin support then cygwin drive names are automatically
608when needed. E.g.
609
610@example
611# @kbd{grub-install /dev/sda}
612@end example
613
614@node Installation
615@chapter Installation
616
617In order to install GRUB as your boot loader, you need to first
618install the GRUB system and utilities under your UNIX-like operating
619system (@pxref{Obtaining and Building GRUB}). You can do this either
620from the source tarball, or as a package for your OS.
621
622After you have done that, you need to install the boot loader on a
623drive (floppy or hard disk) by using the utility
624@command{grub-install} (@pxref{Invoking grub-install}) on a UNIX-like OS.
625
626GRUB comes with boot images, which are normally put in the directory
627@file{/usr/lib/grub/<cpu>-<platform>} (for BIOS-based machines
628@file{/usr/lib/grub/i386-pc}). Hereafter, the directory where GRUB images are
629initially placed (normally @file{/usr/lib/grub/<cpu>-<platform>}) will be
630called the @dfn{image directory}, and the directory where the boot
631loader needs to find them (usually @file{/boot}) will be called
632the @dfn{boot directory}.
633
634@menu
635* Installing GRUB using grub-install::
636* Making a GRUB bootable CD-ROM::
637* Device map::
638* BIOS installation::
639@end menu
640
641
642@node Installing GRUB using grub-install
643@section Installing GRUB using grub-install
644
645For information on where GRUB should be installed on PC BIOS platforms,
646@pxref{BIOS installation}.
647
648In order to install GRUB under a UNIX-like OS (such
649as @sc{gnu}), invoke the program @command{grub-install} (@pxref{Invoking
650grub-install}) as the superuser (@dfn{root}).
651
652The usage is basically very simple. You only need to specify one
653argument to the program, namely, where to install the boot loader. The
654argument has to be either a device file (like @samp{/dev/hda}).
655For example, under Linux the following will install GRUB into the MBR
656of the first IDE disk:
657
658@example
659# @kbd{grub-install /dev/sda}
660@end example
661
662Likewise, under GNU/Hurd, this has the same effect:
663
664@example
665# @kbd{grub-install /dev/hd0}
666@end example
667
668But all the above examples assume that GRUB should put images under
669the @file{/boot} directory. If you want GRUB to put images under a directory
670other than @file{/boot}, you need to specify the option
671@option{--boot-directory}. The typical usage is that you create a GRUB
672boot floppy with a filesystem. Here is an example:
673
674@example
675@group
676# @kbd{mke2fs /dev/fd0}
677# @kbd{mount -t ext2 /dev/fd0 /mnt}
678# @kbd{mkdir /mnt/boot}
679# @kbd{grub-install --boot-directory=/mnt/boot /dev/fd0}
680# @kbd{umount /mnt}
681@end group
682@end example
683
684Some BIOSes have a bug of exposing the first partition of a USB drive as a
685floppy instead of exposing the USB drive as a hard disk (they call it
686``USB-FDD'' boot). In such cases, you need to install like this:
687
688@example
689# @kbd{losetup /dev/loop0 /dev/sdb1}
690# @kbd{mount /dev/loop0 /mnt/usb}
691# @kbd{grub-install --boot-directory=/mnt/usb/bugbios --force --allow-floppy /dev/loop0}
692@end example
693
694This install doesn't conflict with standard install as long as they are in
695separate directories.
696
697Note that @command{grub-install} is actually just a shell script and the
698real task is done by other tools such as @command{grub-mkimage}. Therefore,
699you may run those commands directly to install GRUB, without using
700@command{grub-install}. Don't do that, however, unless you are very familiar
701with the internals of GRUB. Installing a boot loader on a running OS may be
702extremely dangerous.
703
704On EFI systems for fixed disk install you have to mount EFI System Partition.
705If you mount it at @file{/boot/efi} then you don't need any special arguments:
706
707@example
708# @kbd{grub-install}
709@end example
710
711Otherwise you need to specify where your EFI System partition is mounted:
712
713@example
714# @kbd{grub-install --efi-directory=/mnt/efi}
715@end example
716
717For removable installs you have to use @option{--removable} and specify both
718@option{--boot-directory} and @option{--efi-directory}:
719
720@example
721# @kbd{grub-install --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --removable}
722@end example
723
724@node Making a GRUB bootable CD-ROM
725@section Making a GRUB bootable CD-ROM
726
727GRUB supports the @dfn{no emulation mode} in the El Torito
728specification@footnote{El Torito is a specification for bootable CD
729using BIOS functions.}. This means that you can use the whole CD-ROM
730from GRUB and you don't have to make a floppy or hard disk image file,
731which can cause compatibility problems.
732
733For booting from a CD-ROM, GRUB uses a special image called
734@file{cdboot.img}, which is concatenated with @file{core.img}. The
735@file{core.img} used for this should be built with at least the
736@samp{iso9660} and @samp{biosdisk} modules. Your bootable CD-ROM will
737usually also need to include a configuration file @file{grub.cfg} and some
738other GRUB modules.
739
740To make a simple generic GRUB rescue CD, you can use the
741@command{grub-mkrescue} program (@pxref{Invoking grub-mkrescue}):
742
743@example
744$ @kbd{grub-mkrescue -o grub.iso}
745@end example
746
747You will often need to include other files in your image. To do this, first
748make a top directory for the bootable image, say, @samp{iso}:
749
750@example
751$ @kbd{mkdir iso}
752@end example
753
754Make a directory for GRUB:
755
756@example
757$ @kbd{mkdir -p iso/boot/grub}
758@end example
759
760If desired, make the config file @file{grub.cfg} under @file{iso/boot/grub}
761(@pxref{Configuration}), and copy any files and directories for the disc to the
762directory @file{iso/}.
763
764Finally, make the image:
765
766@example
767$ @kbd{grub-mkrescue -o grub.iso iso}
768@end example
769
770This produces a file named @file{grub.iso}, which then can be burned
771into a CD (or a DVD), or written to a USB mass storage device.
772
773The root device will be set up appropriately on entering your
774@file{grub.cfg} configuration file, so you can refer to file names on the CD
775without needing to use an explicit device name. This makes it easier to
776produce rescue images that will work on both optical drives and USB mass
777storage devices.
778
779
780@node Device map
781@section The map between BIOS drives and OS devices
782
783If the device map file exists, the GRUB utilities (@command{grub-probe},
784etc.) read it to map BIOS drives to OS devices.  This file consists of lines
785like this:
786
787@example
788(@var{device}) @var{file}
789@end example
790
791@var{device} is a drive specified in the GRUB syntax (@pxref{Device
792syntax}), and @var{file} is an OS file, which is normally a device file.
793
794Historically, the device map file was used because GRUB device names had to
795be used in the configuration file, and they were derived from BIOS drive
796numbers.  The map between BIOS drives and OS devices cannot always be
797guessed correctly: for example, GRUB will get the order wrong if you
798exchange the boot sequence between IDE and SCSI in your BIOS.
799
800Unfortunately, even OS device names are not always stable.  Modern versions
801of the Linux kernel may probe drives in a different order from boot to boot,
802and the prefix (@file{/dev/hd*} versus @file{/dev/sd*}) may change depending
803on the driver subsystem in use.  As a result, the device map file required
804frequent editing on some systems.
805
806GRUB avoids this problem nowadays by using UUIDs or file system labels when
807generating @file{grub.cfg}, and we advise that you do the same for any
808custom menu entries you write.  If the device map file does not exist, then
809the GRUB utilities will assume a temporary device map on the fly.  This is
810often good enough, particularly in the common case of single-disk systems.
811
812However, the device map file is not entirely obsolete yet, and it is
813used for overriding when current environment is different from the one on boot.
814Most common case is if you use a partition or logical volume as a disk for
815virtual machine.  You can put any comments in the file if needed,
816as the GRUB utilities assume that a line is just a comment if
817the first character is @samp{#}.
818
819
820@node BIOS installation
821@section BIOS installation
822
823@heading MBR
824
825The partition table format traditionally used on PC BIOS platforms is called
826the Master Boot Record (MBR) format; this is the format that allows up to
827four primary partitions and additional logical partitions.  With this
828partition table format, there are two ways to install GRUB: it can be
829embedded in the area between the MBR and the first partition (called by
830various names, such as the "boot track", "MBR gap", or "embedding area", and
831which is usually at least 31 KiB), or the core image can be installed in a
832file system and a list of the blocks that make it up can be stored in the
833first sector of that partition.
834
835Each of these has different problems.  There is no way to reserve space in
836the embedding area with complete safety, and some proprietary software is
837known to use it to make it difficult for users to work around licensing
838restrictions; and systems are sometimes partitioned without leaving enough
839space before the first partition.  On the other hand, installing to a
840filesystem means that GRUB is vulnerable to its blocks being moved around by
841filesystem features such as tail packing, or even by aggressive fsck
842implementations, so this approach is quite fragile; and this approach can
843only be used if the @file{/boot} filesystem is on the same disk that the
844BIOS boots from, so that GRUB does not have to rely on guessing BIOS drive
845numbers.
846
847The GRUB development team generally recommends embedding GRUB before the
848first partition, unless you have special requirements.  You must ensure that
849the first partition starts at least 31 KiB (63 sectors) from the start of
850the disk; on modern disks, it is often a performance advantage to align
851partitions on larger boundaries anyway, so the first partition might start 1
852MiB from the start of the disk.
853
854@heading GPT
855
856Some newer systems use the GUID Partition Table (GPT) format.  This was
857specified as part of the Extensible Firmware Interface (EFI), but it can
858also be used on BIOS platforms if system software supports it; for example,
859GRUB and GNU/Linux can be used in this configuration.  With this format, it
860is possible to reserve a whole partition for GRUB, called the BIOS Boot
861Partition.  GRUB can then be embedded into that partition without the risk
862of being overwritten by other software and without being contained in a
863filesystem which might move its blocks around.
864
865When creating a BIOS Boot Partition on a GPT system, you should make sure
866that it is at least 31 KiB in size.  (GPT-formatted disks are not usually
867particularly small, so we recommend that you make it larger than the bare
868minimum, such as 1 MiB, to allow plenty of room for growth.)  You must also
869make sure that it has the proper partition type.  Using GNU Parted, you can
870set this using a command such as the following:
871
872@example
873# @kbd{parted /dev/@var{disk} set @var{partition-number} bios_grub on}
874@end example
875
876If you are using gdisk, set the partition type to @samp{0xEF02}.  With
877partitioning programs that require setting the GUID directly, it should be
878@samp{21686148-6449-6e6f-744e656564454649}.
879
880@strong{Caution:} Be very careful which partition you select!  When GRUB
881finds a BIOS Boot Partition during installation, it will automatically
882overwrite part of it.  Make sure that the partition does not contain any
883other data.
884
885
886@node Booting
887@chapter Booting
888
889GRUB can load Multiboot-compliant kernels in a consistent way,
890but for some free operating systems you need to use some OS-specific
891magic.
892
893@menu
894* General boot methods::        How to boot OSes with GRUB generally
895* Loopback booting::            Notes on booting from loopbacks
896* OS-specific notes::           Notes on some operating systems
897@end menu
898
899
900@node General boot methods
901@section How to boot operating systems
902
903GRUB has two distinct boot methods. One of the two is to load an
904operating system directly, and the other is to chain-load another boot
905loader which then will load an operating system actually. Generally
906speaking, the former is more desirable, because you don't need to
907install or maintain other boot loaders and GRUB is flexible enough to
908load an operating system from an arbitrary disk/partition. However,
909the latter is sometimes required, since GRUB doesn't support all the
910existing operating systems natively.
911
912@menu
913* Loading an operating system directly::
914* Chain-loading::
915@end menu
916
917
918@node Loading an operating system directly
919@subsection How to boot an OS directly with GRUB
920
921Multiboot (@pxref{Top, Multiboot Specification, Motivation, multiboot,
922The Multiboot Specification}) is the native format supported by GRUB.
923For the sake of convenience, there is also support for Linux, FreeBSD,
924NetBSD and OpenBSD. If you want to boot other operating systems, you
925will have to chain-load them (@pxref{Chain-loading}).
926
927FIXME: this section is incomplete.
928
929@enumerate
930@item
931Run the command @command{boot} (@pxref{boot}).
932@end enumerate
933
934However, DOS and Windows have some deficiencies, so you might have to
935use more complicated instructions. @xref{DOS/Windows}, for more
936information.
937
938
939@node Chain-loading
940@subsection Chain-loading an OS
941
942Operating systems that do not support Multiboot and do not have specific
943support in GRUB (specific support is available for Linux, FreeBSD, NetBSD
944and OpenBSD) must be chain-loaded, which involves loading another boot
945loader and jumping to it in real mode.
946
947The @command{chainloader} command (@pxref{chainloader}) is used to set this
948up.  It is normally also necessary to load some GRUB modules and set the
949appropriate root device.  Putting this together, we get something like this,
950for a Windows system on the first partition of the first hard disk:
951
952@verbatim
953menuentry "Windows" {
954        insmod chain
955        insmod ntfs
956        set root=(hd0,1)
957        chainloader +1
958}
959@end verbatim
960@c FIXME: document UUIDs.
961
962On systems with multiple hard disks, an additional workaround may be
963required.  @xref{DOS/Windows}.
964
965Chain-loading is only supported on PC BIOS and EFI platforms.
966
967@node Loopback booting
968@section Loopback booting
969GRUB is able to read from an image (be it one of CD or HDD) stored on
970any of its accessible storages (refer to @pxref{loopback} command).
971However the OS itself should be able to find its root. This usually
972involves running a userspace program running before the real root
973is discovered. This is achieved by GRUB loading a specially made
974small image and passing it as ramdisk to the kernel. This is achieved
975by commands @command{kfreebsd_module}, @command{knetbsd_module_elf},
976@command{kopenbsd_ramdisk}, @command{initrd} (@pxref{initrd}),
977@command{initrd16} (@pxref{initrd}), @command{multiboot_module},
978@command{multiboot2_module} or @command{xnu_ramdisk}
979depending on the loader. Note that for knetbsd the image must be put
980inside miniroot.kmod and the whole miniroot.kmod has to be loaded. In
981kopenbsd payload this is disabled by default. Aditionally behaviour of
982initial ramdisk depends on command line options. Several distributors provide
983the image for this purpose or it's integrated in their standard ramdisk and
984activated by special option. Consult your kernel and distribution manual for
985more details. Other loaders like appleloader, chainloader (BIOS, EFI, coreboot),
986freedos, ntldr and plan9 provide no possibility of loading initial ramdisk and
987as far as author is aware the payloads in question don't support either initial
988ramdisk or discovering loopback boot in other way and as such not bootable this
989way. Please consider alternative boot methods like copying all files
990from the image to actual partition. Consult your OS documentation for
991more details
992
993@node OS-specific notes
994@section Some caveats on OS-specific issues
995
996Here, we describe some caveats on several operating systems.
997
998@menu
999* GNU/Hurd::
1000* GNU/Linux::
1001* NetBSD::
1002* DOS/Windows::
1003@end menu
1004
1005
1006@node GNU/Hurd
1007@subsection GNU/Hurd
1008
1009Since GNU/Hurd is Multiboot-compliant, it is easy to boot it; there is
1010nothing special about it. But do not forget that you have to specify a
1011root partition to the kernel.
1012
1013@enumerate
1014@item
1015Set GRUB's root device to the same drive as GNU/Hurd's.  The command
1016@code{search --set=root --file /boot/gnumach.gz} or similar may help you
1017(@pxref{search}).
1018
1019@item
1020Load the kernel and the modules, like this:
1021
1022@example
1023@group
1024grub> @kbd{multiboot /boot/gnumach.gz root=device:hd0s1}
1025grub> @kbd{module  /hurd/ext2fs.static ext2fs --readonly \
1026                   --multiboot-command-line='$@{kernel-command-line@}' \
1027                   --host-priv-port='$@{host-port@}' \
1028                   --device-master-port='$@{device-port@}' \
1029                   --exec-server-task='$@{exec-task@}' -T typed '$@{root@}' \
1030                   '$(task-create)' '$(task-resume)'}
1031grub> @kbd{module /lib/ld.so.1 exec /hurd/exec '$(exec-task=task-create)'}
1032@end group
1033@end example
1034
1035@item
1036Finally, run the command @command{boot} (@pxref{boot}).
1037@end enumerate
1038
1039
1040@node GNU/Linux
1041@subsection GNU/Linux
1042
1043It is relatively easy to boot GNU/Linux from GRUB, because it somewhat
1044resembles to boot a Multiboot-compliant OS.
1045
1046@enumerate
1047@item
1048Set GRUB's root device to the same drive as GNU/Linux's.  The command
1049@code{search --set=root --file /vmlinuz} or similar may help you
1050(@pxref{search}).
1051
1052@item
1053Load the kernel using the command @command{linux} (@pxref{linux}):
1054
1055@example
1056grub> @kbd{linux /vmlinuz root=/dev/sda1}
1057@end example
1058
1059If you need to specify some kernel parameters, just append them to the
1060command.  For example, to set @option{acpi} to @samp{off}, do this:
1061
1062@example
1063grub> @kbd{linux /vmlinuz root=/dev/sda1 acpi=off}
1064@end example
1065
1066See the documentation in the Linux source tree for complete information on
1067the available options.
1068
1069With @command{linux} GRUB uses 32-bit protocol. Some BIOS services like APM
1070or EDD aren't available with this protocol. In this case you need to use
1071@command{linux16}
1072
1073@example
1074grub> @kbd{linux16 /vmlinuz root=/dev/sda1 acpi=off}
1075@end example
1076
1077@item
1078If you use an initrd, execute the command @command{initrd} (@pxref{initrd})
1079after @command{linux}:
1080
1081@example
1082grub> @kbd{initrd /initrd}
1083@end example
1084
1085If you used @command{linux16} you need to use @command{initrd16}:
1086
1087@example
1088grub> @kbd{initrd16 /initrd}
1089@end example
1090
1091@item
1092Finally, run the command @command{boot} (@pxref{boot}).
1093@end enumerate
1094
1095@strong{Caution:} If you use an initrd and specify the @samp{mem=}
1096option to the kernel to let it use less than actual memory size, you
1097will also have to specify the same memory size to GRUB. To let GRUB know
1098the size, run the command @command{uppermem} @emph{before} loading the
1099kernel. @xref{uppermem}, for more information.
1100
1101
1102@node NetBSD
1103@subsection NetBSD
1104
1105Booting a NetBSD kernel from GRUB is also relatively easy: first set
1106GRUB's root device, then load the kernel and the modules, and finally
1107run @command{boot}.
1108
1109@enumerate
1110@item
1111Set GRUB's root device to the partition holding the NetBSD root file
1112system.  For a disk with a NetBSD disk label, this is usually the first
1113partition (a:).  In that case, and assuming that the partition is on the
1114first hard disk, set GRUB's root device as follows:
1115
1116@example
1117grub> @kbd{insmod part_bsd}
1118grub> @kbd{set root=(hd0,netbsd1)}
1119@end example
1120
1121For a disk with a GUID Partition Table (GPT), and assuming that the
1122NetBSD root partition is the third GPT partition, do this:
1123
1124@example
1125grub> @kbd{insmod part_gpt}
1126grub> @kbd{set root=(hd0,gpt3)}
1127@end example
1128
1129@item
1130Load the kernel using the command @command{knetbsd}:
1131
1132@example
1133grub> @kbd{knetbsd /netbsd}
1134@end example
1135
1136Various options may be given to @command{knetbsd}.  These options are,
1137for the most part, the same as in the NetBSD boot loader.  For instance,
1138to boot the system in single-user mode and with verbose messages, do
1139this:
1140
1141@example
1142grub> @kbd{knetbsd /netbsd -s -v}
1143@end example
1144
1145@item
1146If needed, load kernel modules with the command
1147@command{knetbsd_module_elf}.  A typical example is the module for the
1148root file system:
1149
1150@example
1151grub> @kbd{knetbsd_module_elf /stand/amd64/6.0/modules/ffs/ffs.kmod}
1152@end example
1153
1154@item
1155Finally, run the command @command{boot} (@pxref{boot}).
1156@end enumerate
1157
1158
1159@node DOS/Windows
1160@subsection DOS/Windows
1161
1162GRUB cannot boot DOS or Windows directly, so you must chain-load them
1163(@pxref{Chain-loading}). However, their boot loaders have some critical
1164deficiencies, so it may not work to just chain-load them. To overcome
1165the problems, GRUB provides you with two helper functions.
1166
1167If you have installed DOS (or Windows) on a non-first hard disk, you
1168have to use the disk swapping technique, because that OS cannot boot
1169from any disks but the first one. The workaround used in GRUB is the
1170command @command{drivemap} (@pxref{drivemap}), like this:
1171
1172@example
1173drivemap -s (hd0) (hd1)
1174@end example
1175
1176This performs a @dfn{virtual} swap between your first and second hard
1177drive.
1178
1179@strong{Caution:} This is effective only if DOS (or Windows) uses BIOS
1180to access the swapped disks. If that OS uses a special driver for the
1181disks, this probably won't work.
1182
1183Another problem arises if you installed more than one set of DOS/Windows
1184onto one disk, because they could be confused if there are more than one
1185primary partitions for DOS/Windows. Certainly you should avoid doing
1186this, but there is a solution if you do want to do so. Use the partition
1187hiding/unhiding technique.
1188
1189If GRUB @dfn{hides} a DOS (or Windows) partition (@pxref{parttool}), DOS (or
1190Windows) will ignore the partition. If GRUB @dfn{unhides} a DOS (or Windows)
1191partition, DOS (or Windows) will detect the partition. Thus, if you have
1192installed DOS (or Windows) on the first and the second partition of the
1193first hard disk, and you want to boot the copy on the first partition, do
1194the following:
1195
1196@example
1197@group
1198parttool (hd0,1) hidden-
1199parttool (hd0,2) hidden+
1200set root=(hd0,1)
1201chainloader +1
1202parttool @verb{'${root}'} boot+
1203boot
1204@end group
1205@end example
1206
1207
1208@node Configuration
1209@chapter Writing your own configuration file
1210
1211GRUB is configured using @file{grub.cfg}, usually located under
1212@file{/boot/grub}.  This file is quite flexible, but most users will not
1213need to write the whole thing by hand.
1214
1215@menu
1216* Simple configuration::        Recommended for most users
1217* Shell-like scripting::        For power users and developers
1218* Multi-boot manual config::    For non-standard multi-OS scenarios
1219* Embedded configuration::      Embedding a configuration file into GRUB
1220@end menu
1221
1222
1223@node Simple configuration
1224@section Simple configuration handling
1225
1226The program @command{grub-mkconfig} (@pxref{Invoking grub-mkconfig})
1227generates @file{grub.cfg} files suitable for most cases.  It is suitable for
1228use when upgrading a distribution, and will discover available kernels and
1229attempt to generate menu entries for them.
1230
1231@command{grub-mkconfig} does have some limitations.  While adding extra
1232custom menu entries to the end of the list can be done by editing
1233@file{/etc/grub.d/40_custom} or creating @file{/boot/grub/custom.cfg},
1234changing the order of menu entries or changing their titles may require
1235making complex changes to shell scripts stored in @file{/etc/grub.d/}.  This
1236may be improved in the future.  In the meantime, those who feel that it
1237would be easier to write @file{grub.cfg} directly are encouraged to do so
1238(@pxref{Booting}, and @ref{Shell-like scripting}), and to disable any system
1239provided by their distribution to automatically run @command{grub-mkconfig}.
1240
1241The file @file{/etc/default/grub} controls the operation of
1242@command{grub-mkconfig}.  It is sourced by a shell script, and so must be
1243valid POSIX shell input; normally, it will just be a sequence of
1244@samp{KEY=value} lines, but if the value contains spaces or other special
1245characters then it must be quoted.  For example:
1246
1247@example
1248GRUB_TERMINAL_INPUT="console serial"
1249@end example
1250
1251Valid keys in @file{/etc/default/grub} are as follows:
1252
1253@table @samp
1254@item GRUB_DEFAULT
1255The default menu entry.  This may be a number, in which case it identifies
1256the Nth entry in the generated menu counted from zero, or the title of a
1257menu entry, or the special string @samp{saved}.  Using the id may be
1258useful if you want to set a menu entry as the default even though there may
1259be a variable number of entries before it.
1260
1261For example, if you have:
1262
1263@verbatim
1264menuentry 'Example GNU/Linux distribution' --class gnu-linux --id example-gnu-linux {
1265        ...
1266}
1267@end verbatim
1268
1269then you can make this the default using:
1270
1271@example
1272GRUB_DEFAULT=example-gnu-linux
1273@end example
1274
1275Previously it was documented the way to use entry title. While this still
1276works it's not recommended since titles often contain unstable device names
1277and may be translated
1278
1279If you set this to @samp{saved}, then the default menu entry will be that
1280saved by @samp{GRUB_SAVEDEFAULT} or @command{grub-set-default}.  This relies on
1281the environment block, which may not be available in all situations
1282(@pxref{Environment block}).
1283
1284The default is @samp{0}.
1285
1286@item GRUB_SAVEDEFAULT
1287If this option is set to @samp{true}, then, when an entry is selected, save
1288it as a new default entry for use by future runs of GRUB.  This is only
1289useful if @samp{GRUB_DEFAULT=saved}; it is a separate option because
1290@samp{GRUB_DEFAULT=saved} is useful without this option, in conjunction with
1291@command{grub-set-default}.  Unset by default.
1292This option relies on the environment block, which may not be available in
1293all situations (@pxref{Environment block}).
1294
1295@item GRUB_TIMEOUT
1296Boot the default entry this many seconds after the menu is displayed, unless
1297a key is pressed.  The default is @samp{5}.  Set to @samp{0} to boot
1298immediately without displaying the menu, or to @samp{-1} to wait
1299indefinitely.
1300
1301If @samp{GRUB_TIMEOUT_STYLE} is set to @samp{countdown} or @samp{hidden},
1302the timeout is instead counted before the menu is displayed.
1303
1304@item GRUB_TIMEOUT_STYLE
1305If this option is unset or set to @samp{menu}, then GRUB will display the
1306menu and then wait for the timeout set by @samp{GRUB_TIMEOUT} to expire
1307before booting the default entry.  Pressing a key interrupts the timeout.
1308
1309If this option is set to @samp{countdown} or @samp{hidden}, then, before
1310displaying the menu, GRUB will wait for the timeout set by
1311@samp{GRUB_TIMEOUT} to expire.  If @key{ESC} is pressed during that time, it
1312will display the menu and wait for input.  If a hotkey associated with a
1313menu entry is pressed, it will boot the associated menu entry immediately.
1314If the timeout expires before either of these happens, it will boot the
1315default entry.  In the @samp{countdown} case, it will show a one-line
1316indication of the remaining time.
1317
1318@item GRUB_DEFAULT_BUTTON
1319@itemx GRUB_TIMEOUT_BUTTON
1320@itemx GRUB_TIMEOUT_STYLE_BUTTON
1321@itemx GRUB_BUTTON_CMOS_ADDRESS
1322Variants of the corresponding variables without the @samp{_BUTTON} suffix,
1323used to support vendor-specific power buttons.  @xref{Vendor power-on keys}.
1324
1325@item GRUB_DISTRIBUTOR
1326Set by distributors of GRUB to their identifying name.  This is used to
1327generate more informative menu entry titles.
1328
1329@item GRUB_TERMINAL_INPUT
1330Select the terminal input device.  You may select multiple devices here,
1331separated by spaces.
1332
1333Valid terminal input names depend on the platform, but may include
1334@samp{console} (native platform console), @samp{serial} (serial terminal),
1335@samp{serial_<port>} (serial terminal with explicit port selection),
1336@samp{at_keyboard} (PC AT keyboard), or @samp{usb_keyboard} (USB keyboard
1337using the HID Boot Protocol, for cases where the firmware does not handle
1338this).
1339
1340The default is to use the platform's native terminal input.
1341
1342@item GRUB_TERMINAL_OUTPUT
1343Select the terminal output device.  You may select multiple devices here,
1344separated by spaces.
1345
1346Valid terminal output names depend on the platform, but may include
1347@samp{console} (native platform console), @samp{serial} (serial terminal),
1348@samp{serial_<port>} (serial terminal with explicit port selection),
1349@samp{gfxterm} (graphics-mode output), @samp{vga_text} (VGA text output),
1350@samp{mda_text} (MDA text output), @samp{morse} (Morse-coding using system
1351beeper) or @samp{spkmodem} (simple data protocol using system speaker).
1352
1353@samp{spkmodem} is useful when no serial port is available. Connect the output
1354of sending system (where GRUB is running) to line-in of receiving system
1355(usually developer machine).
1356On receiving system compile @samp{spkmodem-recv} from
1357@samp{util/spkmodem-recv.c} and run:
1358
1359@example
1360parecord --channels=1 --rate=48000 --format=s16le | ./spkmodem-recv
1361@end example
1362
1363The default is to use the platform's native terminal output.
1364
1365@item GRUB_TERMINAL
1366If this option is set, it overrides both @samp{GRUB_TERMINAL_INPUT} and
1367@samp{GRUB_TERMINAL_OUTPUT} to the same value.
1368
1369@item GRUB_SERIAL_COMMAND
1370A command to configure the serial port when using the serial console.
1371@xref{serial}.  Defaults to @samp{serial}.
1372
1373@item GRUB_CMDLINE_LINUX
1374Command-line arguments to add to menu entries for the Linux kernel.
1375
1376@item GRUB_CMDLINE_LINUX_DEFAULT
1377Unless @samp{GRUB_DISABLE_RECOVERY} is set to @samp{true}, two menu
1378entries will be generated for each Linux kernel: one default entry and one
1379entry for recovery mode.  This option lists command-line arguments to add
1380only to the default menu entry, after those listed in
1381@samp{GRUB_CMDLINE_LINUX}.
1382
1383@item GRUB_CMDLINE_NETBSD
1384@itemx GRUB_CMDLINE_NETBSD_DEFAULT
1385As @samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT}, but for
1386NetBSD.
1387
1388@item GRUB_CMDLINE_GNUMACH
1389As @samp{GRUB_CMDLINE_LINUX}, but for GNU Mach.
1390
1391@item GRUB_CMDLINE_XEN
1392@itemx GRUB_CMDLINE_XEN_DEFAULT
1393The values of these options are passed to Xen hypervisor Xen menu entries,
1394for all respectively normal entries.
1395
1396@item GRUB_CMDLINE_LINUX_XEN_REPLACE
1397@item GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT
1398The values of these options replace the values of @samp{GRUB_CMDLINE_LINUX}
1399and @samp{GRUB_CMDLINE_LINUX_DEFAULT} for Linux and Xen menu entries.
1400
1401@item GRUB_DISABLE_LINUX_UUID
1402Normally, @command{grub-mkconfig} will generate menu entries that use
1403universally-unique identifiers (UUIDs) to identify the root filesystem to
1404the Linux kernel, using a @samp{root=UUID=...} kernel parameter.  This is
1405usually more reliable, but in some cases it may not be appropriate.  To
1406disable the use of UUIDs, set this option to @samp{true}.
1407
1408@item GRUB_DISABLE_RECOVERY
1409If this option is set to @samp{true}, disable the generation of recovery
1410mode menu entries.
1411
1412@item GRUB_VIDEO_BACKEND
1413If graphical video support is required, either because the @samp{gfxterm}
1414graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set,
1415then @command{grub-mkconfig} will normally load all available GRUB video
1416drivers and use the one most appropriate for your hardware.  If you need to
1417override this for some reason, then you can set this option.
1418
1419After @command{grub-install} has been run, the available video drivers are
1420listed in @file{/boot/grub/video.lst}.
1421
1422@item GRUB_GFXMODE
1423Set the resolution used on the @samp{gfxterm} graphical terminal.  Note that
1424you can only use modes which your graphics card supports via VESA BIOS
1425Extensions (VBE), so for example native LCD panel resolutions may not be
1426available.  The default is @samp{auto}, which tries to select a preferred
1427resolution.  @xref{gfxmode}.
1428
1429@item GRUB_BACKGROUND
1430Set a background image for use with the @samp{gfxterm} graphical terminal.
1431The value of this option must be a file readable by GRUB at boot time, and
1432it must end with @file{.png}, @file{.tga}, @file{.jpg}, or @file{.jpeg}.
1433The image will be scaled if necessary to fit the screen.
1434
1435@item GRUB_THEME
1436Set a theme for use with the @samp{gfxterm} graphical terminal.
1437
1438@item GRUB_GFXPAYLOAD_LINUX
1439Set to @samp{text} to force the Linux kernel to boot in normal text mode,
1440@samp{keep} to preserve the graphics mode set using @samp{GRUB_GFXMODE},
1441@samp{@var{width}x@var{height}}[@samp{x@var{depth}}] to set a particular
1442graphics mode, or a sequence of these separated by commas or semicolons to
1443try several modes in sequence.  @xref{gfxpayload}.
1444
1445Depending on your kernel, your distribution, your graphics card, and the
1446phase of the moon, note that using this option may cause GNU/Linux to suffer
1447from various display problems, particularly during the early part of the
1448boot sequence.  If you have problems, set this option to @samp{text} and
1449GRUB will tell Linux to boot in normal text mode.
1450
1451@item GRUB_DISABLE_OS_PROBER
1452Normally, @command{grub-mkconfig} will try to use the external
1453@command{os-prober} program, if installed, to discover other operating
1454systems installed on the same system and generate appropriate menu entries
1455for them.  Set this option to @samp{true} to disable this.
1456
1457@item GRUB_OS_PROBER_SKIP_LIST
1458List of space-separated FS UUIDs of filesystems to be ignored from os-prober
1459output. For efi chainloaders it's <UUID>@@<EFI FILE>
1460
1461@item GRUB_DISABLE_SUBMENU
1462Normally, @command{grub-mkconfig} will generate top level menu entry for
1463the kernel with highest version number and put all other found kernels
1464or alternative menu entries for recovery mode in submenu. For entries returned
1465by @command{os-prober} first entry will be put on top level and all others
1466in submenu. If this option is set to @samp{y}, flat menu with all entries
1467on top level will be generated instead. Changing this option will require
1468changing existing values of @samp{GRUB_DEFAULT}, @samp{fallback} (@pxref{fallback})
1469and @samp{default} (@pxref{default}) environment variables as well as saved
1470default entry using @command{grub-set-default} and value used with
1471@command{grub-reboot}.
1472
1473@item GRUB_ENABLE_CRYPTODISK
1474If set to @samp{y}, @command{grub-mkconfig} and @command{grub-install} will
1475check for encrypted disks and generate additional commands needed to access
1476them during boot.  Note that in this case unattended boot is not possible
1477because GRUB will wait for passphrase to unlock encrypted container.
1478
1479@item GRUB_INIT_TUNE
1480Play a tune on the speaker when GRUB starts.  This is particularly useful
1481for users unable to see the screen.  The value of this option is passed
1482directly to @ref{play}.
1483
1484@item GRUB_BADRAM
1485If this option is set, GRUB will issue a @ref{badram} command to filter
1486out specified regions of RAM.
1487
1488@item GRUB_PRELOAD_MODULES
1489This option may be set to a list of GRUB module names separated by spaces.
1490Each module will be loaded as early as possible, at the start of
1491@file{grub.cfg}.
1492
1493@item GRUB_RECORDFAIL_TIMEOUT
1494If this option is set, it overrides the default recordfail setting.  A
1495setting of -1 causes GRUB to wait for user input indefinitely.  However, a
1496false positive in the recordfail mechanism may occur if power is lost during
1497boot before boot success is recorded in userspace.  The default setting is
149830, which causes GRUB to wait for user input for thirty seconds before
1499continuing.  This default allows interactive users the opportunity to switch
1500to a different, working kernel, while avoiding a false positive causing the
1501boot to block indefinitely on headless and appliance systems where access to
1502a console is restricted or limited.
1503
1504This option is only effective when GRUB was configured with the
1505@option{--enable-quick-boot} option.
1506
1507@item GRUB_RECOVERY_TITLE
1508This option sets the English text of the string that will be displayed in
1509parentheses to indicate that a boot option is provided to help users recover
1510a broken system.  The default is "recovery mode".
1511
1512@end table
1513
1514The following options are still accepted for compatibility with existing
1515configurations, but have better replacements:
1516
1517@table @samp
1518@item GRUB_HIDDEN_TIMEOUT
1519Wait this many seconds before displaying the menu.  If @key{ESC} is pressed
1520during that time, display the menu and wait for input according to
1521@samp{GRUB_TIMEOUT}.  If a hotkey associated with a menu entry is pressed,
1522boot the associated menu entry immediately.  If the timeout expires before
1523either of these happens, display the menu for the number of seconds
1524specified in @samp{GRUB_TIMEOUT} before booting the default entry.
1525
1526If you set @samp{GRUB_HIDDEN_TIMEOUT}, you should also set
1527@samp{GRUB_TIMEOUT=0} so that the menu is not displayed at all unless
1528@key{ESC} is pressed.
1529
1530This option is unset by default, and is deprecated in favour of the less
1531confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or
1532@samp{GRUB_TIMEOUT_STYLE=hidden}.
1533
1534@item GRUB_HIDDEN_TIMEOUT_QUIET
1535In conjunction with @samp{GRUB_HIDDEN_TIMEOUT}, set this to @samp{true} to
1536suppress the verbose countdown while waiting for a key to be pressed before
1537displaying the menu.
1538
1539This option is unset by default, and is deprecated in favour of the less
1540confusing @samp{GRUB_TIMEOUT_STYLE=countdown}.
1541
1542@item GRUB_HIDDEN_TIMEOUT_BUTTON
1543Variant of @samp{GRUB_HIDDEN_TIMEOUT}, used to support vendor-specific power
1544buttons.  @xref{Vendor power-on keys}.
1545
1546This option is unset by default, and is deprecated in favour of the less
1547confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or
1548@samp{GRUB_TIMEOUT_STYLE=hidden}.
1549
1550@end table
1551
1552For more detailed customisation of @command{grub-mkconfig}'s output, you may
1553edit the scripts in @file{/etc/grub.d} directly.
1554@file{/etc/grub.d/40_custom} is particularly useful for adding entire custom
1555menu entries; simply type the menu entries you want to add at the end of
1556that file, making sure to leave at least the first two lines intact.
1557
1558
1559@node Shell-like scripting
1560@section Writing full configuration files directly
1561
1562@c Some of this section is derived from the GNU Bash manual page, also
1563@c copyrighted by the FSF.
1564
1565@file{grub.cfg} is written in GRUB's built-in scripting language, which has
1566a syntax quite similar to that of GNU Bash and other Bourne shell
1567derivatives.
1568
1569@heading Words
1570
1571A @dfn{word} is a sequence of characters considered as a single unit by
1572GRUB.  Words are separated by @dfn{metacharacters}, which are the following
1573plus space, tab, and newline:
1574
1575@example
1576@{ @} | & $ ; < >
1577@end example
1578 
1579Quoting may be used to include metacharacters in words; see below.
1580
1581@heading Reserved words
1582
1583Reserved words have a special meaning to GRUB.  The following words are
1584recognised as reserved when unquoted and either the first word of a simple
1585command or the third word of a @code{for} command:
1586
1587@example
1588! [[ ]] @{ @}
1589case do done elif else esac fi for function
1590if in menuentry select then time until while
1591@end example
1592
1593Not all of these reserved words have a useful purpose yet; some are reserved
1594for future expansion.
1595
1596@heading Quoting
1597
1598Quoting is used to remove the special meaning of certain characters or
1599words.  It can be used to treat metacharacters as part of a word, to prevent
1600reserved words from being recognised as such, and to prevent variable
1601expansion.
1602
1603There are three quoting mechanisms: the escape character, single quotes, and
1604double quotes.
1605
1606A non-quoted backslash (\) is the @dfn{escape character}.  It preserves the
1607literal value of the next character that follows, with the exception of
1608newline.
1609
1610Enclosing characters in single quotes preserves the literal value of each
1611character within the quotes.  A single quote may not occur between single
1612quotes, even when preceded by a backslash.
1613
1614Enclosing characters in double quotes preserves the literal value of all
1615characters within the quotes, with the exception of @samp{$} and @samp{\}.
1616The @samp{$} character retains its special meaning within double quotes.
1617The backslash retains its special meaning only when followed by one of the
1618following characters: @samp{$}, @samp{"}, @samp{\}, or newline.  A
1619backslash-newline pair is treated as a line continuation (that is, it is
1620removed from the input stream and effectively ignored@footnote{Currently a
1621backslash-newline pair within a variable name is not handled properly, so
1622use this feature with some care.}).  A double quote may be quoted within
1623double quotes by preceding it with a backslash.
1624
1625@heading Variable expansion
1626
1627The @samp{$} character introduces variable expansion.  The variable name to
1628be expanded may be enclosed in braces, which are optional but serve to
1629protect the variable to be expanded from characters immediately following it
1630which could be interpreted as part of the name.
1631
1632Normal variable names begin with an alphabetic character, followed by zero
1633or more alphanumeric characters.  These names refer to entries in the GRUB
1634environment (@pxref{Environment}).
1635
1636Positional variable names consist of one or more digits.  They represent
1637parameters passed to function calls, with @samp{$1} representing the first
1638parameter, and so on.
1639
1640The special variable name @samp{?} expands to the exit status of the most
1641recently executed command.  When positional variable names are active, other
1642special variable names @samp{@@}, @samp{*} and @samp{#} are defined and they
1643expand to all positional parameters with necessary quoting, positional
1644parameters without any quoting, and positional parameter count respectively.
1645
1646@heading Comments
1647
1648A word beginning with @samp{#} causes that word and all remaining characters
1649on that line to be ignored.
1650
1651@heading Simple commands
1652
1653A @dfn{simple command} is a sequence of words separated by spaces or tabs
1654and terminated by a semicolon or a newline.  The first word specifies the
1655command to be executed.  The remaining words are passed as arguments to the
1656invoked command.
1657
1658The return value of a simple command is its exit status.  If the reserved
1659word @code{!} precedes the command, then the return value is instead the
1660logical negation of the command's exit status.
1661
1662@heading Compound commands
1663
1664A @dfn{compound command} is one of the following:
1665
1666@table @asis
1667@item for @var{name} in @var{word} @dots{}; do @var{list}; done
1668The list of words following @code{in} is expanded, generating a list of
1669items.  The variable @var{name} is set to each element of this list in turn,
1670and @var{list} is executed each time.  The return value is the exit status
1671of the last command that executes.  If the expansion of the items following
1672@code{in} results in an empty list, no commands are executed, and the return
1673status is 0.
1674
1675@item if @var{list}; then @var{list}; [elif @var{list}; then @var{list};] @dots{} [else @var{list};] fi
1676The @code{if} @var{list} is executed.  If its exit status is zero, the
1677@code{then} @var{list} is executed.  Otherwise, each @code{elif} @var{list}
1678is executed in turn, and if its exit status is zero, the corresponding
1679@code{then} @var{list} is executed and the command completes.  Otherwise,
1680the @code{else} @var{list} is executed, if present.  The exit status is the
1681exit status of the last command executed, or zero if no condition tested
1682true.
1683
1684@item while @var{cond}; do @var{list}; done
1685@itemx until @var{cond}; do @var{list}; done
1686The @code{while} command continuously executes the @code{do} @var{list} as
1687long as the last command in @var{cond} returns an exit status of zero.  The
1688@code{until} command is identical to the @code{while} command, except that
1689the test is negated; the @code{do} @var{list} is executed as long as the
1690last command in @var{cond} returns a non-zero exit status.  The exit status
1691of the @code{while} and @code{until} commands is the exit status of the last
1692@code{do} @var{list} command executed, or zero if none was executed.
1693
1694@item function @var{name} @{ @var{command}; @dots{} @}
1695This defines a function named @var{name}.  The @dfn{body} of the function is
1696the list of commands within braces, each of which must be terminated with a
1697semicolon or a newline.  This list of commands will be executed whenever
1698@var{name} is specified as the name of a simple command.  Function
1699definitions do not affect the exit status in @code{$?}.  When executed, the
1700exit status of a function is the exit status of the last command executed in
1701the body.
1702
1703@item menuentry @var{title} [@option{--class=class} @dots{}] [@option{--users=users}] [@option{--unrestricted}] [@option{--hotkey=key}] [@option{--id=id}] @{ @var{command}; @dots{} @}
1704@xref{menuentry}.
1705@end table
1706
1707@heading Built-in Commands
1708
1709Some built-in commands are also provided by GRUB script to help script
1710writers perform actions that are otherwise not possible.  For example, these
1711include commands to jump out of a loop without fully completing it, etc.
1712
1713@table @asis
1714@item break [@code{n}]
1715Exit from within a @code{for}, @code{while}, or @code{until} loop.  If
1716@code{n} is specified, break @code{n} levels.  @code{n} must be greater than
1717or equal to 1.  If @code{n} is greater than the number of enclosing loops,
1718all enclosing loops are exited.  The return value is 0 unless @code{n} is
1719not greater than or equal to 1.
1720
1721@item continue [@code{n}]
1722Resume the next iteration of the enclosing @code{for}, @code{while} or
1723@code{until} loop.  If @code{n} is specified, resume at the @code{n}th
1724enclosing loop.  @code{n} must be greater than or equal to 1.  If @code{n}
1725is greater than the number of enclosing loops, the last enclosing loop (the
1726@dfn{top-level} loop) is resumed.  The return value is 0 unless @code{n} is
1727not greater than or equal to 1.
1728
1729@item return [@code{n}]
1730Causes a function to exit with the return value specified by @code{n}.  If
1731@code{n} is omitted, the return status is that of the last command executed
1732in the function body.  If used outside a function the return status is
1733false.
1734
1735@item setparams [@code{arg}] @dots{}
1736Replace positional parameters starting with @code{$1} with arguments to
1737@command{setparams}.
1738
1739@item shift [@code{n}]
1740The positional parameters from @code{n}+1 @dots{} are renamed to
1741@code{$1}@dots{}.  Parameters represented by the numbers @code{$#} down to
1742@code{$#}-@code{n}+1 are unset.  @code{n} must be a non-negative number less
1743than or equal to @code{$#}.  If @code{n} is 0, no parameters are changed.
1744If @code{n} is not given, it is assumed to be 1.  If @code{n} is greater
1745than @code{$#}, the positional parameters are not changed.  The return
1746status is greater than zero if @code{n} is greater than @code{$#} or less
1747than zero; otherwise 0.
1748
1749@end table
1750
1751@node Multi-boot manual config
1752@section Multi-boot manual config
1753
1754Currently autogenerating config files for multi-boot environments depends on
1755os-prober and has several shortcomings. While fixing it is scheduled for the
1756next release, meanwhile you can make use of the power of GRUB syntax and do it
1757yourself. A possible configuration is detailed here, feel free to adjust to your
1758needs.
1759
1760First create a separate GRUB partition, big enough to hold GRUB. Some of the
1761following entries show how to load OS installer images from this same partition,
1762for that you obviously need to make the partition large enough to hold those
1763images as well.
1764Mount this partition on/mnt/boot and disable GRUB in all OSes and manually
1765install self-compiled latest GRUB with:
1766
1767@code{grub-install --boot-directory=/mnt/boot /dev/sda}
1768
1769In all the OSes install GRUB tools but disable installing GRUB in bootsector,
1770so you'll have menu.lst and grub.cfg available for use. Also disable os-prober
1771use by setting:
1772
1773@code{GRUB_DISABLE_OS_PROBER=true}
1774
1775in /etc/default/grub
1776
1777Then write a grub.cfg (/mnt/boot/grub/grub.cfg):
1778
1779@example
1780
1781menuentry "OS using grub2" @{
1782   insmod xfs
1783   search --set=root --label OS1 --hint hd0,msdos8
1784   configfile /boot/grub/grub.cfg
1785@}
1786
1787menuentry "OS using grub2-legacy" @{
1788   insmod ext2
1789   search --set=root --label OS2 --hint hd0,msdos6
1790   legacy_configfile /boot/grub/menu.lst
1791@}
1792
1793menuentry "Windows XP" @{
1794   insmod ntfs
1795   search --set=root --label WINDOWS_XP --hint hd0,msdos1
1796   ntldr /ntldr
1797@}
1798
1799menuentry "Windows 7" @{
1800   insmod ntfs
1801   search --set=root --label WINDOWS_7 --hint hd0,msdos2
1802   ntldr /bootmgr
1803@}
1804
1805menuentry "FreeBSD" @{
1806          insmod zfs
1807          search --set=root --label freepool --hint hd0,msdos7
1808          kfreebsd /freebsd@@/boot/kernel/kernel
1809          kfreebsd_module_elf /freebsd@@/boot/kernel/opensolaris.ko
1810          kfreebsd_module_elf /freebsd@@/boot/kernel/zfs.ko
1811          kfreebsd_module /freebsd@@/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache
1812          set kFreeBSD.vfs.root.mountfrom=zfs:freepool/freebsd
1813          set kFreeBSD.hw.psm.synaptics_support=1
1814@}
1815
1816menuentry "experimental GRUB" @{
1817          search --set=root --label GRUB --hint hd0,msdos5
1818          multiboot /experimental/grub/i386-pc/core.img
1819@}
1820
1821menuentry "Fedora 16 installer" @{
1822          search --set=root --label GRUB --hint hd0,msdos5
1823          linux /fedora/vmlinuz lang=en_US keymap=sg resolution=1280x800
1824          initrd /fedora/initrd.img
1825@}
1826
1827menuentry "Fedora rawhide installer" @{
1828          search --set=root --label GRUB --hint hd0,msdos5
1829          linux /fedora/vmlinuz repo=ftp://mirror.switch.ch/mirror/fedora/linux/development/rawhide/x86_64 lang=en_US keymap=sg resolution=1280x800
1830          initrd /fedora/initrd.img
1831@}
1832
1833menuentry "Debian sid installer" @{
1834          search --set=root --label GRUB --hint hd0,msdos5
1835          linux /debian/dists/sid/main/installer-amd64/current/images/hd-media/vmlinuz
1836          initrd /debian/dists/sid/main/installer-amd64/current/images/hd-media/initrd.gz
1837@}
1838
1839@end example
1840
1841Notes:
1842@itemize
1843@item Argument to search after --label is FS LABEL. You can also use UUIDs with --fs-uuid UUID instead of --label LABEL. You could also use direct @code{root=hd0,msdosX} but this is not recommended due to device name instability.
1844@end itemize
1845
1846@node Embedded configuration
1847@section Embedding a configuration file into GRUB
1848
1849GRUB supports embedding a configuration file directly into the core image,
1850so that it is loaded before entering normal mode.  This is useful, for
1851example, when it is not straightforward to find the real configuration file,
1852or when you need to debug problems with loading that file.
1853@command{grub-install} uses this feature when it is not using BIOS disk
1854functions or when installing to a different disk from the one containing
1855@file{/boot/grub}, in which case it needs to use the @command{search}
1856command (@pxref{search}) to find @file{/boot/grub}.
1857
1858To embed a configuration file, use the @option{-c} option to
1859@command{grub-mkimage}.  The file is copied into the core image, so it may
1860reside anywhere on the file system, and may be removed after running
1861@command{grub-mkimage}.
1862
1863After the embedded configuration file (if any) is executed, GRUB will load
1864the @samp{normal} module (@pxref{normal}), which will then read the real
1865configuration file from @file{$prefix/grub.cfg}.  By this point, the
1866@code{root} variable will also have been set to the root device name.  For
1867example, @code{prefix} might be set to @samp{(hd0,1)/boot/grub}, and
1868@code{root} might be set to @samp{hd0,1}.  Thus, in most cases, the embedded
1869configuration file only needs to set the @code{prefix} and @code{root}
1870variables, and then drop through to GRUB's normal processing.  A typical
1871example of this might look like this:
1872
1873@example
1874@group
1875search.fs_uuid 01234567-89ab-cdef-0123-456789abcdef root
1876set prefix=($root)/boot/grub
1877@end group
1878@end example
1879
1880(The @samp{search_fs_uuid} module must be included in the core image for this
1881example to work.)
1882
1883In more complex cases, it may be useful to read other configuration files
1884directly from the embedded configuration file.  This allows such things as
1885reading files not called @file{grub.cfg}, or reading files from a directory
1886other than that where GRUB's loadable modules are installed.  To do this,
1887include the @samp{configfile} and @samp{normal} modules in the core image,
1888and embed a configuration file that uses the @command{configfile} command to
1889load another file.  The following example of this also requires the
1890@command{echo}, @command{search_label}, and @command{test} modules to be
1891included in the core image:
1892
1893@example
1894@group
1895search.fs_label grub root
1896if [ -e /boot/grub/example/test1.cfg ]; then
1897    set prefix=($root)/boot/grub
1898    configfile /boot/grub/example/test1.cfg
1899else
1900    if [ -e /boot/grub/example/test2.cfg ]; then
1901        set prefix=($root)/boot/grub
1902        configfile /boot/grub/example/test2.cfg
1903    else
1904        echo "Could not find an example configuration file!"
1905    fi
1906fi
1907@end group
1908@end example
1909
1910The embedded configuration file may not contain menu entries directly, but
1911may only read them from elsewhere using @command{configfile}.
1912
1913@node Theme file format
1914@chapter Theme file format
1915@section Introduction
1916The GRUB graphical menu supports themes that can customize the layout and
1917appearance of the GRUB boot menu.  The theme is configured through a plain
1918text file that specifies the layout of the various GUI components (including
1919the boot menu, timeout progress bar, and text messages) as well as the
1920appearance using colors, fonts, and images. Example is available in docs/example_theme.txt
1921
1922@section Theme Elements
1923@subsection Colors
1924
1925Colors can be specified in several ways:
1926
1927@itemize
1928@item HTML-style ``#RRGGBB'' or ``#RGB'' format, where *R*, *G*, and *B* are hexadecimal digits (e.g., ``#8899FF'')
1929@item as comma-separated decimal RGB values (e.g., ``128, 128, 255'')
1930@item with ``SVG 1.0 color names'' (e.g., ``cornflowerblue'') which must be specified in lowercase.
1931@end itemize
1932@subsection Fonts
1933The fonts GRUB uses ``PFF2 font format'' bitmap fonts.  Fonts are specified
1934with full font names.  Currently there is no
1935provision for a preference list of fonts, or deriving one font from another.
1936Fonts are loaded with the ``loadfont'' command in GRUB (@ref{loadfont}).  To see the list of
1937loaded fonts, execute the ``lsfonts'' command (@ref{lsfonts}).  If there are too many fonts to
1938fit on screen, do ``set pager=1'' before executing ``lsfonts''.
1939
1940
1941@subsection Progress Bar
1942
1943@float Figure, Pixmap-styled progress bar
1944@c @image{Theme_progress_bar,,,,png}
1945@end float
1946
1947@float Figure, Plain progress bar, drawn with solid color.
1948@c @image{Theme_progress_bar_filled,,,,png}
1949@end float
1950
1951Progress bars are used to display the remaining time before GRUB boots the
1952default menu entry.  To create a progress bar that will display the remaining
1953time before automatic boot, simply create a ``progress_bar'' component with
1954the id ``__timeout__''.  This indicates to GRUB that the progress bar should
1955be updated as time passes, and it should be made invisible if the countdown to
1956automatic boot is interrupted by the user.
1957
1958Progress bars may optionally have text displayed on them.  This text is
1959controlled by variable ``text'' which contains a printf template with the
1960only argument %d is the number of seconds remaining. Additionally special
1961values ``@@TIMEOUT_NOTIFICATION_SHORT@@'', ``@@TIMEOUT_NOTIFICATION_MIDDLE@@'',
1962``@@TIMEOUT_NOTIFICATION_LONG@@'' are replaced with standard and translated
1963templates.
1964
1965@subsection Circular Progress Indicator
1966
1967@c @image{Theme_circular_progress,,,,.png}
1968
1969The circular progress indicator functions similarly to the progress bar.  When
1970given an id of ``__timeout__'', GRUB updates the circular progress indicator's
1971value to indicate the time remaining.  For the circular progress indicator,
1972there are two images used to render it:  the *center* image, and the *tick*
1973image.  The center image is rendered in the center of the component, while the
1974tick image is used to render each mark along the circumference of the
1975indicator.
1976
1977
1978@subsection Labels
1979
1980Text labels can be placed on the boot screen.  The font, color, and horizontal
1981alignment can be specified for labels.  If a label is given the id
1982``__timeout__'', then the ``text'' property for that label is also updated
1983with a message informing the user of the number of seconds remaining until
1984automatic boot.  This is useful in case you want the text displayed somewhere
1985else instead of directly on the progress bar.
1986
1987
1988@subsection Boot Menu
1989
1990@c @image{Theme_boot_menu,,,,.png}
1991
1992The boot menu where GRUB displays the menu entries from the ``grub.cfg'' file.
1993It is a list of items, where each item has a title and an optional icon.  The
1994icon is selected based on the *classes* specified for the menu entry.  If
1995there is a PNG file named ``myclass.png'' in the ``grub/themes/icons''
1996directory, it will be displayed for items which have the class *myclass*.  The
1997boot menu can be customized in several ways, such as the font and color used
1998for the menu entry title, and by specifying styled boxes for the menu itself
1999and for the selected item highlight.
2000
2001
2002@subsection Styled Boxes
2003
2004One of the most important features for customizing the layout is the use of
2005 *styled boxes*.  A styled box is composed of 9 rectangular (and potentially
2006empty) regions, which are used to seamlessly draw the styled box on screen:
2007
2008@multitable @columnfractions 0.3 0.3 0.3
2009@item Northwest (nw) @tab North (n)  @tab Northeast (ne)
2010@item West (w)       @tab Center (c) @tab East (e)
2011@item Southwest (sw) @tab South (s)  @tab Southeast (se)
2012@end multitable
2013
2014To support any size of box on screen, the center slice and the slices for the
2015top, bottom, and sides are all scaled to the correct size for the component on
2016screen, using the following rules:
2017
2018@enumerate
2019@item The edge slices (north, south, east, and west) are scaled in the direction of the edge they are adjacent to.  For instance, the west slice is scaled vertically.
2020@item The corner slices (northwest, northeast, southeast, and southwest) are not scaled.
2021@item The center slice is scaled to fill the remaining space in the middle.
2022@end enumerate
2023
2024As an example of how an image might be sliced up, consider the styled box
2025used for a terminal view.
2026
2027@float Figure, An example of the slices (in red) used for a terminal window. This drawing was created and sliced in Inkscape_, as the next section explains.
2028@c @image{Box_slice_example_terminal,,,,.png}
2029@end float
2030   
2031@subsection Creating Styled Box Images
2032
2033The Inkscape_ scalable vector graphics editor is a very useful tool for
2034creating styled box images.  One process that works well for slicing a drawing
2035into the necessary image slices is:
2036
2037@enumerate
2038@item Create or open the drawing you'd like use.
2039@item Create a new layer on the top of the layer stack.  Make it visible.  Select this layer as the current layer.
2040@item Draw 9 rectangles on your drawing where you'd like the slices to be.  Clear the fill option, and set the stroke to 1 pixel wide solid stroke.  The corners of the slices must meet precisely; if it is off by a single pixel, it will probably be evident when the styled box is rendered in the GRUB menu.  You should probably go to File | Document Properties | Grids and enable a grid or create a guide (click on one of the rulers next to the drawing and drag over the drawing; release the mouse button to place the guide) to help place the rectangles precisely.
2041@item Right click on the center slice rectangle and choose Object Properties. Change the "Id" to ``slice_c`` and click Set.  Repeat this for the remaining 8 rectangles, giving them Id values of ``slice_n``, ``slice_ne``, ``slice_e``, and so on according to the location.
2042@item Save the drawing.
2043@item Select all the slice rectangles.  With the slice layer selected, you can simply press Ctrl+A to select all rectangles.  The status bar should indicate that 9 rectangles are selected.
2044@item Click the layer hide icon for the slice layer in the layer palette.  The rectangles will remain selected, even though they are hidden.
2045@item Choose File | Export Bitmap and check the *Batch export 9 selected objects* box.  Make sure that *Hide all except selected* is unchecked. click *Export*.  This will create PNG files in the same directory as the drawing, named after the slices.  These can now be used for a styled box in a GRUB theme.
2046@end enumerate
2047
2048@section Theme File Manual
2049
2050The theme file is a plain text file.  Lines that begin with ``#`` are ignored
2051and considered comments.  (Note: This may not be the case if the previous line
2052ended where a value was expected.)
2053
2054The theme file contains two types of statements:
2055@enumerate
2056@item Global properties.
2057@item Component construction.
2058@end enumerate
2059
2060@subsection Global Properties
2061
2062@subsection Format
2063
2064Global properties are specified with the simple format:
2065@itemize
2066@item name1: value1
2067@item name2: "value which may contain spaces"
2068@item name3: #88F
2069@end itemize
2070
2071In this example, name3 is assigned a color value.
2072
2073
2074@subsection Global Property List
2075
2076@multitable @columnfractions 0.3 0.6
2077@item title-text
2078   @tab Specifies the text to display at the top center of the screen as a title.
2079@item title-font
2080   @tab Defines the font used for the title message at the top of the screen.
2081@item title-color
2082   @tab Defines the color of the title message.
2083@item message-font
2084   @tab Currently unused. Left for backward compatibility.
2085@item message-color
2086   @tab Currently unused. Left for backward compatibility.
2087@item message-bg-color
2088   @tab Currently unused. Left for backward compatibility.
2089@item desktop-image
2090   @tab Specifies the image to use as the background.  It will be scaled
2091   to fit the screen size or proportionally scaled depending on the scale
2092   method.
2093@item desktop-image-scale-method
2094   @tab Specifies the scaling method for the *desktop-image*. Options are
2095   ``stretch``, ``crop``, ``padding``, ``fitwidth``, ``fitheight``.
2096   ``stretch`` for fitting the screen size. Otherwise it is proportional
2097   scaling of a part of *desktop-image* to the part of the screen.
2098   ``crop`` part of the *desktop-image* will be proportionally scaled to
2099   fit the screen sizes. ``padding`` the entire *desktop-image* will be
2100   contained on the screen. ``fitwidth`` for fitting the *desktop-image*'s
2101   width with screen width. ``fitheight`` for fitting the *desktop-image*'s
2102   height with the screen height. Default is ``stretch``.
2103@item desktop-image-h-align
2104   @tab Specifies the horizontal alignment of the *desktop-image* if
2105   *desktop-image-scale-method* isn't equeal to ``stretch``. Options are
2106   ``left``, ``center``, ``right``. Default is ``center``.
2107@item desktop-image-v-align
2108   @tab Specifies the vertical alignment of the *desktop-image* if
2109   *desktop-image-scale-method* isn't equeal to ``stretch``. Options are
2110   ``top``, ``center``, ``bottom``. Default is ``center``.
2111@item desktop-color
2112   @tab Specifies the color for the background if *desktop-image* is not
2113   specified.
2114@item terminal-box
2115   @tab Specifies the file name pattern for the styled box slices used for the
2116   command line terminal window.  For example, ``terminal-box: terminal_*.png``
2117   will use the images ``terminal_c.png`` as the center area, ``terminal_n.png``
2118   as the north (top) edge, ``terminal_nw.png`` as the northwest (upper left)
2119   corner, and so on.  If the image for any slice is not found, it will simply
2120   be left empty.
2121@item terminal-border
2122   @tab Specifies the border width of the terminal window.
2123@item terminal-left
2124   @tab Specifies the left coordinate of the terminal window.
2125@item terminal-top
2126   @tab Specifies the top coordinate of the terminal window.
2127@item terminal-width
2128   @tab Specifies the width of the terminal window.
2129@item terminal-height
2130   @tab Specifies the height of the terminal window.
2131@end multitable
2132
2133
2134@subsection Component Construction
2135
2136Greater customizability comes is provided by components.  A tree of components
2137forms the user interface.  *Containers* are components that can contain other
2138components, and there is always a single root component which is an instance
2139of a *canvas* container.
2140
2141Components are created in the theme file by prefixing the type of component
2142with a '+' sign:
2143
2144@code{   + label @{ text="GRUB" font="aqui 11" color="#8FF" @} }
2145
2146properties of a component are specified as "name = value" (whitespace
2147surrounding tokens is optional and is ignored) where *value* may be:
2148@itemize
2149@item a single word (e.g., ``align = center``, ``color = #FF8080``),
2150@item a quoted string (e.g., ``text = "Hello, World!"``), or
2151@item a tuple (e.g., ``preferred_size = (120, 80)``).
2152@end itemize
2153
2154@subsection Component List
2155
2156The following is a list of the components and the properties they support.
2157
2158@itemize
2159@item label
2160   A label displays a line of text.
2161   
2162   Properties:
2163   @multitable @columnfractions 0.2 0.7
2164   @item id
2165      @tab Set to ``__timeout__`` to display the time elapsed to an automatical
2166      boot of the default entry.
2167   @item text
2168      @tab The text to display. If ``id`` is set to ``__timeout__`` and no
2169      ``text`` property is set then the amount of seconds will be shown.
2170      If set to ``@@KEYMAP_SHORT@@``, ``@@KEYMAP_MIDDLE@@`` or
2171      ``@@KEYMAP_LONG@@`` then predefined hotkey information will be shown.
2172   @item font
2173      @tab The font to use for text display.
2174   @item color
2175      @tab The color of the text.
2176   @item align
2177      @tab The horizontal alignment of the text within the component.
2178      Options are ``left``, ``center`` and ``right``.
2179   @item visible
2180      @tab Set to ``false`` to hide the label.
2181   @end multitable
2182
2183@item image
2184   A component that displays an image.  The image is scaled to fit
2185   the component.
2186
2187   Properties:
2188
2189   @multitable @columnfractions 0.2 0.7
2190   @item file
2191      @tab The full path to the image file to load.
2192   @end multitable
2193
2194@item progress_bar
2195   Displays a horizontally oriented progress bar.  It can be rendered using
2196   simple solid filled rectangles, or using a pair of pixmap styled boxes.
2197
2198   Properties:
2199
2200   @multitable @columnfractions 0.2 0.7
2201   @item id
2202      @tab Set to ``__timeout__`` to display the time elapsed to an automatical
2203      boot of the default entry.
2204   @item fg_color
2205      @tab The foreground color for plain solid color rendering.
2206   @item bg_color
2207      @tab The background color for plain solid color rendering.
2208   @item border_color
2209      @tab The border color for plain solid color rendering.
2210   @item text_color
2211      @tab The text color.
2212   @item bar_style
2213      @tab The styled box specification for the frame of the progress bar.
2214      Example: ``progress_frame_*.png``
2215      If the value is equal to ``highlight_style`` then no styled boxes
2216      will be shown.
2217   @item highlight_style
2218      @tab The styled box specification for the highlighted region of the
2219      progress bar. This box will be used to paint just the highlighted region
2220      of the bar, and will be increased in size as the bar nears completion.
2221      Example: ``progress_hl_*.png``.
2222      If the value is equal to ``bar_style`` then no styled boxes
2223      will be shown.
2224   @item highlight_overlay
2225      @tab If this option is set to ``true`` then the highlight box
2226      side slices (every slice except the center slice) will overlay the
2227      frame box side slices. And the center slice of the highlight box
2228      can move all the way (from top to bottom), being drawn on the center
2229      slice of the frame box. That way we can make a progress bar with
2230      round-shaped edges so there won't be a free space from the highlight to
2231      the frame in top and bottom scrollbar positions. Default is ``false``.
2232   @item font
2233      @tab The font to use for progress bar.
2234   @item text
2235      @tab The text to display on the progress bar.  If the progress bar's ID
2236      is set to ``__timeout__`` and the value of this property is set to
2237      ``@@TIMEOUT_NOTIFICATION_SHORT@@``, ``@@TIMEOUT_NOTIFICATION_MIDDLE@@``
2238      or ``@@TIMEOUT_NOTIFICATION_LONG@@``, then GRUB will update this
2239      property with an informative message as the timeout approaches.
2240   @end multitable
2241
2242@item circular_progress
2243   Displays a circular progress indicator.  The appearance of this component
2244   is determined by two images:  the *center* image and the *tick* image.  The
2245   center image is generally larger and will be drawn in the center of the
2246   component.  Around the circumference of a circle within the component, the
2247   tick image will be drawn a certain number of times, depending on the
2248   properties of the component.
2249
2250   Properties:
2251
2252   @multitable @columnfractions 0.3 0.6
2253   @item id
2254      @tab Set to ``__timeout__`` to display the time elapsed to an automatical
2255      boot of the default entry.
2256   @item center_bitmap
2257      @tab The file name of the image to draw in the center of the component.
2258   @item tick_bitmap
2259      @tab The file name of the image to draw for the tick marks.
2260   @item num_ticks
2261      @tab The number of ticks that make up a full circle.
2262   @item ticks_disappear
2263      @tab Boolean value indicating whether tick marks should progressively appear,
2264      or progressively disappear as *value* approaches *end*.  Specify
2265      ``true`` or ``false``. Default is ``false``.
2266   @item start_angle
2267      @tab The position of the first tick mark to appear or disappear.
2268      Measured in "parrots", 1 "parrot" = 1 / 256 of the full circle.
2269      Use values ``xxx deg`` or ``xxx \xc2\xb0`` to set the angle in degrees.
2270   @end multitable
2271
2272@item boot_menu
2273   Displays the GRUB boot menu.  It allows selecting items and executing them.
2274
2275   Properties:
2276
2277   @multitable @columnfractions 0.4 0.5
2278   @item item_font
2279      @tab The font to use for the menu item titles.
2280   @item selected_item_font
2281      @tab The font to use for the selected menu item, or ``inherit`` (the default)
2282      to use ``item_font`` for the selected menu item as well.
2283   @item item_color
2284      @tab The color to use for the menu item titles.
2285   @item selected_item_color
2286      @tab The color to use for the selected menu item, or ``inherit`` (the default)
2287      to use ``item_color`` for the selected menu item as well.
2288   @item icon_width
2289      @tab The width of menu item icons.  Icons are scaled to the specified size.
2290   @item icon_height
2291      @tab The height of menu item icons.
2292   @item item_height
2293      @tab The height of each menu item in pixels.
2294   @item item_padding
2295      @tab The amount of space in pixels to leave on each side of the menu item
2296      contents.
2297   @item item_icon_space
2298      @tab The space between an item's icon and the title text, in pixels.
2299   @item item_spacing
2300      @tab The amount of space to leave between menu items, in pixels.
2301   @item menu_pixmap_style
2302      @tab The image file pattern for the menu frame styled box.
2303      Example:  ``menu_*.png`` (this will use images such as ``menu_c.png``,
2304      ``menu_w.png``, `menu_nw.png``, etc.)
2305   @item item_pixmap_style
2306      @tab The image file pattern for the item styled box.
2307   @item selected_item_pixmap_style
2308      @tab The image file pattern for the selected item highlight styled box.
2309   @item scrollbar
2310      @tab Boolean value indicating whether the scroll bar should be drawn if the
2311      frame and thumb styled boxes are configured.
2312   @item scrollbar_frame
2313      @tab The image file pattern for the entire scroll bar.
2314      Example:  ``scrollbar_*.png``
2315   @item scrollbar_thumb
2316      @tab The image file pattern for the scroll bar thumb (the part of the scroll
2317      bar that moves as scrolling occurs).
2318      Example:  ``scrollbar_thumb_*.png``
2319   @item scrollbar_thumb_overlay
2320      @tab If this option is set to ``true`` then the scrollbar thumb
2321      side slices (every slice except the center slice) will overlay the
2322      scrollbar frame side slices. And the center slice of the scrollbar_thumb
2323      can move all the way (from top to bottom), being drawn on the center
2324      slice of the scrollbar frame. That way we can make a scrollbar with
2325      round-shaped edges so there won't be a free space from the thumb to
2326      the frame in top and bottom scrollbar positions. Default is ``false``.
2327   @item scrollbar_slice
2328      @tab The menu frame styled box's slice in which the scrollbar will be
2329      drawn. Possible values are ``west``, ``center``, ``east`` (default).
2330      ``west`` - the scrollbar will be drawn in the west slice (right-aligned).
2331      ``east`` - the scrollbar will be drawn in the east slice (left-aligned).
2332      ``center`` - the scrollbar will be drawn in the center slice.
2333      Note: in case of ``center`` slice:
2334      a) If the scrollbar should be drawn then boot menu entry's width is
2335      decreased by the scrollbar's width and the scrollbar is drawn at the
2336      right side of the center slice.
2337      b) If the scrollbar won't be drawn then the boot menu entry's width
2338      is the width of the center slice.
2339      c) We don't necessary need the menu pixmap box to display the scrollbar.
2340   @item scrollbar_left_pad
2341      @tab The left scrollbar padding in pixels.
2342      Unused if ``scrollbar_slice`` is ``west``.
2343   @item scrollbar_right_pad
2344      @tab The right scrollbar padding in pixels.
2345      Unused if ``scrollbar_slice`` is ``east``.
2346   @item scrollbar_top_pad
2347      @tab The top scrollbar padding in pixels.
2348   @item scrollbar_bottom_pad
2349      @tab The bottom scrollbar padding in pixels.
2350   @item visible
2351      @tab Set to ``false`` to hide the boot menu.
2352   @end multitable
2353
2354@item canvas
2355   Canvas is a container that allows manual placement of components within it.
2356   It does not alter the positions of its child components.  It assigns all
2357   child components their preferred sizes.
2358
2359@item hbox
2360   The *hbox* container lays out its children from left to right, giving each
2361   one its preferred width.  The height of each child is set to the maximum of
2362   the preferred heights of all children.
2363   
2364@item vbox
2365   The *vbox* container lays out its children from top to bottom, giving each
2366   one its preferred height.  The width of each child is set to the maximum of
2367   the preferred widths of all children.
2368@end itemize
2369
2370
2371@subsection Common properties
2372
2373The following properties are supported by all components:
2374@table @samp
2375@item left
2376     The distance from the left border of container to left border of the object in either of three formats:
2377        @multitable @columnfractions 0.2 0.7
2378             @item x @tab Value in pixels
2379             @item p% @tab Percentage
2380             @item p%+x @tab mixture of both
2381        @end multitable
2382@item top
2383      The distance from the left border of container to left border of the object in same format.
2384@item width
2385      The width of object in same format.
2386@item height
2387      The height of object in same format.
2388@item id
2389   The identifier for the component.  This can be any arbitrary string.
2390   The ID can be used by scripts to refer to various components in the GUI
2391   component tree.  Currently, there is one special ID value that GRUB
2392   recognizes:
2393
2394   @multitable @columnfractions 0.2 0.7
2395   @item ``__timeout__``
2396      @tab Component with this ID will be updated by GRUB and will indicate
2397      time elapsed to an automatical boot of the default entry.
2398      Affected components: ``label``, ``circular_progress``, ``progress_bar``.
2399   @end multitable
2400@end table
2401
2402
2403
2404@node Network
2405@chapter Booting GRUB from the network
2406
2407The following instructions don't work for *-emu, i386-qemu, i386-coreboot,
2408i386-multiboot, mips_loongson, mips-arc and mips_qemu_mips
2409
2410To generate a netbootable directory, run:
2411
2412@example
2413@group
2414grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/<platform>
2415@end group
2416@end example
2417
2418E.g. for i386-pc:
2419
2420@example
2421@group
2422grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i386-pc
2423@end group
2424@end example
2425
2426Then follow instructions printed out by grub-mknetdir on configuring your DHCP
2427server.
2428
2429After GRUB has started, files on the TFTP server will be accessible via the
2430@samp{(tftp)} device.
2431
2432The server IP address can be controlled by changing the
2433@samp{(tftp)} device name to @samp{(tftp,@var{server-ip})}. Note that
2434this should be changed both in the prefix and in any references to the
2435device name in the configuration file.
2436
2437GRUB provides several environment variables which may be used to inspect or
2438change the behaviour of the PXE device. In the following description
2439@var{<interface>} is placeholder for the name of network interface (platform
2440dependent):
2441
2442@table @samp
2443@item net_@var{<interface>}_ip
2444The network interface's IP address.  Read-only.
2445
2446@item net_@var{<interface>}_mac
2447The network interface's MAC address.  Read-only.
2448
2449@item net_@var{<interface>}_hostname
2450The client host name provided by DHCP.  Read-only.
2451
2452@item net_@var{<interface>}_domain
2453The client domain name provided by DHCP.  Read-only.
2454
2455@item net_@var{<interface>}_rootpath
2456The path to the client's root disk provided by DHCP.  Read-only.
2457
2458@item net_@var{<interface>}_extensionspath
2459The path to additional DHCP vendor extensions provided by DHCP.  Read-only.
2460
2461@item net_@var{<interface>}_boot_file
2462The boot file name provided by DHCP.  Read-only.
2463
2464@item net_@var{<interface>}_dhcp_server_name
2465The name of the DHCP server responsible for these boot parameters.
2466Read-only.
2467
2468@item net_default_interface
2469Initially set to name of network interface that was used to load grub.
2470Read-write, although setting it affects only interpretation of
2471@samp{net_default_ip} and @samp{net_default_mac}
2472
2473@item net_default_ip
2474The IP address of default interface.  Read-only. This is alias for the
2475@samp{net_$@{net_default_interface@}_ip}.
2476
2477@item net_default_mac
2478The default interface's MAC address.  Read-only.  This is alias for the
2479@samp{net_$@{net_default_interface@}_mac}.
2480
2481@item net_default_server
2482The default server used by network drives (@pxref{Device syntax}).  Read-write,
2483although setting this is only useful before opening a network device.
2484
2485@end table
2486
2487
2488@node Serial terminal
2489@chapter Using GRUB via a serial line
2490
2491This chapter describes how to use the serial terminal support in GRUB.
2492
2493If you have many computers or computers with no display/keyboard, it
2494could be very useful to control the computers through serial
2495communications. To connect one computer with another via a serial line,
2496you need to prepare a null-modem (cross) serial cable, and you may need
2497to have multiport serial boards, if your computer doesn't have extra
2498serial ports. In addition, a terminal emulator is also required, such as
2499minicom. Refer to a manual of your operating system, for more
2500information.
2501
2502As for GRUB, the instruction to set up a serial terminal is quite
2503simple.  Here is an example:
2504
2505@example
2506@group
2507grub> @kbd{serial --unit=0 --speed=9600}
2508grub> @kbd{terminal_input serial; terminal_output serial}
2509@end group
2510@end example
2511
2512The command @command{serial} initializes the serial unit 0 with the
2513speed 9600bps. The serial unit 0 is usually called @samp{COM1}, so, if
2514you want to use COM2, you must specify @samp{--unit=1} instead. This
2515command accepts many other options, so please refer to @ref{serial},
2516for more details.
2517
2518The commands @command{terminal_input} (@pxref{terminal_input}) and
2519@command{terminal_output} (@pxref{terminal_output}) choose which type of
2520terminal you want to use. In the case above, the terminal will be a
2521serial terminal, but you can also pass @code{console} to the command,
2522as @samp{terminal_input serial console}. In this case, a terminal in which
2523you press any key will be selected as a GRUB terminal. In the example above,
2524note that you need to put both commands on the same command line, as you
2525will lose the ability to type commands on the console after the first
2526command.
2527
2528However, note that GRUB assumes that your terminal emulator is
2529compatible with VT100 by default. This is true for most terminal
2530emulators nowadays, but you should pass the option @option{--dumb} to
2531the command if your terminal emulator is not VT100-compatible or
2532implements few VT100 escape sequences. If you specify this option then
2533GRUB provides you with an alternative menu interface, because the normal
2534menu requires several fancy features of your terminal.
2535
2536
2537@node Vendor power-on keys
2538@chapter Using GRUB with vendor power-on keys
2539
2540Some laptop vendors provide an additional power-on button which boots
2541another OS.  GRUB supports such buttons with the @samp{GRUB_TIMEOUT_BUTTON},
2542@samp{GRUB_TIMEOUT_STYLE_BUTTON}, @samp{GRUB_DEFAULT_BUTTON}, and
2543@samp{GRUB_BUTTON_CMOS_ADDRESS} variables in default/grub (@pxref{Simple
2544configuration}).  @samp{GRUB_TIMEOUT_BUTTON},
2545@samp{GRUB_TIMEOUT_STYLE_BUTTON}, and @samp{GRUB_DEFAULT_BUTTON} are used
2546instead of the corresponding variables without the @samp{_BUTTON} suffix
2547when powered on using the special button.  @samp{GRUB_BUTTON_CMOS_ADDRESS}
2548is vendor-specific and partially model-specific.  Values known to the GRUB
2549team are:
2550
2551@table @key
2552@item Dell XPS M1330M
2553121:3
2554@item Dell XPS M1530
255585:3
2556@item Dell Latitude E4300
255785:3
2558@item Asus EeePC 1005PE
255984:1 (unconfirmed)
2560@end table
2561
2562To take full advantage of this function, install GRUB into the MBR
2563(@pxref{Installing GRUB using grub-install}).
2564
2565If you have a laptop which has a similar feature and not in the above list
2566could you figure your address and contribute?
2567To discover the address do the following:
2568@itemize
2569@item boot normally
2570@item
2571@example
2572sudo modprobe nvram
2573sudo cat /dev/nvram | xxd > normal_button.txt
2574@end example
2575@item boot using vendor button
2576@item
2577@example
2578sudo modprobe nvram
2579sudo cat /dev/nvram | xxd > normal_vendor.txt
2580@end example
2581@end itemize
2582
2583Then compare these text files and find where a bit was toggled. E.g. in
2584case of Dell XPS it was:
2585@example
2586byte 0x47: 20 --> 28
2587@end example
2588It's a bit number 3 as seen from following table:
2589@multitable @columnfractions .2 .2
2590@item 0 @tab 01
2591@item 1 @tab 02
2592@item 2 @tab 04
2593@item 3 @tab 08
2594@item 4 @tab 10
2595@item 5 @tab 20
2596@item 6 @tab 40
2597@item 7 @tab 80
2598@end multitable
2599
26000x47 is decimal 71. Linux nvram implementation cuts first 14 bytes of
2601CMOS. So the real byte address in CMOS is 71+14=85
2602So complete address is 85:3
2603
2604@node Images
2605@chapter GRUB image files
2606
2607@c FIXME: parts of this section are specific to PC BIOS right now.
2608
2609GRUB consists of several images: a variety of bootstrap images for starting
2610GRUB in various ways, a kernel image, and a set of modules which are
2611combined with the kernel image to form a core image.  Here is a short
2612overview of them.
2613
2614@table @file
2615@item boot.img
2616On PC BIOS systems, this image is the first part of GRUB to start.  It is
2617written to a master boot record (MBR) or to the boot sector of a partition.
2618Because a PC boot sector is 512 bytes, the size of this image is exactly 512
2619bytes.
2620
2621The sole function of @file{boot.img} is to read the first sector of the core
2622image from a local disk and jump to it.  Because of the size restriction,
2623@file{boot.img} cannot understand any file system structure, so
2624@command{grub-install} hardcodes the location of the first sector of the
2625core image into @file{boot.img} when installing GRUB.
2626
2627@item diskboot.img
2628This image is used as the first sector of the core image when booting from a
2629hard disk.  It reads the rest of the core image into memory and starts the
2630kernel.  Since file system handling is not yet available, it encodes the
2631location of the core image using a block list format.
2632
2633@item cdboot.img
2634This image is used as the first sector of the core image when booting from a
2635CD-ROM drive.  It performs a similar function to @file{diskboot.img}.
2636
2637@item pxeboot.img
2638This image is used as the start of the core image when booting from the
2639network using PXE.  @xref{Network}.
2640
2641@item lnxboot.img
2642This image may be placed at the start of the core image in order to make
2643GRUB look enough like a Linux kernel that it can be booted by LILO using an
2644@samp{image=} section.
2645
2646@item kernel.img
2647This image contains GRUB's basic run-time facilities: frameworks for device
2648and file handling, environment variables, the rescue mode command-line
2649parser, and so on.  It is rarely used directly, but is built into all core
2650images.
2651
2652@item core.img
2653This is the core image of GRUB.  It is built dynamically from the kernel
2654image and an arbitrary list of modules by the @command{grub-mkimage}
2655program.  Usually, it contains enough modules to access @file{/boot/grub},
2656and loads everything else (including menu handling, the ability to load
2657target operating systems, and so on) from the file system at run-time.  The
2658modular design allows the core image to be kept small, since the areas of
2659disk where it must be installed are often as small as 32KB.
2660
2661@xref{BIOS installation}, for details on where the core image can be
2662installed on PC systems.
2663
2664@item *.mod
2665Everything else in GRUB resides in dynamically loadable modules.  These are
2666often loaded automatically, or built into the core image if they are
2667essential, but may also be loaded manually using the @command{insmod}
2668command (@pxref{insmod}).
2669@end table
2670
2671@heading For GRUB Legacy users
2672
2673GRUB 2 has a different design from GRUB Legacy, and so correspondences with
2674the images it used cannot be exact.  Nevertheless, GRUB Legacy users often
2675ask questions in the terms they are familiar with, and so here is a brief
2676guide to how GRUB 2's images relate to that.
2677
2678@table @file
2679@item stage1
2680Stage 1 from GRUB Legacy was very similar to @file{boot.img} in GRUB 2, and
2681they serve the same function.
2682
2683@item *_stage1_5
2684In GRUB Legacy, Stage 1.5's function was to include enough filesystem code
2685to allow the much larger Stage 2 to be read from an ordinary filesystem.  In
2686this respect, its function was similar to @file{core.img} in GRUB 2.
2687However, @file{core.img} is much more capable than Stage 1.5 was; since it
2688offers a rescue shell, it is sometimes possible to recover manually in the
2689event that it is unable to load any other modules, for example if partition
2690numbers have changed.  @file{core.img} is built in a more flexible way,
2691allowing GRUB 2 to support reading modules from advanced disk types such as
2692LVM and RAID.
2693
2694GRUB Legacy could run with only Stage 1 and Stage 2 in some limited
2695configurations, while GRUB 2 requires @file{core.img} and cannot work
2696without it.
2697
2698@item stage2
2699GRUB 2 has no single Stage 2 image.  Instead, it loads modules from
2700@file{/boot/grub} at run-time.
2701
2702@item stage2_eltorito
2703In GRUB 2, images for booting from CD-ROM drives are now constructed using
2704@file{cdboot.img} and @file{core.img}, making sure that the core image
2705contains the @samp{iso9660} module.  It is usually best to use the
2706@command{grub-mkrescue} program for this.
2707
2708@item nbgrub
2709There is as yet no equivalent for @file{nbgrub} in GRUB 2; it was used by
2710Etherboot and some other network boot loaders.
2711
2712@item pxegrub
2713In GRUB 2, images for PXE network booting are now constructed using
2714@file{pxeboot.img} and @file{core.img}, making sure that the core image
2715contains the @samp{pxe} and @samp{pxecmd} modules.  @xref{Network}.
2716@end table
2717
2718@node Core image size limitation
2719@chapter Core image size limitation
2720
2721Heavily limited platforms:
2722@itemize
2723@item i386-pc (normal and PXE): the core image size (compressed) is limited by 458240 bytes.
2724 kernel.img (.text + .data + .bss, uncompressed) is limited by 392704 bytes.
2725 module size (uncompressed) + kernel.img (.text + .data, uncompressed) is limited by the size of contiguous chunk at 1M address.
2726@item sparc64-ieee1275: kernel.img (.text + .data + .bss) + modules + 256K (stack) + 2M (heap) is limited by space available at 0x4400. On most platforms it's just 3 or 4M since ieee1275 maps only so much.
2727@item i386-ieee1275: kernel.img  (.text + .data + .bss) + modules is limited by memory available at 0x10000, at most 596K
2728@end itemize
2729
2730Lightly limited platforms:
2731
2732@itemize
2733@item *-xen: limited only by adress space and RAM size.
2734@item i386-qemu: kernel.img (.text + .data + .bss) is limited by 392704 bytes.
2735                 (core.img would be limited by ROM size but it's unlimited on qemu
2736@item All EFI platforms: limited by contiguous RAM size and possibly firmware bugs
2737@item Coreboot and multiboot. kernel.img (.text + .data + .bss) is limited by 392704 bytes.
2738      module size is limited by the size of contiguous chunk at 1M address.
2739@item mipsel-loongson (ELF), mips(el)-qemu_mips (ELF): if uncompressed:
2740                kernel.img (.text + .data) + modules is limited by the space from 80200000 forward
2741                if compressed:
2742                kernel.img (.text + .data, uncompressed) + modules (uncompressed)
2743                + (modules + kernel.img (.text + .data)) (compressed)
2744                + decompressor is limited by the space from 80200000 forward
2745@item mipsel-loongson (Flash), mips(el)-qemu_mips (Flash): kernel.img (.text + .data) + modules is limited by the space from 80200000 forward
2746                               core.img (final) is limited by flash size (512K on yeeloong and fulooong)
2747@item mips-arc: if uncompressed:
2748                kernel.img (.text + .data) is limited by the space from 8bd00000 forward
2749                modules + dummy decompressor  is limited by the space from 8bd00000 backward
2750                if compressed:
2751                kernel.img (.text + .data, uncompressed) is limited by the space from 8bd00000 forward
2752                modules (uncompressed) + (modules + kernel.img (.text + .data)) (compressed, aligned to 1M)
2753                + 1M (decompressor + scratch space) is limited by the space from 8bd00000 backward
2754@item powerpc-ieee1275: kernel.img (.text + .data + .bss) + modules is limited by space available at 0x200000
2755@end itemize
2756
2757@node Filesystem
2758@chapter Filesystem syntax and semantics
2759
2760GRUB uses a special syntax for specifying disk drives which can be
2761accessed by BIOS. Because of BIOS limitations, GRUB cannot distinguish
2762between IDE, ESDI, SCSI, or others. You must know yourself which BIOS
2763device is equivalent to which OS device. Normally, that will be clear if
2764you see the files in a device or use the command @command{search}
2765(@pxref{search}).
2766
2767@menu
2768* Device syntax::               How to specify devices
2769* File name syntax::            How to specify files
2770* Block list syntax::           How to specify block lists
2771@end menu
2772
2773
2774@node Device syntax
2775@section How to specify devices
2776
2777The device syntax is like this:
2778
2779@example
2780@code{(@var{device}[,@var{partmap-name1}@var{part-num1}[,@var{partmap-name2}@var{part-num2}[,...]]])}
2781@end example
2782
2783@samp{[]} means the parameter is optional. @var{device} depends on the disk
2784driver in use. BIOS and EFI disks use either @samp{fd} or @samp{hd} followed
2785by a digit, like @samp{fd0}, or @samp{cd}.
2786AHCI, PATA (ata), crypto, USB use the name of driver followed by a number.
2787Memdisk and host are limited to one disk and so it's refered just by driver
2788name.
2789RAID (md), ofdisk (ieee1275 and nand), LVM (lvm), LDM, virtio (vdsk)
2790and arcdisk (arc) use intrinsic name of disk prefixed by driver name.
2791Additionally just ``nand'' refers to the disk aliased as ``nand''.
2792Conflicts are solved by suffixing a number if necessarry.
2793Commas need to be escaped.
2794Loopback uses whatever name specified to @command{loopback} command.
2795Hostdisk uses names specified in device.map as long as it's of the form
2796[fhc]d[0-9]* or hostdisk/<OS DEVICE>.
2797For crypto and RAID (md) additionally you can use the syntax
2798<driver name>uuid/<uuid>.  For LVM additionally you can use the syntax
2799lvmid/<volume-group-uuid>/<volume-uuid>.
2800
2801@example
2802(fd0)
2803(hd0)
2804(cd)
2805(ahci0)
2806(ata0)
2807(crypto0)
2808(usb0)
2809(cryptouuid/123456789abcdef0123456789abcdef0)
2810(mduuid/123456789abcdef0123456789abcdef0)
2811(lvm/system-root)
2812(lvmid/F1ikgD-2RES-306G-il9M-7iwa-4NKW-EbV1NV/eLGuCQ-L4Ka-XUgR-sjtJ-ffch-bajr-fCNfz5)
2813(md/myraid)
2814(md/0)
2815(ieee1275/disk2)
2816(ieee1275//pci@@1f\,0/ide@@d/disk@@2)
2817(nand)
2818(memdisk)
2819(host)
2820(myloop)
2821(hostdisk//dev/sda)
2822@end example
2823
2824@var{part-num} represents the partition number of @var{device}, starting
2825from one. @var{partname} is optional but is recommended since disk may have
2826several top-level partmaps. Specifying third and later component you can access
2827to subpartitions.
2828
2829The syntax @samp{(hd0)} represents using the entire disk (or the
2830MBR when installing GRUB), while the syntax @samp{(hd0,1)}
2831represents using the first partition of the disk (or the boot sector
2832of the partition when installing GRUB).
2833
2834@example
2835(hd0,msdos1)
2836(hd0,msdos1,msdos5)
2837(hd0,msdos1,bsd3)
2838(hd0,netbsd1)
2839(hd0,gpt1)
2840(hd0,1,3)
2841@end example
2842
2843If you enabled the network support, the special drives
2844@code{(@var{protocol}[,@var{server}])} are also available. Supported protocols
2845are @samp{http} and @samp{tftp}. If @var{server} is omitted, value of
2846environment variable @samp{net_default_server} is used.
2847Before using the network drive, you must initialize the network.
2848@xref{Network}, for more information.
2849
2850If you boot GRUB from a CD-ROM, @samp{(cd)} is available. @xref{Making
2851a GRUB bootable CD-ROM}, for details.
2852
2853
2854@node File name syntax
2855@section How to specify files
2856
2857There are two ways to specify files, by @dfn{absolute file name} and by
2858@dfn{block list}.
2859
2860An absolute file name resembles a Unix absolute file name, using
2861@samp{/} for the directory separator (not @samp{\} as in DOS). One
2862example is @samp{(hd0,1)/boot/grub/grub.cfg}. This means the file
2863@file{/boot/grub/grub.cfg} in the first partition of the first hard
2864disk. If you omit the device name in an absolute file name, GRUB uses
2865GRUB's @dfn{root device} implicitly. So if you set the root device to,
2866say, @samp{(hd1,1)} by the command @samp{set root=(hd1,1)} (@pxref{set}),
2867then @code{/boot/kernel} is the same as @code{(hd1,1)/boot/kernel}.
2868
2869On ZFS filesystem the first path component must be
2870@var{volume}@samp{@@}[@var{snapshot}].
2871So @samp{/rootvol@@snap-129/boot/grub/grub.cfg} refers to file
2872@samp{/boot/grub/grub.cfg} in snapshot of volume @samp{rootvol} with name
2873@samp{snap-129}.  Trailing @samp{@@} after volume name is mandatory even if
2874snapshot name is omitted.
2875
2876
2877@node Block list syntax
2878@section How to specify block lists
2879
2880A block list is used for specifying a file that doesn't appear in the
2881filesystem, like a chainloader. The syntax is
2882@code{[@var{offset}]+@var{length}[,[@var{offset}]+@var{length}]@dots{}}.
2883Here is an example:
2884
2885@example
2886@code{0+100,200+1,300+300}
2887@end example
2888
2889This represents that GRUB should read blocks 0 through 99, block 200,
2890and blocks 300 through 599. If you omit an offset, then GRUB assumes
2891the offset is zero.
2892
2893Like the file name syntax (@pxref{File name syntax}), if a blocklist
2894does not contain a device name, then GRUB uses GRUB's @dfn{root
2895device}. So @code{(hd0,2)+1} is the same as @code{+1} when the root
2896device is @samp{(hd0,2)}.
2897
2898
2899@node Interface
2900@chapter GRUB's user interface
2901
2902GRUB has both a simple menu interface for choosing preset entries from a
2903configuration file, and a highly flexible command-line for performing
2904any desired combination of boot commands.
2905
2906GRUB looks for its configuration file as soon as it is loaded. If one
2907is found, then the full menu interface is activated using whatever
2908entries were found in the file. If you choose the @dfn{command-line} menu
2909option, or if the configuration file was not found, then GRUB drops to
2910the command-line interface.
2911
2912@menu
2913* Command-line interface::      The flexible command-line interface
2914* Menu interface::              The simple menu interface
2915* Menu entry editor::           Editing a menu entry
2916@end menu
2917
2918
2919@node Command-line interface
2920@section The flexible command-line interface
2921
2922The command-line interface provides a prompt and after it an editable
2923text area much like a command-line in Unix or DOS. Each command is
2924immediately executed after it is entered@footnote{However, this
2925behavior will be changed in the future version, in a user-invisible
2926way.}. The commands (@pxref{Command-line and menu entry commands}) are a
2927subset of those available in the configuration file, used with exactly
2928the same syntax.
2929
2930Cursor movement and editing of the text on the line can be done via a
2931subset of the functions available in the Bash shell:
2932
2933@table @key
2934@item C-f
2935@itemx PC right key
2936Move forward one character.
2937
2938@item C-b
2939@itemx PC left key
2940Move back one character.
2941
2942@item C-a
2943@itemx HOME
2944Move to the start of the line.
2945
2946@item C-e
2947@itemx END
2948Move the the end of the line.
2949
2950@item C-d
2951@itemx DEL
2952Delete the character underneath the cursor.
2953
2954@item C-h
2955@itemx BS
2956Delete the character to the left of the cursor.
2957
2958@item C-k
2959Kill the text from the current cursor position to the end of the line.
2960
2961@item C-u
2962Kill backward from the cursor to the beginning of the line.
2963
2964@item C-y
2965Yank the killed text back into the buffer at the cursor.
2966
2967@item C-p
2968@itemx PC up key
2969Move up through the history list.
2970
2971@item C-n
2972@itemx PC down key
2973Move down through the history list.
2974@end table
2975
2976When typing commands interactively, if the cursor is within or before
2977the first word in the command-line, pressing the @key{TAB} key (or
2978@key{C-i}) will display a listing of the available commands, and if the
2979cursor is after the first word, the @kbd{@key{TAB}} will provide a
2980completion listing of disks, partitions, and file names depending on the
2981context. Note that to obtain a list of drives, one must open a
2982parenthesis, as @command{root (}.
2983
2984Note that you cannot use the completion functionality in the TFTP
2985filesystem. This is because TFTP doesn't support file name listing for
2986the security.
2987
2988
2989@node Menu interface
2990@section The simple menu interface
2991
2992The menu interface is quite easy to use. Its commands are both
2993reasonably intuitive and described on screen.
2994
2995Basically, the menu interface provides a list of @dfn{boot entries} to
2996the user to choose from. Use the arrow keys to select the entry of
2997choice, then press @key{RET} to run it.  An optional timeout is
2998available to boot the default entry (the first one if not set), which is
2999aborted by pressing any key.
3000
3001Commands are available to enter a bare command-line by pressing @key{c}
3002(which operates exactly like the non-config-file version of GRUB, but
3003allows one to return to the menu if desired by pressing @key{ESC}) or to
3004edit any of the @dfn{boot entries} by pressing @key{e}.
3005
3006If you protect the menu interface with a password (@pxref{Security}),
3007all you can do is choose an entry by pressing @key{RET}, or press
3008@key{p} to enter the password.
3009
3010
3011@node Menu entry editor
3012@section Editing a menu entry
3013
3014The menu entry editor looks much like the main menu interface, but the
3015lines in the menu are individual commands in the selected entry instead
3016of entry names.
3017
3018If an @key{ESC} is pressed in the editor, it aborts all the changes made
3019to the configuration entry and returns to the main menu interface.
3020
3021Each line in the menu entry can be edited freely, and you can add new lines
3022by pressing @key{RET} at the end of a line.  To boot the edited entry, press
3023@key{Ctrl-x}.
3024
3025Although GRUB unfortunately does not support @dfn{undo}, you can do almost
3026the same thing by just returning to the main menu using @key{ESC}.
3027
3028
3029@node Environment
3030@chapter GRUB environment variables
3031
3032GRUB supports environment variables which are rather like those offered by
3033all Unix-like systems.  Environment variables have a name, which is unique
3034and is usually a short identifier, and a value, which is an arbitrary string
3035of characters.  They may be set (@pxref{set}), unset (@pxref{unset}), or
3036looked up (@pxref{Shell-like scripting}) by name.
3037
3038A number of environment variables have special meanings to various parts of
3039GRUB.  Others may be used freely in GRUB configuration files.
3040
3041
3042@menu
3043* Special environment variables::
3044* Environment block::
3045@end menu
3046
3047
3048@node Special environment variables
3049@section Special environment variables
3050
3051These variables have special meaning to GRUB.
3052
3053@menu
3054* biosnum::
3055* check_signatures::
3056* chosen::
3057* cmdpath::
3058* color_highlight::
3059* color_normal::
3060* debug::
3061* default::
3062* fallback::
3063* gfxmode::
3064* gfxpayload::
3065* gfxterm_font::
3066* grub_cpu::
3067* grub_platform::
3068* icondir::
3069* lang::
3070* locale_dir::
3071* menu_color_highlight::
3072* menu_color_normal::
3073* net_@var{<interface>}_boot_file::
3074* net_@var{<interface>}_dhcp_server_name::
3075* net_@var{<interface>}_domain::
3076* net_@var{<interface>}_extensionspath::
3077* net_@var{<interface>}_hostname::
3078* net_@var{<interface>}_ip::
3079* net_@var{<interface>}_mac::
3080* net_@var{<interface>}_rootpath::
3081* net_default_interface::
3082* net_default_ip::
3083* net_default_mac::
3084* net_default_server::
3085* pager::
3086* prefix::
3087* pxe_blksize::
3088* pxe_default_gateway::
3089* pxe_default_server::
3090* root::
3091* superusers::
3092* theme::
3093* timeout::
3094* timeout_style::
3095@end menu
3096
3097
3098@node biosnum
3099@subsection biosnum
3100
3101When chain-loading another boot loader (@pxref{Chain-loading}), GRUB may
3102need to know what BIOS drive number corresponds to the root device
3103(@pxref{root}) so that it can set up registers properly.  If the
3104@var{biosnum} variable is set, it overrides GRUB's own means of guessing
3105this.
3106
3107For an alternative approach which also changes BIOS drive mappings for the
3108chain-loaded system, @pxref{drivemap}.
3109
3110
3111@node check_signatures
3112@subsection check_signatures
3113
3114This variable controls whether GRUB enforces digital signature
3115validation on loaded files. @xref{Using digital signatures}.
3116
3117@node chosen
3118@subsection chosen
3119
3120When executing a menu entry, GRUB sets the @var{chosen} variable to the
3121title of the entry being executed.
3122
3123If the menu entry is in one or more submenus, then @var{chosen} is set to
3124the titles of each of the submenus starting from the top level followed by
3125the title of the menu entry itself, separated by @samp{>}.
3126
3127
3128@node cmdpath
3129@subsection cmdpath
3130
3131The location from which @file{core.img} was loaded as an absolute
3132directory name (@pxref{File name syntax}).  This is set by GRUB at
3133startup based on information returned by platform firmware.  Not every
3134platform provides this information and some may return only device
3135without path name.
3136
3137
3138@node color_highlight
3139@subsection color_highlight
3140
3141This variable contains the ``highlight'' foreground and background terminal
3142colors, separated by a slash (@samp{/}).  Setting this variable changes
3143those colors.  For the available color names, @pxref{color_normal}.
3144
3145The default is @samp{black/light-gray}.
3146
3147
3148@node color_normal
3149@subsection color_normal
3150
3151This variable contains the ``normal'' foreground and background terminal
3152colors, separated by a slash (@samp{/}).  Setting this variable changes
3153those colors.  Each color must be a name from the following list:
3154
3155@itemize @bullet
3156@item black
3157@item blue
3158@item green
3159@item cyan
3160@item red
3161@item magenta
3162@item brown
3163@item light-gray
3164@item dark-gray
3165@item light-blue
3166@item light-green
3167@item light-cyan
3168@item light-red
3169@item light-magenta
3170@item yellow
3171@item white
3172@end itemize
3173
3174The default is @samp{light-gray/black}.
3175
3176The color support support varies from terminal to terminal.
3177
3178@samp{morse} has no color support at all.
3179
3180@samp{mda_text} color support is limited to highlighting by
3181black/white reversal.
3182
3183@samp{console} on ARC, EMU and IEEE1275, @samp{serial_*} and
3184@samp{spkmodem} are governed by terminfo and support
3185only 8 colors if in modes @samp{vt100-color} (default for console on emu),
3186@samp{arc} (default for console on ARC), @samp{ieee1275} (default
3187for console on IEEE1275). When in mode @samp{vt100}
3188then the color support is limited to highlighting by black/white
3189reversal. When in mode @samp{dumb} there is no color support.
3190
3191When console supports no colors this setting is ignored.
3192When console supports 8 colors, then the colors from the
3193second half of the previous list are mapped to the
3194matching colors of first half.
3195
3196@samp{console} on EFI and BIOS and @samp{vga_text} support all 16 colors.
3197
3198@samp{gfxterm} supports all 16 colors and would be theoretically extendable
3199to support whole rgb24 palette but currently there is no compelling reason
3200to go beyond the current 16 colors.
3201
3202@node debug
3203@subsection debug
3204
3205This variable may be set to enable debugging output from various components
3206of GRUB.  The value is a list of debug facility names separated by
3207whitespace or @samp{,}, or @samp{all} to enable all available debugging
3208output. The facility names are the first argument to grub_dprintf. Consult
3209source for more details.
3210
3211
3212@node default
3213@subsection default
3214
3215If this variable is set, it identifies a menu entry that should be selected
3216by default, possibly after a timeout (@pxref{timeout}).  The entry may be
3217identified by number or by id.
3218
3219For example, if you have:
3220
3221@verbatim
3222menuentry 'Example GNU/Linux distribution' --class gnu-linux --id example-gnu-linux {
3223        ...
3224}
3225@end verbatim
3226
3227then you can make this the default using:
3228
3229@example
3230default=example-gnu-linux
3231@end example
3232
3233If the entry is in a submenu, then it must be identified using the titles of
3234each of the submenus starting from the top level followed by the number or
3235title of the menu entry itself, separated by @samp{>}.  For example, take
3236the following menu structure:
3237
3238@example
3239Submenu 1
3240  Menu Entry 1
3241  Menu Entry 2
3242Submenu 2
3243  Submenu 3
3244    Menu Entry 3
3245    Menu Entry 4
3246  Menu Entry 5
3247@end example
3248
3249``Menu Entry 3'' would then be identified as
3250@samp{Submenu 2>Submenu 3>Menu Entry 3}.
3251
3252This variable is often set by @samp{GRUB_DEFAULT} (@pxref{Simple
3253configuration}), @command{grub-set-default}, or @command{grub-reboot}.
3254
3255
3256@node fallback
3257@subsection fallback
3258
3259If this variable is set, it identifies a menu entry that should be selected
3260if the default menu entry fails to boot.  Entries are identified in the same
3261way as for @samp{default} (@pxref{default}).
3262
3263
3264@node gfxmode
3265@subsection gfxmode
3266
3267If this variable is set, it sets the resolution used on the @samp{gfxterm}
3268graphical terminal.  Note that you can only use modes which your graphics
3269card supports via VESA BIOS Extensions (VBE), so for example native LCD
3270panel resolutions may not be available.  The default is @samp{auto}, which
3271selects a platform-specific default that should look reasonable. Supported
3272modes can be listed by @samp{videoinfo} command in GRUB.
3273
3274The resolution may be specified as a sequence of one or more modes,
3275separated by commas (@samp{,}) or semicolons (@samp{;}); each will be tried
3276in turn until one is found.  Each mode should be either @samp{auto},
3277@samp{@var{width}x@var{height}}, or
3278@samp{@var{width}x@var{height}x@var{depth}}.
3279
3280
3281@node gfxpayload
3282@subsection gfxpayload
3283
3284If this variable is set, it controls the video mode in which the Linux
3285kernel starts up, replacing the @samp{vga=} boot option (@pxref{linux}).  It
3286may be set to @samp{text} to force the Linux kernel to boot in normal text
3287mode, @samp{keep} to preserve the graphics mode set using @samp{gfxmode}, or
3288any of the permitted values for @samp{gfxmode} to set a particular graphics
3289mode (@pxref{gfxmode}).
3290
3291Depending on your kernel, your distribution, your graphics card, and the
3292phase of the moon, note that using this option may cause GNU/Linux to suffer
3293from various display problems, particularly during the early part of the
3294boot sequence.  If you have problems, set this variable to @samp{text} and
3295GRUB will tell Linux to boot in normal text mode.
3296
3297The default is platform-specific.  On platforms with a native text mode
3298(such as PC BIOS platforms), the default is @samp{text}.  Otherwise the
3299default may be @samp{auto} or a specific video mode.
3300
3301This variable is often set by @samp{GRUB_GFXPAYLOAD_LINUX} (@pxref{Simple
3302configuration}).
3303
3304
3305@node gfxterm_font
3306@subsection gfxterm_font
3307
3308If this variable is set, it names a font to use for text on the
3309@samp{gfxterm} graphical terminal.  Otherwise, @samp{gfxterm} may use any
3310available font.
3311
3312
3313@node grub_cpu
3314@subsection grub_cpu
3315
3316In normal mode (@pxref{normal}), GRUB sets the @samp{grub_cpu} variable to
3317the CPU type for which GRUB was built (e.g. @samp{i386} or @samp{powerpc}).
3318
3319
3320@node grub_platform
3321@subsection grub_platform
3322
3323In normal mode (@pxref{normal}), GRUB sets the @samp{grub_platform} variable
3324to the platform for which GRUB was built (e.g. @samp{pc} or @samp{efi}).
3325
3326
3327@node icondir
3328@subsection icondir
3329
3330If this variable is set, it names a directory in which the GRUB graphical
3331menu should look for icons after looking in the theme's @samp{icons}
3332directory.  @xref{Theme file format}.
3333
3334
3335@node lang
3336@subsection lang
3337
3338If this variable is set, it names the language code that the
3339@command{gettext} command (@pxref{gettext}) uses to translate strings.  For
3340example, French would be named as @samp{fr}, and Simplified Chinese as
3341@samp{zh_CN}.
3342
3343@command{grub-mkconfig} (@pxref{Simple configuration}) will try to set a
3344reasonable default for this variable based on the system locale.
3345
3346
3347@node locale_dir
3348@subsection locale_dir
3349
3350If this variable is set, it names the directory where translation files may
3351be found (@pxref{gettext}), usually @file{/boot/grub/locale}.  Otherwise,
3352internationalization is disabled.
3353
3354@command{grub-mkconfig} (@pxref{Simple configuration}) will set a reasonable
3355default for this variable if internationalization is needed and any
3356translation files are available.
3357
3358
3359@node menu_color_highlight
3360@subsection menu_color_highlight
3361
3362This variable contains the foreground and background colors to be used for
3363the highlighted menu entry, separated by a slash (@samp{/}).  Setting this
3364variable changes those colors.  For the available color names,
3365@pxref{color_normal}.
3366
3367The default is the value of @samp{color_highlight}
3368(@pxref{color_highlight}).
3369
3370
3371@node menu_color_normal
3372@subsection menu_color_normal
3373
3374This variable contains the foreground and background colors to be used for
3375non-highlighted menu entries, separated by a slash (@samp{/}).  Setting this
3376variable changes those colors.  For the available color names,
3377@pxref{color_normal}.
3378
3379The default is the value of @samp{color_normal} (@pxref{color_normal}).
3380
3381
3382@node net_@var{<interface>}_boot_file
3383@subsection net_@var{<interface>}_boot_file
3384
3385@xref{Network}.
3386
3387
3388@node net_@var{<interface>}_dhcp_server_name
3389@subsection net_@var{<interface>}_dhcp_server_name
3390
3391@xref{Network}.
3392
3393
3394@node net_@var{<interface>}_domain
3395@subsection net_@var{<interface>}_domain
3396
3397@xref{Network}.
3398
3399
3400@node net_@var{<interface>}_extensionspath
3401@subsection net_@var{<interface>}_extensionspath
3402
3403@xref{Network}.
3404
3405
3406@node net_@var{<interface>}_hostname
3407@subsection net_@var{<interface>}_hostname
3408
3409@xref{Network}.
3410
3411
3412@node net_@var{<interface>}_ip
3413@subsection net_@var{<interface>}_ip
3414
3415@xref{Network}.
3416
3417
3418@node net_@var{<interface>}_mac
3419@subsection net_@var{<interface>}_mac
3420
3421@xref{Network}.
3422
3423
3424@node net_@var{<interface>}_rootpath
3425@subsection net_@var{<interface>}_rootpath
3426
3427@xref{Network}.
3428
3429
3430@node net_default_interface
3431@subsection net_default_interface
3432
3433@xref{Network}.
3434
3435
3436@node net_default_ip
3437@subsection net_default_ip
3438
3439@xref{Network}.
3440
3441
3442@node net_default_mac
3443@subsection net_default_mac
3444
3445@xref{Network}.
3446
3447
3448@node net_default_server
3449@subsection net_default_server
3450
3451@xref{Network}.
3452
3453
3454@node pager
3455@subsection pager
3456
3457If set to @samp{1}, pause output after each screenful and wait for keyboard
3458input.  The default is not to pause output.
3459
3460
3461@node prefix
3462@subsection prefix
3463
3464The location of the @samp{/boot/grub} directory as an absolute file name
3465(@pxref{File name syntax}).  This is normally set by GRUB at startup based
3466on information provided by @command{grub-install}.  GRUB modules are
3467dynamically loaded from this directory, so it must be set correctly in order
3468for many parts of GRUB to work.
3469
3470
3471@node pxe_blksize
3472@subsection pxe_blksize
3473
3474@xref{Network}.
3475
3476
3477@node pxe_default_gateway
3478@subsection pxe_default_gateway
3479
3480@xref{Network}.
3481
3482
3483@node pxe_default_server
3484@subsection pxe_default_server
3485
3486@xref{Network}.
3487
3488
3489@node root
3490@subsection root
3491
3492The root device name (@pxref{Device syntax}).  Any file names that do not
3493specify an explicit device name are read from this device.  The default is
3494normally set by GRUB at startup based on the value of @samp{prefix}
3495(@pxref{prefix}).
3496
3497For example, if GRUB was installed to the first partition of the first hard
3498disk, then @samp{prefix} might be set to @samp{(hd0,msdos1)/boot/grub} and
3499@samp{root} to @samp{hd0,msdos1}.
3500
3501
3502@node superusers
3503@subsection superusers
3504
3505This variable may be set to a list of superuser names to enable
3506authentication support.  @xref{Security}.
3507
3508
3509@node theme
3510@subsection theme
3511
3512This variable may be set to a directory containing a GRUB graphical menu
3513theme.  @xref{Theme file format}.
3514
3515This variable is often set by @samp{GRUB_THEME} (@pxref{Simple
3516configuration}).
3517
3518
3519@node timeout
3520@subsection timeout
3521
3522If this variable is set, it specifies the time in seconds to wait for
3523keyboard input before booting the default menu entry.  A timeout of @samp{0}
3524means to boot the default entry immediately without displaying the menu; a
3525timeout of @samp{-1} (or unset) means to wait indefinitely.
3526
3527If @samp{timeout_style} (@pxref{timeout_style}) is set to @samp{countdown}
3528or @samp{hidden}, the timeout is instead counted before the menu is
3529displayed.
3530
3531This variable is often set by @samp{GRUB_TIMEOUT} (@pxref{Simple
3532configuration}).
3533
3534
3535@node timeout_style
3536@subsection timeout_style
3537
3538This variable may be set to @samp{menu}, @samp{countdown}, or @samp{hidden}
3539to control the way in which the timeout (@pxref{timeout}) interacts with
3540displaying the menu.  See the documentation of @samp{GRUB_TIMEOUT_STYLE}
3541(@pxref{Simple configuration}) for details.
3542
3543
3544@node Environment block
3545@section The GRUB environment block
3546
3547It is often useful to be able to remember a small amount of information from
3548one boot to the next.  For example, you might want to set the default menu
3549entry based on what was selected the last time.  GRUB deliberately does not
3550implement support for writing files in order to minimise the possibility of
3551the boot loader being responsible for file system corruption, so a GRUB
3552configuration file cannot just create a file in the ordinary way.  However,
3553GRUB provides an ``environment block'' which can be used to save a small
3554amount of state.
3555
3556The environment block is a preallocated 1024-byte file, which normally lives
3557in @file{/boot/grub/grubenv} (although you should not assume this).  At boot
3558time, the @command{load_env} command (@pxref{load_env}) loads environment
3559variables from it, and the @command{save_env} (@pxref{save_env}) command
3560saves environment variables to it.  From a running system, the
3561@command{grub-editenv} utility can be used to edit the environment block.
3562
3563For safety reasons, this storage is only available when installed on a plain
3564disk (no LVM or RAID), using a non-checksumming filesystem (no ZFS), and
3565using BIOS or EFI functions (no ATA, USB or IEEE1275).
3566
3567@command{grub-mkconfig} uses this facility to implement
3568@samp{GRUB_SAVEDEFAULT} (@pxref{Simple configuration}).
3569
3570
3571@node Commands
3572@chapter The list of available commands
3573
3574In this chapter, we list all commands that are available in GRUB.
3575
3576Commands belong to different groups. A few can only be used in
3577the global section of the configuration file (or ``menu''); most
3578of them can be entered on the command-line and can be used either
3579anywhere in the menu or specifically in the menu entries.
3580
3581In rescue mode, only the @command{insmod} (@pxref{insmod}), @command{ls}
3582(@pxref{ls}), @command{set} (@pxref{set}), and @command{unset}
3583(@pxref{unset}) commands are normally available.  If you end up in rescue
3584mode and do not know what to do, then @pxref{GRUB only offers a rescue
3585shell}.
3586
3587@menu
3588* Menu-specific commands::
3589* General commands::
3590* Command-line and menu entry commands::
3591* Networking commands::
3592@end menu
3593
3594
3595@node Menu-specific commands
3596@section The list of commands for the menu only
3597
3598The semantics used in parsing the configuration file are the following:
3599
3600@itemize @bullet
3601@item
3602The files @emph{must} be in plain-text format.
3603
3604@item
3605@samp{#} at the beginning of a line in a configuration file means it is
3606only a comment.
3607
3608@item
3609Options are separated by spaces.
3610
3611@item
3612All numbers can be either decimal or hexadecimal. A hexadecimal number
3613must be preceded by @samp{0x}, and is case-insensitive.
3614@end itemize
3615
3616These commands can only be used in the menu:
3617
3618@menu
3619* menuentry::                   Start a menu entry
3620* submenu::                     Group menu entries
3621@end menu
3622
3623
3624@node menuentry
3625@subsection menuentry
3626
3627@deffn Command menuentry @var{title} @
3628 [@option{--class=class} @dots{}] [@option{--users=users}] @
3629 [@option{--unrestricted}] [@option{--hotkey=key}] [@option{--id=id}] @
3630 [@var{arg} @dots{}] @{ @var{command}; @dots{} @}
3631This defines a GRUB menu entry named @var{title}.  When this entry is
3632selected from the menu, GRUB will set the @var{chosen} environment variable
3633to value of @option{--id} if @option{--id} is given, execute the list of
3634commands given within braces, and if the last command in the list returned
3635successfully and a kernel was loaded it will execute the @command{boot} command.
3636
3637The @option{--class} option may be used any number of times to group menu
3638entries into classes.  Menu themes may display different classes using
3639different styles.
3640
3641The @option{--users} option grants specific users access to specific menu
3642entries.  @xref{Security}.
3643
3644The @option{--unrestricted} option grants all users access to specific menu
3645entries.  @xref{Security}.
3646
3647The @option{--hotkey} option associates a hotkey with a menu entry.
3648@var{key} may be a single letter, or one of the aliases @samp{backspace},
3649@samp{tab}, or @samp{delete}.
3650
3651The @option{--id} may be used to associate unique identifier with a menu entry.
3652@var{id} is string of ASCII aphanumeric characters, underscore and hyphen
3653and should not start with a digit.
3654
3655All other arguments including @var{title} are passed as positional parameters
3656when list of commands is executed with @var{title} always assigned to @code{$1}.
3657@end deffn
3658
3659
3660@node submenu
3661@subsection submenu
3662
3663@deffn Command submenu @var{title} @
3664 [@option{--class=class} @dots{}] [@option{--users=users}] @
3665 [@option{--unrestricted}] [@option{--hotkey=key}] [@option{--id=id}] @
3666 @{ @var{menu entries} @dots{} @}
3667This defines a submenu.  An entry called @var{title} will be added to the
3668menu; when that entry is selected, a new menu will be displayed showing all
3669the entries within this submenu.
3670
3671All options are the same as in the @command{menuentry} command
3672(@pxref{menuentry}).
3673@end deffn
3674
3675
3676@node General commands
3677@section The list of general commands
3678
3679Commands usable anywhere in the menu and in the command-line.
3680
3681@menu
3682* serial::                      Set up a serial device
3683* terminal_input::              Manage input terminals
3684* terminal_output::             Manage output terminals
3685* terminfo::                    Define terminal type
3686@end menu
3687
3688
3689@node serial
3690@subsection serial
3691
3692@deffn Command serial [@option{--unit=unit}] [@option{--port=port}] [@option{--speed=speed}] [@option{--word=word}] [@option{--parity=parity}] [@option{--stop=stop}]
3693Initialize a serial device. @var{unit} is a number in the range 0-3
3694specifying which serial port to use; default is 0, which corresponds to
3695the port often called COM1. @var{port} is the I/O port where the UART
3696is to be found; if specified it takes precedence over @var{unit}.
3697@var{speed} is the transmission speed; default is 9600. @var{word} and
3698@var{stop} are the number of data bits and stop bits. Data bits must
3699be in the range 5-8 and stop bits must be 1 or 2. Default is 8 data
3700bits and one stop bit. @var{parity} is one of @samp{no}, @samp{odd},
3701@samp{even} and defaults to @samp{no}.
3702
3703The serial port is not used as a communication channel unless the
3704@command{terminal_input} or @command{terminal_output} command is used
3705(@pxref{terminal_input}, @pxref{terminal_output}).
3706
3707See also @ref{Serial terminal}.
3708@end deffn
3709
3710
3711@node terminal_input
3712@subsection terminal_input
3713
3714@deffn Command terminal_input [@option{--append}|@option{--remove}] @
3715 [terminal1] [terminal2] @dots{}
3716List or select an input terminal.
3717
3718With no arguments, list the active and available input terminals.
3719
3720With @option{--append}, add the named terminals to the list of active input
3721terminals; any of these may be used to provide input to GRUB.
3722
3723With @option{--remove}, remove the named terminals from the active list.
3724
3725With no options but a list of terminal names, make only the listed terminal
3726names active.
3727@end deffn
3728
3729
3730@node terminal_output
3731@subsection terminal_output
3732
3733@deffn Command terminal_output [@option{--append}|@option{--remove}] @
3734 [terminal1] [terminal2] @dots{}
3735List or select an output terminal.
3736
3737With no arguments, list the active and available output terminals.
3738
3739With @option{--append}, add the named terminals to the list of active output
3740terminals; all of these will receive output from GRUB.
3741
3742With @option{--remove}, remove the named terminals from the active list.
3743
3744With no options but a list of terminal names, make only the listed terminal
3745names active.
3746@end deffn
3747
3748
3749@node terminfo
3750@subsection terminfo
3751
3752@deffn Command terminfo [-a|-u|-v] [term]
3753Define the capabilities of your terminal by giving the name of an entry in
3754the terminfo database, which should correspond roughly to a @samp{TERM}
3755environment variable in Unix.
3756
3757The currently available terminal types are @samp{vt100}, @samp{vt100-color},
3758@samp{ieee1275}, and @samp{dumb}.  If you need other terminal types, please
3759contact us to discuss the best way to include support for these in GRUB.
3760
3761The @option{-a} (@option{--ascii}), @option{-u} (@option{--utf8}), and
3762@option{-v} (@option{--visual-utf8}) options control how non-ASCII text is
3763displayed.  @option{-a} specifies an ASCII-only terminal; @option{-u}
3764specifies logically-ordered UTF-8; and @option{-v} specifies
3765"visually-ordered UTF-8" (in other words, arranged such that a terminal
3766emulator without bidirectional text support will display right-to-left text
3767in the proper order; this is not really proper UTF-8, but a workaround).
3768
3769If no option or terminal type is specified, the current terminal type is
3770printed.
3771@end deffn
3772
3773
3774@node Command-line and menu entry commands
3775@section The list of command-line and menu entry commands
3776
3777These commands are usable in the command-line and in menu entries.  If
3778you forget a command, you can run the command @command{help}
3779(@pxref{help}).
3780
3781@menu
3782* [::                           Check file types and compare values
3783* acpi::                        Load ACPI tables
3784* authenticate::                Check whether user is in user list
3785* background_color::            Set background color for active terminal
3786* background_image::            Load background image for active terminal
3787* badram::                      Filter out bad regions of RAM
3788* blocklist::                   Print a block list
3789* boot::                        Start up your operating system
3790* cat::                         Show the contents of a file
3791* chainloader::                 Chain-load another boot loader
3792* clear::                       Clear the screen
3793* cmosclean::                   Clear bit in CMOS
3794* cmosdump::                    Dump CMOS contents
3795* cmostest::                    Test bit in CMOS
3796* cmp::                         Compare two files
3797* configfile::                  Load a configuration file
3798* cpuid::                       Check for CPU features
3799* crc::                         Compute or check CRC32 checksums
3800* cryptomount::                 Mount a crypto device
3801* date::                        Display or set current date and time
3802* devicetree::                  Load a device tree blob
3803* distrust::                    Remove a pubkey from trusted keys
3804* drivemap::                    Map a drive to another
3805* echo::                        Display a line of text
3806* eval::                        Evaluate agruments as GRUB commands
3807* export::                      Export an environment variable
3808* false::                       Do nothing, unsuccessfully
3809* gettext::                     Translate a string
3810* gptsync::                     Fill an MBR based on GPT entries
3811* halt::                        Shut down your computer
3812* hashsum::                     Compute or check hash checksum
3813* help::                        Show help messages
3814* initrd::                      Load a Linux initrd
3815* initrd16::                    Load a Linux initrd (16-bit mode)
3816* insmod::                      Insert a module
3817* keystatus::                   Check key modifier status
3818* linux::                       Load a Linux kernel
3819* linux16::                     Load a Linux kernel (16-bit mode)
3820* list_env::                    List variables in environment block
3821* list_trusted::                List trusted public keys
3822* load_env::                    Load variables from environment block
3823* loadfont::                    Load font files
3824* loopback::                    Make a device from a filesystem image
3825* ls::                          List devices or files
3826* lsfonts::                     List loaded fonts
3827* lsmod::                       Show loaded modules
3828* md5sum::                      Compute or check MD5 hash
3829* module::                      Load module for multiboot kernel
3830* multiboot::                   Load multiboot compliant kernel
3831* nativedisk::                  Switch to native disk drivers
3832* normal::                      Enter normal mode
3833* normal_exit::                 Exit from normal mode
3834* parttool::                    Modify partition table entries
3835* password::                    Set a clear-text password
3836* password_pbkdf2::             Set a hashed password
3837* play::                        Play a tune
3838* probe::                       Retrieve device info
3839* pxe_unload::                  Unload the PXE environment
3840* read::                        Read user input
3841* reboot::                      Reboot your computer
3842* regexp::                      Test if regular expression matches string
3843* rmmod::                       Remove a module
3844* save_env::                    Save variables to environment block
3845* search::                      Search devices by file, label, or UUID
3846* sendkey::                     Emulate keystrokes
3847* set::                         Set an environment variable
3848* sha1sum::                     Compute or check SHA1 hash
3849* sha256sum::                   Compute or check SHA256 hash
3850* sha512sum::                   Compute or check SHA512 hash
3851* sleep::                       Wait for a specified number of seconds
3852* source::                      Read a configuration file in same context
3853* test::                        Check file types and compare values
3854* true::                        Do nothing, successfully
3855* trust::                       Add public key to list of trusted keys
3856* unset::                       Unset an environment variable
3857* uppermem::                    Set the upper memory size
3858@comment * vbeinfo::                     List available video modes
3859* verify_detached::             Verify detached digital signature
3860* videoinfo::                   List available video modes
3861@end menu
3862
3863
3864@node [
3865@subsection [
3866@deffn Command @code{[} expression @code{]}
3867Alias for @code{test @var{expression}} (@pxref{test}).
3868@end deffn
3869
3870
3871@node acpi
3872@subsection acpi
3873
3874@deffn Command acpi [@option{-1}|@option{-2}] @
3875 [@option{--exclude=table1,@dots{}}|@option{--load-only=table1,@dots{}}] @
3876 [@option{--oemid=id}] [@option{--oemtable=table}] @
3877 [@option{--oemtablerev=rev}] [@option{--oemtablecreator=creator}] @
3878 [@option{--oemtablecreatorrev=rev}] [@option{--no-ebda}] @
3879 filename @dots{}
3880Modern BIOS systems normally implement the Advanced Configuration and Power
3881Interface (ACPI), and define various tables that describe the interface
3882between an ACPI-compliant operating system and the firmware. In some cases,
3883the tables provided by default only work well with certain operating
3884systems, and it may be necessary to replace some of them.
3885
3886Normally, this command will replace the Root System Description Pointer
3887(RSDP) in the Extended BIOS Data Area to point to the new tables. If the
3888@option{--no-ebda} option is used, the new tables will be known only to
3889GRUB, but may be used by GRUB's EFI emulation.
3890@end deffn
3891
3892
3893@node authenticate
3894@subsection authenticate
3895@deffn Command authenticate [userlist]
3896Check whether user is in @var{userlist} or listed in the value of variable
3897@samp{superusers}. See @pxref{superusers} for valid user list format.
3898If @samp{superusers} is empty, this command returns true. @xref{Security}.
3899@end deffn
3900
3901
3902@node background_color
3903@subsection background_color
3904
3905@deffn Command background_color color
3906Set background color for active terminal. For valid color specifications see
3907@pxref{Theme file format, ,Colors}. Background color can be changed only when
3908using @samp{gfxterm} for terminal output.
3909
3910This command sets color of empty areas without text. Text background color
3911is controlled by environment variables @var{color_normal}, @var{color_highlight},
3912@var{menu_color_normal}, @var{menu_color_highlight}. @xref{Special environment variables}.
3913@end deffn
3914
3915
3916@node background_image
3917@subsection background_image
3918
3919@deffn Command background_image [[@option{--mode} @samp{stretch}|@samp{normal}] file]
3920Load background image for active terminal from @var{file}. Image is stretched
3921to fill up entire screen unless option @option{--mode} @samp{normal} is given.
3922Without arguments remove currently loaded background image. Background image
3923can be changed only when using @samp{gfxterm} for terminal output.
3924
3925@end deffn
3926
3927
3928@node badram
3929@subsection badram
3930
3931@deffn Command badram addr,mask[,addr,mask...]
3932Filter out bad RAM.
3933@end deffn
3934
3935This command notifies the memory manager that specified regions of
3936RAM ought to be filtered out (usually, because they're damaged).  This
3937remains in effect after a payload kernel has been loaded by GRUB, as
3938long as the loaded kernel obtains its memory map from GRUB.  Kernels that
3939support this include Linux, GNU Mach, the kernel of FreeBSD and Multiboot
3940kernels in general.
3941
3942Syntax is the same as provided by the @uref{http://www.memtest.org/,
3943Memtest86+ utility}: a list of address/mask pairs.  Given a page-aligned
3944address and a base address / mask pair, if all the bits of the page-aligned
3945address that are enabled by the mask match with the base address, it means
3946this page is to be filtered.  This syntax makes it easy to represent patterns
3947that are often result of memory damage, due to physical distribution of memory
3948cells.
3949
3950@node blocklist
3951@subsection blocklist
3952
3953@deffn Command blocklist file
3954Print a block list (@pxref{Block list syntax}) for @var{file}.
3955@end deffn
3956
3957
3958@node boot
3959@subsection boot
3960
3961@deffn Command boot
3962Boot the OS or chain-loader which has been loaded. Only necessary if
3963running the fully interactive command-line (it is implicit at the end of
3964a menu entry).
3965@end deffn
3966
3967
3968@node cat
3969@subsection cat
3970
3971@deffn Command cat [@option{--dos}] file
3972Display the contents of the file @var{file}. This command may be useful
3973to remind you of your OS's root partition:
3974
3975@example
3976grub> @kbd{cat /etc/fstab}
3977@end example
3978
3979If the @option{--dos} option is used, then carriage return / new line pairs
3980will be displayed as a simple new line.  Otherwise, the carriage return will
3981be displayed as a control character (@samp{<d>}) to make it easier to see
3982when boot problems are caused by a file formatted using DOS-style line
3983endings.
3984@end deffn
3985
3986
3987@node chainloader
3988@subsection chainloader
3989
3990@deffn Command chainloader [@option{--force}] file
3991Load @var{file} as a chain-loader. Like any other file loaded by the
3992filesystem code, it can use the blocklist notation (@pxref{Block list
3993syntax}) to grab the first sector of the current partition with @samp{+1}.
3994If you specify the option @option{--force}, then load @var{file} forcibly,
3995whether it has a correct signature or not. This is required when you want to
3996load a defective boot loader, such as SCO UnixWare 7.1.
3997@end deffn
3998
3999
4000@node clear
4001@subsection clear
4002
4003@deffn Command clear
4004Clear the screen.
4005@end deffn
4006
4007
4008@node cmosclean
4009@subsection cmosclean
4010
4011@deffn Command cmosclean byte:bit
4012Clear value of bit in CMOS at location @var{byte}:@var{bit}. This command
4013is available only on platforms that support CMOS.
4014@end deffn
4015
4016
4017@node cmosdump
4018@subsection cmosdump
4019
4020@deffn Dump CMOS contents
4021Dump full CMOS contents as hexadecimal values. This command is available only
4022on platforms that support CMOS.
4023@end deffn
4024
4025
4026@node cmostest
4027@subsection cmostest
4028
4029@deffn Command cmostest byte:bit
4030Test value of bit in CMOS at location @var{byte}:@var{bit}. Exit status
4031is zero if bit is set, non zero otherwise. This command is available only
4032on platforms that support CMOS.
4033@end deffn
4034
4035
4036@node cmp
4037@subsection cmp
4038
4039@deffn Command cmp file1 file2
4040Compare the file @var{file1} with the file @var{file2}. If they differ
4041in size, print the sizes like this:
4042
4043@example
4044Differ in size: 0x1234 [foo], 0x4321 [bar]
4045@end example
4046
4047If the sizes are equal but the bytes at an offset differ, then print the
4048bytes like this:
4049
4050@example
4051Differ at the offset 777: 0xbe [foo], 0xef [bar]
4052@end example
4053
4054If they are completely identical, nothing will be printed.
4055@end deffn
4056
4057
4058@node configfile
4059@subsection configfile
4060
4061@deffn Command configfile file
4062Load @var{file} as a configuration file.  If @var{file} defines any menu
4063entries, then show a menu containing them immediately.  Any environment
4064variable changes made by the commands in @var{file} will not be preserved
4065after @command{configfile} returns.
4066@end deffn
4067
4068
4069@node cpuid
4070@subsection cpuid
4071
4072@deffn Command cpuid [-l]
4073Check for CPU features.  This command is only available on x86 systems.
4074
4075With the @option{-l} option, return true if the CPU supports long mode
4076(64-bit).
4077
4078If invoked without options, this command currently behaves as if it had been
4079invoked with @option{-l}.  This may change in the future.
4080@end deffn
4081
4082
4083@node crc
4084@subsection crc
4085
4086@deffn Command crc arg @dots{}
4087Alias for @code{hashsum --hash crc32 arg @dots{}}. See command @command{hashsum}
4088(@pxref{hashsum}) for full description.
4089@end deffn
4090
4091
4092@node cryptomount
4093@subsection cryptomount
4094
4095@deffn Command cryptomount device|@option{-u} uuid|@option{-a}|@option{-b}
4096Setup access to encrypted device. If necessary, passphrase
4097is requested interactively. Option @var{device} configures specific grub device
4098(@pxref{Naming convention}); option @option{-u} @var{uuid} configures device
4099with specified @var{uuid}; option @option{-a} configures all detected encrypted
4100devices; option @option{-b} configures all geli containers that have boot flag set.
4101
4102GRUB suports devices encrypted using LUKS and geli. Note that necessary modules (@var{luks} and @var{geli}) have to be loaded manually before this command can
4103be used.
4104@end deffn
4105
4106
4107@node date
4108@subsection date
4109
4110@deffn Command date [[year-]month-day] [hour:minute[:second]]
4111With no arguments, print the current date and time.
4112
4113Otherwise, take the current date and time, change any elements specified as
4114arguments, and set the result as the new date and time.  For example, `date
411501-01' will set the current month and day to January 1, but leave the year,
4116hour, minute, and second unchanged.
4117@end deffn
4118
4119
4120@node devicetree
4121@subsection linux
4122
4123@deffn Command devicetree file
4124Load a device tree blob (.dtb) from a filesystem, for later use by a Linux
4125kernel. Does not perform merging with any device tree supplied by firmware,
4126but rather replaces it completely.
4127@ref{GNU/Linux}.
4128@end deffn
4129
4130@node distrust
4131@subsection distrust
4132
4133@deffn Command distrust pubkey_id
4134Remove public key @var{pubkey_id} from GRUB's keyring of trusted keys.
4135@var{pubkey_id} is the last four bytes (eight hexadecimal digits) of
4136the GPG v4 key id, which is also the output of @command{list_trusted}
4137(@pxref{list_trusted}).  Outside of GRUB, the key id can be obtained
4138using @code{gpg --fingerprint}).
4139These keys are used to validate signatures when environment variable
4140@code{check_signatures} is set to @code{enforce}
4141(@pxref{check_signatures}), and by some invocations of
4142@command{verify_detached} (@pxref{verify_detached}).  @xref{Using
4143digital signatures}, for more information.
4144@end deffn
4145
4146@node drivemap
4147@subsection drivemap
4148
4149@deffn Command drivemap @option{-l}|@option{-r}|[@option{-s}] @
4150 from_drive to_drive
4151Without options, map the drive @var{from_drive} to the drive @var{to_drive}.
4152This is necessary when you chain-load some operating systems, such as DOS,
4153if such an OS resides at a non-first drive.  For convenience, any partition
4154suffix on the drive is ignored, so you can safely use @verb{'${root}'} as a
4155drive specification.
4156
4157With the @option{-s} option, perform the reverse mapping as well, swapping
4158the two drives.
4159
4160With the @option{-l} option, list the current mappings.
4161
4162With the @option{-r} option, reset all mappings to the default values.
4163
4164For example:
4165
4166@example
4167drivemap -s (hd0) (hd1)
4168@end example
4169@end deffn
4170
4171
4172@node echo
4173@subsection echo
4174
4175@deffn Command echo [@option{-n}] [@option{-e}] string @dots{}
4176Display the requested text and, unless the @option{-n} option is used, a
4177trailing new line.  If there is more than one string, they are separated by
4178spaces in the output.  As usual in GRUB commands, variables may be
4179substituted using @samp{$@{var@}}.
4180
4181The @option{-e} option enables interpretation of backslash escapes.  The
4182following sequences are recognised:
4183
4184@table @code
4185@item \\
4186backslash
4187
4188@item \a
4189alert (BEL)
4190
4191@item \c
4192suppress trailing new line
4193
4194@item \f
4195form feed
4196
4197@item \n
4198new line
4199
4200@item \r
4201carriage return
4202
4203@item \t
4204horizontal tab
4205
4206@item \v
4207vertical tab
4208@end table
4209
4210When interpreting backslash escapes, backslash followed by any other
4211character will print that character.
4212@end deffn
4213
4214
4215@node eval
4216@subsection eval
4217
4218@deffn Command eval string ...
4219Concatenate arguments together using single space as separator and evaluate
4220result as sequence of GRUB commands.
4221@end deffn
4222
4223
4224@node export
4225@subsection export
4226
4227@deffn Command export envvar
4228Export the environment variable @var{envvar}. Exported variables are visible
4229to subsidiary configuration files loaded using @command{configfile}.
4230@end deffn
4231
4232
4233@node false
4234@subsection false
4235
4236@deffn Command false
4237Do nothing, unsuccessfully.  This is mainly useful in control constructs
4238such as @code{if} and @code{while} (@pxref{Shell-like scripting}).
4239@end deffn
4240
4241
4242@node gettext
4243@subsection gettext
4244
4245@deffn Command gettext string
4246Translate @var{string} into the current language.
4247
4248The current language code is stored in the @samp{lang} variable in GRUB's
4249environment (@pxref{lang}).  Translation files in MO format are read from
4250@samp{locale_dir} (@pxref{locale_dir}), usually @file{/boot/grub/locale}.
4251@end deffn
4252
4253
4254@node gptsync
4255@subsection gptsync
4256
4257@deffn Command gptsync device [partition[+/-[type]]] @dots{}
4258Disks using the GUID Partition Table (GPT) also have a legacy Master Boot
4259Record (MBR) partition table for compatibility with the BIOS and with older
4260operating systems.  The legacy MBR can only represent a limited subset of
4261GPT partition entries.
4262
4263This command populates the legacy MBR with the specified @var{partition}
4264entries on @var{device}.  Up to three partitions may be used.
4265
4266@var{type} is an MBR partition type code; prefix with @samp{0x} if you want
4267to enter this in hexadecimal.  The separator between @var{partition} and
4268@var{type} may be @samp{+} to make the partition active, or @samp{-} to make
4269it inactive; only one partition may be active.  If both the separator and
4270type are omitted, then the partition will be inactive.
4271@end deffn
4272
4273
4274@node halt
4275@subsection halt
4276
4277@deffn Command halt @option{--no-apm}
4278The command halts the computer. If the @option{--no-apm} option
4279is specified, no APM BIOS call is performed. Otherwise, the computer
4280is shut down using APM.
4281@end deffn
4282
4283
4284@node hashsum
4285@subsection hashsum
4286
4287@deffn Command hashsum @option{--hash} hash @option{--keep-going} @option{--uncompress} @option{--check} file [@option{--prefix} dir]|file @dots{}
4288Compute or verify file hashes. Hash type is selected with option @option{--hash}.
4289Supported hashes are: @samp{adler32}, @samp{crc64}, @samp{crc32},
4290@samp{crc32rfc1510}, @samp{crc24rfc2440}, @samp{md4}, @samp{md5},
4291@samp{ripemd160}, @samp{sha1}, @samp{sha224}, @samp{sha256}, @samp{sha512},
4292@samp{sha384}, @samp{tiger192}, @samp{tiger}, @samp{tiger2}, @samp{whirlpool}.
4293Option @option{--uncompress} uncompresses files before computing hash.
4294
4295When list of files is given, hash of each file is computed and printed,
4296followed by file name, each file on a new line.
4297
4298When option @option{--check} is given, it points to a file that contains
4299list of @var{hash name} pairs in the same format as used by UNIX
4300@command{md5sum} command. Option @option{--prefix}
4301may be used to give directory where files are located. Hash verification
4302stops after the first mismatch was found unless option @option{--keep-going}
4303was given.  The exit code @code{$?} is set to 0 if hash verification
4304is successful.  If it fails, @code{$?} is set to a nonzero value.
4305@end deffn
4306
4307
4308@node help
4309@subsection help
4310
4311@deffn Command help [pattern @dots{}]
4312Display helpful information about builtin commands. If you do not
4313specify @var{pattern}, this command shows short descriptions of all
4314available commands.
4315
4316If you specify any @var{patterns}, it displays longer information
4317about each of the commands whose names begin with those @var{patterns}.
4318@end deffn
4319
4320
4321@node initrd
4322@subsection initrd
4323
4324@deffn Command initrd file
4325Load an initial ramdisk for a Linux kernel image, and set the appropriate
4326parameters in the Linux setup area in memory.  This may only be used after
4327the @command{linux} command (@pxref{linux}) has been run.  See also
4328@ref{GNU/Linux}.
4329@end deffn
4330
4331
4332@node initrd16
4333@subsection initrd16
4334
4335@deffn Command initrd16 file
4336Load an initial ramdisk for a Linux kernel image to be booted in 16-bit
4337mode, and set the appropriate parameters in the Linux setup area in memory.
4338This may only be used after the @command{linux16} command (@pxref{linux16})
4339has been run.  See also @ref{GNU/Linux}.
4340
4341This command is only available on x86 systems.
4342@end deffn
4343
4344
4345@node insmod
4346@subsection insmod
4347
4348@deffn Command insmod module
4349Insert the dynamic GRUB module called @var{module}.
4350@end deffn
4351
4352
4353@node keystatus
4354@subsection keystatus
4355
4356@deffn Command keystatus [@option{--shift}] [@option{--ctrl}] [@option{--alt}]
4357Return true if the Shift, Control, or Alt modifier keys are held down, as
4358requested by options. This is useful in scripting, to allow some user
4359control over behaviour without having to wait for a keypress.
4360
4361Checking key modifier status is only supported on some platforms. If invoked
4362without any options, the @command{keystatus} command returns true if and
4363only if checking key modifier status is supported.
4364@end deffn
4365
4366
4367@node linux
4368@subsection linux
4369
4370@deffn Command linux file @dots{}
4371Load a Linux kernel image from @var{file}.  The rest of the line is passed
4372verbatim as the @dfn{kernel command-line}.  Any initrd must be reloaded
4373after using this command (@pxref{initrd}).
4374
4375On x86 systems, the kernel will be booted using the 32-bit boot protocol.
4376Note that this means that the @samp{vga=} boot option will not work; if you
4377want to set a special video mode, you will need to use GRUB commands such as
4378@samp{set gfxpayload=1024x768} or @samp{set gfxpayload=keep} (to keep the
4379same mode as used in GRUB) instead.  GRUB can automatically detect some uses
4380of @samp{vga=} and translate them to appropriate settings of
4381@samp{gfxpayload}.  The @command{linux16} command (@pxref{linux16}) avoids
4382this restriction.
4383@end deffn
4384
4385
4386@node linux16
4387@subsection linux16
4388
4389@deffn Command linux16 file @dots{}
4390Load a Linux kernel image from @var{file} in 16-bit mode.  The rest of the
4391line is passed verbatim as the @dfn{kernel command-line}.  Any initrd must
4392be reloaded after using this command (@pxref{initrd16}).
4393
4394The kernel will be booted using the traditional 16-bit boot protocol.  As
4395well as bypassing problems with @samp{vga=} described in @ref{linux}, this
4396permits booting some other programs that implement the Linux boot protocol
4397for the sake of convenience.
4398
4399This command is only available on x86 systems.
4400@end deffn
4401
4402
4403@node list_env
4404@subsection list_env
4405
4406@deffn Command list_env [@option{--file} file]
4407List all variables in the environment block file.  @xref{Environment block}.
4408
4409The @option{--file} option overrides the default location of the
4410environment block.
4411@end deffn
4412
4413@node list_trusted
4414@subsection list_trusted
4415
4416@deffn Command list_trusted
4417List all public keys trusted by GRUB for validating signatures.
4418The output is in GPG's v4 key fingerprint format (i.e., the output of
4419@code{gpg --fingerprint}).  The least significant four bytes (last
4420eight hexadecimal digits) can be used as an argument to
4421@command{distrust} (@pxref{distrust}).
4422@xref{Using digital signatures}, for more information about uses for
4423these keys.
4424@end deffn
4425
4426@node load_env
4427@subsection load_env
4428
4429@deffn Command load_env [@option{--file} file] [@option{--skip-sig}] [whitelisted_variable_name] @dots{}
4430Load all variables from the environment block file into the environment.
4431@xref{Environment block}.
4432
4433The @option{--file} option overrides the default location of the environment
4434block.
4435
4436The @option{--skip-sig} option skips signature checking even when the
4437value of environment variable @code{check_signatures} is set to
4438@code{enforce} (@pxref{check_signatures}).
4439
4440If one or more variable names are provided as arguments, they are
4441interpreted as a whitelist of variables to load from the environment
4442block file.  Variables set in the file but not present in the
4443whitelist are ignored.
4444
4445The @option{--skip-sig} option should be used with care, and should
4446always be used in concert with a whitelist of acceptable variables
4447whose values should be set.  Failure to employ a carefully constructed
4448whitelist could result in reading a malicious value into critical
4449environment variables from the file, such as setting
4450@code{check_signatures=no}, modifying @code{prefix} to boot from an
4451unexpected location or not at all, etc.
4452
4453When used with care, @option{--skip-sig} and the whitelist enable an
4454administrator to configure a system to boot only signed
4455configurations, but to allow the user to select from among multiple
4456configurations, and to enable ``one-shot'' boot attempts and
4457``savedefault'' behavior.  @xref{Using digital signatures}, for more
4458information.
4459@end deffn
4460
4461
4462@node loadfont
4463@subsection loadfont
4464
4465@deffn Command loadfont file @dots{}
4466Load specified font files. Unless absolute pathname is given, @var{file}
4467is assumed to be in directory @samp{$prefix/fonts} with
4468suffix @samp{.pf2} appended. @xref{Theme file format,,Fonts}.
4469@end deffn
4470
4471
4472@node loopback
4473@subsection loopback
4474
4475@deffn Command loopback [@option{-d}] device file
4476Make the device named @var{device} correspond to the contents of the
4477filesystem image in @var{file}.  For example:
4478
4479@example
4480loopback loop0 /path/to/image
4481ls (loop0)/
4482@end example
4483
4484With the @option{-d} option, delete a device previously created using this
4485command.
4486@end deffn
4487
4488
4489@node ls
4490@subsection ls
4491
4492@deffn Command ls [arg @dots{}]
4493List devices or files.
4494
4495With no arguments, print all devices known to GRUB.
4496
4497If the argument is a device name enclosed in parentheses (@pxref{Device
4498syntax}), then print the name of the filesystem of that device.
4499
4500If the argument is a directory given as an absolute file name (@pxref{File
4501name syntax}), then list the contents of that directory.
4502@end deffn
4503
4504
4505@node lsfonts
4506@subsection lsfonts
4507
4508@deffn Command lsfonts
4509List loaded fonts.
4510@end deffn
4511
4512
4513@node lsmod
4514@subsection lsmod
4515
4516@deffn Command lsmod
4517Show list of loaded modules.
4518@end deffn
4519
4520@node md5sum
4521@subsection md5sum
4522
4523@deffn Command md5sum arg @dots{}
4524Alias for @code{hashsum --hash md5 arg @dots{}}. See command @command{hashsum}
4525(@pxref{hashsum}) for full description.
4526@end deffn
4527
4528@node module
4529@subsection module
4530
4531@deffn Command module [--nounzip] file [arguments]
4532Load a module for multiboot kernel image.  The rest of the
4533line is passed verbatim as the module command line.
4534@end deffn
4535
4536@node multiboot
4537@subsection multiboot
4538
4539@deffn Command multiboot [--quirk-bad-kludge] [--quirk-modules-after-kernel] file @dots{}
4540Load a multiboot kernel image from @var{file}.  The rest of the
4541line is passed verbatim as the @dfn{kernel command-line}.  Any module must
4542be reloaded after using this command (@pxref{module}).
4543
4544Some kernels have known problems. You need to specify --quirk-* for those.
4545--quirk-bad-kludge is a problem seen in several products that they include
4546loading kludge information with invalid data in ELF file. GRUB prior to 0.97
4547and some custom builds prefered ELF information while 0.97 and GRUB 2
4548use kludge. Use this option to ignore kludge.
4549Known affected systems: old Solaris, SkyOS.
4550
4551--quirk-modules-after-kernel is needed for kernels which load at relatively
4552high address e.g. 16MiB mark and can't cope with modules stuffed between
45531MiB mark and beginning of the kernel.
4554Known afftected systems: VMWare.
4555@end deffn
4556
4557@node nativedisk
4558@subsection nativedisk
4559
4560@deffn Command nativedisk
4561Switch from firmware disk drivers to native ones.
4562Really useful only on platforms where both
4563firmware and native disk drives are available.
4564Currently i386-pc, i386-efi, i386-ieee1275 and
4565x86_64-efi.
4566@end deffn
4567
4568@node normal
4569@subsection normal
4570
4571@deffn Command normal [file]
4572Enter normal mode and display the GRUB menu.
4573
4574In normal mode, commands, filesystem modules, and cryptography modules are
4575automatically loaded, and the full GRUB script parser is available.  Other
4576modules may be explicitly loaded using @command{insmod} (@pxref{insmod}).
4577
4578If a @var{file} is given, then commands will be read from that file.
4579Otherwise, they will be read from @file{$prefix/grub.cfg} if it exists.
4580
4581@command{normal} may be called from within normal mode, creating a nested
4582environment.  It is more usual to use @command{configfile}
4583(@pxref{configfile}) for this.
4584@end deffn
4585
4586
4587@node normal_exit
4588@subsection normal_exit
4589
4590@deffn Command normal_exit
4591Exit normal mode (@pxref{normal}).  If this instance of normal mode was not
4592nested within another one, then return to rescue mode.
4593@end deffn
4594
4595
4596@node parttool
4597@subsection parttool
4598
4599@deffn Command parttool partition commands
4600Make various modifications to partition table entries.
4601
4602Each @var{command} is either a boolean option, in which case it must be
4603followed with @samp{+} or @samp{-} (with no intervening space) to enable or
4604disable that option, or else it takes a value in the form
4605@samp{@var{command}=@var{value}}.
4606
4607Currently, @command{parttool} is only useful on DOS partition tables (also
4608known as Master Boot Record, or MBR).  On these partition tables, the
4609following commands are available:
4610
4611@table @asis
4612@item @samp{boot} (boolean)
4613When enabled, this makes the selected partition be the active (bootable)
4614partition on its disk, clearing the active flag on all other partitions.
4615This command is limited to @emph{primary} partitions.
4616
4617@item @samp{type} (value)
4618Change the type of an existing partition.  The value must be a number in the
4619range 0-0xFF (prefix with @samp{0x} to enter it in hexadecimal).
4620
4621@item @samp{hidden} (boolean)
4622When enabled, this hides the selected partition by setting the @dfn{hidden}
4623bit in its partition type code; when disabled, unhides the selected
4624partition by clearing this bit.  This is useful only when booting DOS or
4625Wwindows and multiple primary FAT partitions exist in one disk.  See also
4626@ref{DOS/Windows}.
4627@end table
4628@end deffn
4629
4630
4631@node password
4632@subsection password
4633
4634@deffn Command password user clear-password
4635Define a user named @var{user} with password @var{clear-password}.
4636@xref{Security}.
4637@end deffn
4638
4639
4640@node password_pbkdf2
4641@subsection password_pbkdf2
4642
4643@deffn Command password_pbkdf2 user hashed-password
4644Define a user named @var{user} with password hash @var{hashed-password}.
4645Use @command{grub-mkpasswd-pbkdf2} (@pxref{Invoking grub-mkpasswd-pbkdf2})
4646to generate password hashes.  @xref{Security}.
4647@end deffn
4648
4649
4650@node play
4651@subsection play
4652
4653@deffn Command play file | tempo [pitch1 duration1] [pitch2 duration2] @dots{}
4654Plays a tune
4655
4656If the argument is a file name (@pxref{File name syntax}), play the tune
4657recorded in it.  The file format is first the tempo as an unsigned 32bit
4658little-endian number, then pairs of unsigned 16bit little-endian numbers for
4659pitch and duration pairs.
4660
4661If the arguments are a series of numbers, play the inline tune.
4662
4663The tempo is the base for all note durations. 60 gives a 1-second base, 120
4664gives a half-second base, etc.  Pitches are Hz.  Set pitch to 0 to produce
4665a rest.
4666@end deffn
4667
4668
4669@node probe
4670@subsection probe
4671
4672@deffn Command probe [@option{--set} var] @option{--driver}|@option{--partmap}|@option{--fs}|@option{--fs-uuid}|@option{--label} device
4673Retrieve device information. If option @option{--set} is given, assign result
4674to variable @var{var}, otherwise print information on the screen.
4675@end deffn
4676
4677
4678@node pxe_unload
4679@subsection pxe_unload
4680
4681@deffn Command pxe_unload
4682Unload the PXE environment (@pxref{Network}).
4683
4684This command is only available on PC BIOS systems.
4685@end deffn
4686
4687
4688@node read
4689@subsection read
4690
4691@deffn Command read [var]
4692Read a line of input from the user.  If an environment variable @var{var} is
4693given, set that environment variable to the line of input that was read,
4694with no terminating newline.
4695@end deffn
4696
4697
4698@node reboot
4699@subsection reboot
4700
4701@deffn Command reboot
4702Reboot the computer.
4703@end deffn
4704
4705
4706@node regexp
4707@subsection regexp
4708
4709@deffn Command regexp [@option{--set} [number:]var] regexp string
4710Test if regular expression @var{regexp} matches @var{string}. Supported
4711regular expressions are POSIX.2 Extended Regular Expressions. If option
4712@option{--set} is given, store @var{number}th matched subexpression in
4713variable @var{var}. Subexpressions are numbered in order of their opening
4714parentheses starting from @samp{1}.  @var{number} defaults to @samp{1}.
4715@end deffn
4716
4717
4718@node rmmod
4719@subsection rmmod
4720
4721@deffn Command rmmod module
4722Remove a loaded @var{module}.
4723@end deffn
4724
4725
4726@node save_env
4727@subsection save_env
4728
4729@deffn Command save_env [@option{--file} file] var @dots{}
4730Save the named variables from the environment to the environment block file.
4731@xref{Environment block}.
4732
4733The @option{--file} option overrides the default location of the environment
4734block.
4735
4736This command will operate successfully even when environment variable
4737@code{check_signatures} is set to @code{enforce}
4738(@pxref{check_signatures}), since it writes to disk and does not alter
4739the behavior of GRUB based on any contents of disk that have been
4740read.  It is possible to modify a digitally signed environment block
4741file from within GRUB using this command, such that its signature will
4742no longer be valid on subsequent boots.  Care should be taken in such
4743advanced configurations to avoid rendering the system
4744unbootable. @xref{Using digital signatures}, for more information.
4745@end deffn
4746
4747
4748@node search
4749@subsection search
4750
4751@deffn Command search @
4752 [@option{--file}|@option{--label}|@option{--fs-uuid}] @
4753 [@option{--set} [var]] [@option{--no-floppy}] name
4754Search devices by file (@option{-f}, @option{--file}), filesystem label
4755(@option{-l}, @option{--label}), or filesystem UUID (@option{-u},
4756@option{--fs-uuid}).
4757
4758If the @option{--set} option is used, the first device found is set as the
4759value of environment variable @var{var}.  The default variable is
4760@samp{root}.
4761
4762The @option{--no-floppy} option prevents searching floppy devices, which can
4763be slow.
4764
4765The @samp{search.file}, @samp{search.fs_label}, and @samp{search.fs_uuid}
4766commands are aliases for @samp{search --file}, @samp{search --label}, and
4767@samp{search --fs-uuid} respectively.
4768@end deffn
4769
4770
4771@node sendkey
4772@subsection sendkey
4773
4774@deffn Command sendkey @
4775 [@option{--num}|@option{--caps}|@option{--scroll}|@option{--insert}|@
4776@option{--pause}|@option{--left-shift}|@option{--right-shift}|@
4777@option{--sysrq}|@option{--numkey}|@option{--capskey}|@option{--scrollkey}|@
4778@option{--insertkey}|@option{--left-alt}|@option{--right-alt}|@
4779@option{--left-ctrl}|@option{--right-ctrl} @
4780 @samp{on}|@samp{off}]@dots{} @
4781 [@option{no-led}] @
4782 keystroke
4783Insert keystrokes into the keyboard buffer when booting.  Sometimes an
4784operating system or chainloaded boot loader requires particular keys to be
4785pressed: for example, one might need to press a particular key to enter
4786"safe mode", or when chainloading another boot loader one might send
4787keystrokes to it to navigate its menu. 
4788
4789You may provide up to 16 keystrokes (the length of the BIOS keyboard
4790buffer).  Keystroke names may be upper-case or lower-case letters, digits,
4791or taken from the following table:
4792
4793@c Please keep this table in the same order as in
4794@c commands/i386/pc/sendkey.c, for ease of maintenance.
4795@c Exception: The function and numeric keys are sorted, for aesthetics.
4796
4797@multitable @columnfractions .4 .5
4798@headitem Name @tab Key
4799@item escape @tab Escape
4800@item exclam @tab !
4801@item at @tab @@
4802@item numbersign @tab #
4803@item dollar @tab $
4804@item percent @tab %
4805@item caret @tab ^
4806@item ampersand @tab &
4807@item asterisk @tab *
4808@item parenleft @tab (
4809@item parenright @tab )
4810@item minus @tab -
4811@item underscore @tab _
4812@item equal @tab =
4813@item plus @tab +
4814@item backspace @tab Backspace
4815@item tab @tab Tab
4816@item bracketleft @tab [
4817@item braceleft @tab @{
4818@item bracketright @tab ]
4819@item braceright @tab @}
4820@item enter @tab Enter
4821@item control @tab press and release Control
4822@item semicolon @tab ;
4823@item colon @tab :
4824@item quote @tab '
4825@item doublequote @tab "
4826@item backquote @tab `
4827@item tilde @tab ~
4828@item shift @tab press and release left Shift
4829@item backslash @tab \
4830@item bar @tab |
4831@item comma @tab ,
4832@item less @tab <
4833@item period @tab .
4834@item greater @tab >
4835@item slash @tab /
4836@item question @tab ?
4837@item rshift @tab press and release right Shift
4838@item alt @tab press and release Alt
4839@item space @tab space bar
4840@item capslock @tab Caps Lock
4841@item F1 @tab F1
4842@item F2 @tab F2
4843@item F3 @tab F3
4844@item F4 @tab F4
4845@item F5 @tab F5
4846@item F6 @tab F6
4847@item F7 @tab F7
4848@item F8 @tab F8
4849@item F9 @tab F9
4850@item F10 @tab F10
4851@item F11 @tab F11
4852@item F12 @tab F12
4853@item num1 @tab 1 (numeric keypad)
4854@item num2 @tab 2 (numeric keypad)
4855@item num3 @tab 3 (numeric keypad)
4856@item num4 @tab 4 (numeric keypad)
4857@item num5 @tab 5 (numeric keypad)
4858@item num6 @tab 6 (numeric keypad)
4859@item num7 @tab 7 (numeric keypad)
4860@item num8 @tab 8 (numeric keypad)
4861@item num9 @tab 9 (numeric keypad)
4862@item num0 @tab 0 (numeric keypad)
4863@item numperiod @tab . (numeric keypad)
4864@item numend @tab End (numeric keypad)
4865@item numdown @tab Down (numeric keypad)
4866@item numpgdown @tab Page Down (numeric keypad)
4867@item numleft @tab Left (numeric keypad)
4868@item numcenter @tab 5 with Num Lock inactive (numeric keypad)
4869@item numright @tab Right (numeric keypad)
4870@item numhome @tab Home (numeric keypad)
4871@item numup @tab Up (numeric keypad)
4872@item numpgup @tab Page Up (numeric keypad)
4873@item numinsert @tab Insert (numeric keypad)
4874@item numdelete @tab Delete (numeric keypad)
4875@item numasterisk @tab * (numeric keypad)
4876@item numminus @tab - (numeric keypad)
4877@item numplus @tab + (numeric keypad)
4878@item numslash @tab / (numeric keypad)
4879@item numenter @tab Enter (numeric keypad)
4880@item delete @tab Delete
4881@item insert @tab Insert
4882@item home @tab Home
4883@item end @tab End
4884@item pgdown @tab Page Down
4885@item pgup @tab Page Up
4886@item down @tab Down
4887@item up @tab Up
4888@item left @tab Left
4889@item right @tab Right
4890@end multitable
4891
4892As well as keystrokes, the @command{sendkey} command takes various options
4893that affect the BIOS keyboard status flags.  These options take an @samp{on}
4894or @samp{off} parameter, specifying that the corresponding status flag be
4895set or unset; omitting the option for a given status flag will leave that
4896flag at its initial state at boot.  The @option{--num}, @option{--caps},
4897@option{--scroll}, and @option{--insert} options emulate setting the
4898corresponding mode, while the @option{--numkey}, @option{--capskey},
4899@option{--scrollkey}, and @option{--insertkey} options emulate pressing and
4900holding the corresponding key.  The other status flag options are
4901self-explanatory.
4902
4903If the @option{--no-led} option is given, the status flag options will have
4904no effect on keyboard LEDs.
4905
4906If the @command{sendkey} command is given multiple times, then only the last
4907invocation has any effect.
4908
4909Since @command{sendkey} manipulates the BIOS keyboard buffer, it may cause
4910hangs, reboots, or other misbehaviour on some systems.  If the operating
4911system or boot loader that runs after GRUB uses its own keyboard driver
4912rather than the BIOS keyboard functions, then @command{sendkey} will have no
4913effect.
4914
4915This command is only available on PC BIOS systems.
4916@end deffn
4917
4918
4919@node set
4920@subsection set
4921
4922@deffn Command set [envvar=value]
4923Set the environment variable @var{envvar} to @var{value}. If invoked with no
4924arguments, print all environment variables with their values.
4925@end deffn
4926
4927
4928@node sha1sum
4929@subsection sha1sum
4930
4931@deffn Command sha1sum arg @dots{}
4932Alias for @code{hashsum --hash sha1 arg @dots{}}. See command @command{hashsum}
4933(@pxref{hashsum}) for full description.
4934@end deffn
4935
4936
4937@node sha256sum
4938@subsection sha256sum
4939
4940@deffn Command sha256sum arg @dots{}
4941Alias for @code{hashsum --hash sha256 arg @dots{}}. See command @command{hashsum}
4942(@pxref{hashsum}) for full description.
4943@end deffn
4944
4945
4946@node sha512sum
4947@subsection sha512sum
4948
4949@deffn Command sha512sum arg @dots{}
4950Alias for @code{hashsum --hash sha512 arg @dots{}}. See command @command{hashsum}
4951(@pxref{hashsum}) for full description.
4952@end deffn
4953
4954
4955@node sleep
4956@subsection sleep
4957
4958@deffn Command sleep [@option{--verbose}] [@option{--interruptible}] count
4959Sleep for @var{count} seconds. If option @option{--interruptible} is given,
4960allow @key{ESC} to interrupt sleep. With @option{--verbose} show countdown
4961of remaining seconds. Exit code is set to 0 if timeout expired and to 1
4962if timeout was interrupted by @key{ESC}.
4963@end deffn
4964
4965
4966@node source
4967@subsection source
4968
4969@deffn Command source file
4970Read @var{file} as a configuration file, as if its contents had been
4971incorporated directly into the sourcing file.  Unlike @command{configfile}
4972(@pxref{configfile}), this executes the contents of @var{file} without
4973changing context: any environment variable changes made by the commands in
4974@var{file} will be preserved after @command{source} returns, and the menu
4975will not be shown immediately.
4976@end deffn
4977
4978
4979@node test
4980@subsection test
4981
4982@deffn Command test expression
4983Evaluate @var{expression} and return zero exit status if result is true,
4984non zero status otherwise.
4985
4986@var{expression} is one of:
4987
4988@table @asis
4989@item @var{string1} @code{==} @var{string2}
4990the strings are equal
4991@item @var{string1} @code{!=} @var{string2}
4992the strings are not equal
4993@item @var{string1} @code{<} @var{string2}
4994@var{string1} is lexicographically less than @var{string2}
4995@item @var{string1} @code{<=} @var{string2}
4996@var{string1} is lexicographically less or equal than @var{string2}
4997@item @var{string1} @code{>} @var{string2}
4998@var{string1} is lexicographically greater than @var{string2}
4999@item @var{string1} @code{>=} @var{string2}
5000@var{string1} is lexicographically greater or equal than @var{string2}
5001@item @var{integer1} @code{-eq} @var{integer2}
5002@var{integer1} is equal to @var{integer2}
5003@item @var{integer1} @code{-ge} @var{integer2}
5004@var{integer1} is greater than or equal to @var{integer2}
5005@item @var{integer1} @code{-gt} @var{integer2}
5006@var{integer1} is greater than @var{integer2}
5007@item @var{integer1} @code{-le} @var{integer2}
5008@var{integer1} is less than or equal to @var{integer2}
5009@item @var{integer1} @code{-lt} @var{integer2}
5010@var{integer1} is less than @var{integer2}
5011@item @var{integer1} @code{-ne} @var{integer2}
5012@var{integer1} is not equal to @var{integer2}
5013@item @var{prefix}@var{integer1} @code{-pgt} @var{prefix}@var{integer2}
5014@var{integer1} is greater than @var{integer2} after stripping off common non-numeric @var{prefix}.
5015@item @var{prefix}@var{integer1} @code{-plt} @var{prefix}@var{integer2}
5016@var{integer1} is less than @var{integer2} after stripping off common non-numeric @var{prefix}.
5017@item @var{file1} @code{-nt} @var{file2}
5018@var{file1} is newer than @var{file2} (modification time). Optionally numeric @var{bias} may be directly appended to @code{-nt} in which case it is added to the first file modification time.
5019@item @var{file1} @code{-ot} @var{file2}
5020@var{file1} is older than @var{file2} (modification time). Optionally numeric @var{bias} may be directly appended to @code{-ot} in which case it is added to the first file modification time.
5021@item @code{-d} @var{file}
5022@var{file} exists and is a directory
5023@item @code{-e} @var{file}
5024@var{file} exists
5025@item @code{-f} @var{file}
5026@var{file} exists and is not a directory
5027@item @code{-s} @var{file}
5028@var{file} exists and has a size greater than zero
5029@item @code{-n} @var{string}
5030the length of @var{string} is nonzero
5031@item @var{string}
5032@var{string} is equivalent to @code{-n @var{string}}
5033@item @code{-z} @var{string}
5034the length of @var{string} is zero
5035@item @code{(} @var{expression} @code{)}
5036@var{expression} is true
5037@item @code{!} @var{expression}
5038@var{expression} is false
5039@item @var{expression1} @code{-a} @var{expression2}
5040both @var{expression1} and @var{expression2} are true
5041@item @var{expression1} @code{-o} @var{expression2}
5042either @var{expression1} or @var{expression2} is true
5043@end table
5044@end deffn
5045
5046
5047@node true
5048@subsection true
5049
5050@deffn Command true
5051Do nothing, successfully.  This is mainly useful in control constructs such
5052as @code{if} and @code{while} (@pxref{Shell-like scripting}).
5053@end deffn
5054
5055@node trust
5056@subsection trust
5057
5058@deffn Command trust [@option{--skip-sig}] pubkey_file
5059Read public key from @var{pubkey_file} and add it to GRUB's internal
5060list of trusted public keys.  These keys are used to validate digital
5061signatures when environment variable @code{check_signatures} is set to
5062@code{enforce}.  Note that if @code{check_signatures} is set to
5063@code{enforce} when @command{trust} executes, then @var{pubkey_file}
5064must itself be properly signed.  The @option{--skip-sig} option can be
5065used to disable signature-checking when reading @var{pubkey_file}
5066itself. It is expected that @option{--skip-sig} is useful for testing
5067and manual booting. @xref{Using digital signatures}, for more
5068information.
5069@end deffn
5070
5071
5072@node unset
5073@subsection unset
5074
5075@deffn Command unset envvar
5076Unset the environment variable @var{envvar}.
5077@end deffn
5078
5079
5080@node uppermem
5081@subsection uppermem
5082
5083This command is not yet implemented for GRUB 2, although it is planned.
5084
5085
5086@ignore
5087@node vbeinfo
5088@subsection vbeinfo
5089
5090@deffn Command vbeinfo [[WxH]xD]
5091Alias for command @command{videoinfo} (@pxref{videoinfo}). It is available
5092only on PC BIOS platforms.
5093@end deffn
5094@end ignore
5095
5096
5097@node verify_detached
5098@subsection verify_detached
5099
5100@deffn Command verify_detached [@option{--skip-sig}] file signature_file [pubkey_file]
5101Verifies a GPG-style detached signature, where the signed file is
5102@var{file}, and the signature itself is in file @var{signature_file}.
5103Optionally, a specific public key to use can be specified using
5104@var{pubkey_file}.  When environment variable @code{check_signatures}
5105is set to @code{enforce}, then @var{pubkey_file} must itself be
5106properly signed by an already-trusted key.  An unsigned
5107@var{pubkey_file} can be loaded by specifying @option{--skip-sig}.
5108If @var{pubkey_file} is omitted, then public keys from GRUB's trusted keys
5109(@pxref{list_trusted}, @pxref{trust}, and @pxref{distrust}) are
5110tried.
5111
5112Exit code @code{$?} is set to 0 if the signature validates
5113successfully.  If validation fails, it is set to a non-zero value.
5114@xref{Using digital signatures}, for more information.
5115@end deffn
5116
5117@node videoinfo
5118@subsection videoinfo
5119
5120@deffn Command videoinfo [[WxH]xD]
5121List available video modes. If resolution is given, show only matching modes.
5122@end deffn
5123
5124@node Networking commands
5125@section The list of networking commands
5126
5127@menu
5128* net_add_addr::                Add a network address
5129* net_add_dns::                 Add a DNS server
5130* net_add_route::               Add routing entry
5131* net_bootp::                   Perform a bootp autoconfiguration
5132* net_del_addr::                Remove IP address from interface
5133* net_del_dns::                 Remove a DNS server
5134* net_del_route::               Remove a route entry
5135* net_get_dhcp_option::         Retrieve DHCP options
5136* net_ipv6_autoconf::           Perform IPv6 autoconfiguration
5137* net_ls_addr::                 List interfaces
5138* net_ls_cards::                List network cards
5139* net_ls_dns::                  List DNS servers
5140* net_ls_routes::               List routing entries
5141* net_nslookup::                Perform a DNS lookup
5142@end menu
5143
5144
5145@node net_add_addr
5146@subsection net_add_addr
5147
5148@deffn Command net_add_addr @var{interface} @var{card} @var{address}
5149Configure additional network @var{interface} with @var{address} on a
5150network @var{card}. @var{address} can be either IP in dotted decimal notation,
5151or symbolic name which is resolved using DNS lookup. If successful, this command
5152also adds local link routing entry to the default subnet of @var{address}
5153with name @var{interface}@samp{:local} via @var{interface}.
5154@end deffn
5155
5156
5157@node net_add_dns
5158@subsection net_add_dns
5159
5160@deffn Command net_add_dns @var{server}
5161Resolve @var{server} IP address and add to the list of DNS servers used during
5162name lookup.
5163@end deffn
5164
5165
5166@node net_add_route
5167@subsection net_add_route
5168
5169@deffn Command net_add_route @var{shortname} @var{ip}[/@var{prefix}] [@var{interface} | @samp{gw} @var{gateway}]
5170Add route to network with address @var{ip} as modified by @var{prefix} via
5171either local @var{interface} or @var{gateway}. @var{prefix} is optional and
5172defaults to 32 for IPv4 address and 128 for IPv6 address. Route is identified
5173by @var{shortname} which can be used to remove it (@pxref{net_del_route}).
5174@end deffn
5175
5176
5177@node net_bootp
5178@subsection net_bootp
5179
5180@deffn Command net_bootp [@var{card}]
5181Perform configuration of @var{card} using DHCP protocol. If no card name
5182is specified, try to configure all existing cards. If configuration was
5183successful, interface with name @var{card}@samp{:dhcp} and configured
5184address is added to @var{card}. If server provided gateway information in
5185DHCP ACK packet, it is added as route entry with the name @var{card}@samp{:dhcp:gw}. Additionally the following DHCP options are recognized and processed:
5186
5187@table @samp
5188@item 1 (Subnet Mask)
5189Used to calculate network local routing entry for interface @var{card}@samp{:dhcp}.
5190@item 3 (Router)
5191Adds default route entry with the name @var{card}@samp{:dhcp:default} via gateway
5192from DHCP option. Note that only option with single route is accepted.
5193@item 6 (Domain Name Server)
5194Adds all servers from option value to the list of servers used during name resolution.
5195@item 12 (Host Name)
5196Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_hostname}
5197(@pxref{net_@var{<interface>}_hostname}) to the value of option.
5198@item 15 (Domain Name)
5199Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_domain}
5200(@pxref{net_@var{<interface>}_domain}) to the value of option.
5201@item 17 (Root Path)
5202Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_rootpath}
5203(@pxref{net_@var{<interface>}_rootpath}) to the value of option.
5204@item 18 (Extensions Path)
5205Sets environment variable @samp{net_}@var{<card>}@samp{_dhcp_extensionspath}
5206(@pxref{net_@var{<interface>}_extensionspath}) to the value of option.
5207@end table
5208
5209@end deffn
5210
5211
5212@node net_del_addr
5213@subsection net_del_addr
5214
5215@deffn Command net_del_addr @var{interface}
5216Remove configured @var{interface} with associated address.
5217@end deffn
5218
5219
5220@node net_del_dns
5221@subsection net_del_dns
5222
5223@deffn Command net_del_dns @var{address}
5224Remove @var{address} from list of servers used during name lookup.
5225@end deffn
5226
5227
5228@node net_del_route
5229@subsection net_del_route
5230
5231@deffn Command net_del_route @var{shortname}
5232Remove route entry identified by @var{shortname}.
5233@end deffn
5234
5235
5236@node net_get_dhcp_option
5237@subsection net_get_dhcp_option
5238
5239@deffn Command net_get_dhcp_option @var{var} @var{interface} @var{number} @var{type}
5240Request DHCP option @var{number} of @var{type} via @var{interface}. @var{type}
5241can be one of @samp{string}, @samp{number} or @samp{hex}. If option is found,
5242assign its value to variable @var{var}. Values of types @samp{number} and @samp{hex}
5243are converted to string representation.
5244@end deffn
5245
5246
5247@node net_ipv6_autoconf
5248@subsection net_ipv6_autoconf
5249
5250@deffn Command net_ipv6_autoconf [@var{card}]
5251Perform IPv6 autoconfiguration by adding to the @var{card} interface with name
5252@var{card}@samp{:link} and link local MAC-based address. If no card is specified,
5253perform autoconfiguration for all existing cards.
5254@end deffn
5255
5256
5257@node net_ls_addr
5258@subsection net_ls_addr
5259
5260@deffn Command net_ls_addr
5261List all configured interfaces with their MAC and IP addresses.
5262@end deffn
5263
5264
5265@node net_ls_cards
5266@subsection net_ls_cards
5267
5268@deffn Command net_ls_cards
5269List all detected network cards with their MAC address.
5270@end deffn
5271
5272
5273@node net_ls_dns
5274@subsection net_ls_dns
5275
5276@deffn Command net_ls_dns
5277List addresses of DNS servers used during name lookup.
5278@end deffn
5279
5280
5281@node net_ls_routes
5282@subsection net_ls_routes
5283
5284@deffn Command net_ls_routes
5285List routing entries.
5286@end deffn
5287
5288
5289@node net_nslookup
5290@subsection net_nslookup
5291
5292@deffn Command net_nslookup @var{name} [@var{server}]
5293Resolve address of @var{name} using DNS server @var{server}. If no server
5294is given, use default list of servers.
5295@end deffn
5296
5297
5298@node Internationalisation
5299@chapter Internationalisation
5300
5301@section Charset
5302GRUB uses UTF-8 internally other than in rendering where some GRUB-specific
5303appropriate representation is used. All text files (including config) are
5304assumed to be encoded in UTF-8.
5305
5306@section Filesystems
5307NTFS, JFS, UDF, HFS+, exFAT, long filenames in FAT, Joliet part of
5308ISO9660 are treated as UTF-16 as per specification. AFS and BFS are read
5309as UTF-8, again according to specification. BtrFS, cpio, tar, squash4, minix,
5310minix2, minix3, ROMFS, ReiserFS, XFS, ext2, ext3, ext4, FAT (short names),
5311RockRidge part of ISO9660, nilfs2, UFS1, UFS2 and ZFS are assumed
5312to be UTF-8. This might be false on systems configured with legacy charset
5313but as long as the charset used is superset of ASCII you should be able to
5314access ASCII-named files. And it's recommended to configure your system to use
5315UTF-8 to access the filesystem, convmv may help with migration. ISO9660 (plain)
5316filenames are specified as being ASCII or being described with unspecified
5317escape sequences. GRUB assumes that the ISO9660 names are UTF-8 (since
5318any ASCII is valid UTF-8). There are some old CD-ROMs which use CP437
5319in non-compliant way. You're still able to access files with names containing
5320only ASCII characters on such filesystems though. You're also able to access
5321any file if the filesystem contains valid Joliet (UTF-16) or RockRidge (UTF-8).
5322AFFS, SFS and HFS never use unicode and GRUB assumes them to be in Latin1,
5323Latin1 and MacRoman respectively. GRUB handles filesystem case-insensitivity
5324however no attempt is performed at case conversion of international characters
5325so e.g. a file named lowercase greek alpha is treated as different from
5326the one named as uppercase alpha. The filesystems in questions are
5327NTFS (except POSIX namespace), HFS+ (configurable at mkfs time, default
5328insensitive), SFS (configurable at mkfs time, default insensitive),
5329JFS (configurable at mkfs time, default sensitive), HFS, AFFS, FAT, exFAT
5330and ZFS (configurable on per-subvolume basis by property ``casesensitivity'',
5331default sensitive). On ZFS subvolumes marked as case insensitive files
5332containing lowercase international characters are inaccessible.
5333Also like all supported filesystems except HFS+ and ZFS (configurable on
5334per-subvolume basis by property ``normalization'', default none) GRUB makes
5335no attempt at check of canonical equivalence so a file name u-diaresis is
5336treated as distinct from u+combining diaresis. This however means that in
5337order to access file on HFS+ its name must be specified in normalisation form D.
5338On normalized ZFS subvolumes filenames out of normalisation are inaccessible.
5339
5340@section Output terminal
5341Firmware output console ``console'' on ARC and IEEE1275 are limited to ASCII.
5342
5343BIOS firmware console and VGA text are limited to ASCII and some pseudographics.
5344
5345None of above mentioned is appropriate for displaying international and any
5346unsupported character is replaced with question mark except pseudographics
5347which we attempt to approximate with ASCII.
5348
5349EFI console on the other hand nominally supports UTF-16 but actual language
5350coverage depends on firmware and may be very limited.
5351
5352The encoding used on serial can be chosen with @command{terminfo} as
5353either ASCII, UTF-8 or ``visual UTF-8''. Last one is against the specification
5354but results in correct rendering of right-to-left on some readers which don't
5355have own bidi implementation.
5356
5357On emu GRUB checks if charset is UTF-8 and uses it if so and uses ASCII
5358otherwise.
5359
5360When using gfxterm or gfxmenu GRUB itself is responsible for rendering the
5361text. In this case GRUB is limited by loaded fonts. If fonts contain all
5362required characters then bidirectional text, cursive variants and combining
5363marks other than enclosing, half (e.g. left half tilde or combining overline)
5364and double ones. Ligatures aren't supported though. This should cover European,
5365Middle Eastern (if you don't mind lack of lam-alif ligature in Arabic) and
5366East Asian scripts. Notable unsupported scripts are Brahmic family and
5367derived as well as Mongolian, Tifinagh, Korean Jamo (precomposed characters
5368have no problem) and tonal writing (2e5-2e9). GRUB also ignores deprecated
5369(as specified in Unicode) characters (e.g. tags). GRUB also doesn't handle so
5370called ``annotation characters'' If you can complete either of
5371two lists or, better, propose a patch to improve rendering, please contact
5372developer team.
5373
5374@section Input terminal
5375Firmware console on BIOS, IEEE1275 and ARC doesn't allow you to enter non-ASCII
5376characters. EFI specification allows for such but author is unaware of any
5377actual implementations. Serial input is currently limited for latin1 (unlikely
5378to change). Own keyboard implementations (at_keyboard and usb_keyboard)
5379supports any key but work on one-char-per-keystroke.
5380So no dead keys or advanced input method. Also there is no keymap change hotkey.
5381In practice it makes difficult to enter any text using non-Latin alphabet.
5382Moreover all current input consumers are limited to ASCII.
5383
5384@section Gettext
5385GRUB supports being translated. For this you need to have language *.mo files in $prefix/locale, load gettext module and set ``lang'' variable.
5386
5387@section Regexp
5388Regexps work on unicode characters, however no attempt at checking cannonical
5389equivalence has been made. Moreover the classes like [:alpha:] match only
5390ASCII subset.
5391
5392@section Other
5393Currently GRUB always uses YEAR-MONTH-DAY HOUR:MINUTE:SECOND [WEEKDAY] 24-hour
5394datetime format but weekdays are translated.
5395GRUB always uses the decimal number format with [0-9] as digits and . as
5396descimal separator and no group separator.
5397IEEE1275 aliases are matched case-insensitively except non-ASCII which is
5398matched as binary. Similar behaviour is for matching OSBundleRequired.
5399Since IEEE1275 aliases and OSBundleRequired don't contain any non-ASCII it
5400should never be a problem in practice.
5401Case-sensitive identifiers are matched as raw strings, no canonical
5402equivalence check is performed. Case-insenstive identifiers are matched
5403as RAW but additionally [a-z] is equivalent to [A-Z]. GRUB-defined
5404identifiers use only ASCII and so should user-defined ones.
5405Identifiers containing non-ASCII may work but aren't supported.
5406Only the ASCII space characters (space U+0020, tab U+000b, CR U+000d and
5407LF U+000a) are recognised. Other unicode space characters aren't a valid
5408field separator.
5409@command{test} (@pxref{test}) tests <, >, <=, >=, -pgt and -plt compare the strings in the
5410lexicographical order of unicode codepoints, replicating the behaviour of
5411test from coreutils.
5412environment variables and commands are listed in the same order.
5413
5414@node Security
5415@chapter Security
5416
5417@menu
5418* Authentication and authorisation:: Users and access control
5419* Using digital signatures::         Booting digitally signed code
5420@end menu
5421
5422@node Authentication and authorisation
5423@section Authentication and authorisation in GRUB
5424
5425By default, the boot loader interface is accessible to anyone with physical
5426access to the console: anyone can select and edit any menu entry, and anyone
5427can get direct access to a GRUB shell prompt.  For most systems, this is
5428reasonable since anyone with direct physical access has a variety of other
5429ways to gain full access, and requiring authentication at the boot loader
5430level would only serve to make it difficult to recover broken systems.
5431
5432However, in some environments, such as kiosks, it may be appropriate to lock
5433down the boot loader to require authentication before performing certain
5434operations.
5435
5436The @samp{password} (@pxref{password}) and @samp{password_pbkdf2}
5437(@pxref{password_pbkdf2}) commands can be used to define users, each of
5438which has an associated password.  @samp{password} sets the password in
5439plain text, requiring @file{grub.cfg} to be secure; @samp{password_pbkdf2}
5440sets the password hashed using the Password-Based Key Derivation Function
5441(RFC 2898), requiring the use of @command{grub-mkpasswd-pbkdf2}
5442(@pxref{Invoking grub-mkpasswd-pbkdf2}) to generate password hashes.
5443
5444In order to enable authentication support, the @samp{superusers} environment
5445variable must be set to a list of usernames, separated by any of spaces,
5446commas, semicolons, pipes, or ampersands.  Superusers are permitted to use
5447the GRUB command line, edit menu entries, and execute any menu entry.  If
5448@samp{superusers} is set, then use of the command line is automatically
5449restricted to superusers.
5450
5451Other users may be given access to specific menu entries by giving a list of
5452usernames (as above) using the @option{--users} option to the
5453@samp{menuentry} command (@pxref{menuentry}).  If the @option{--unrestricted}
5454option is used for a menu entry, then that entry is unrestricted.
5455If the @option{--users} option is not used for a menu entry, then that
5456only superusers are able to use it.
5457
5458Putting this together, a typical @file{grub.cfg} fragment might look like
5459this:
5460
5461@example
5462@group
5463set superusers="root"
5464password_pbkdf2 root grub.pbkdf2.sha512.10000.biglongstring
5465password user1 insecure
5466
5467menuentry "May be run by any user" --unrestricted @{
5468        set root=(hd0,1)
5469        linux /vmlinuz
5470@}
5471
5472menuentry "Superusers only" --users "" @{
5473        set root=(hd0,1)
5474        linux /vmlinuz single
5475@}
5476
5477menuentry "May be run by user1 or a superuser" --users user1 @{
5478        set root=(hd0,2)
5479        chainloader +1
5480@}
5481@end group
5482@end example
5483
5484The @command{grub-mkconfig} program does not yet have built-in support for
5485generating configuration files with authentication.  You can use
5486@file{/etc/grub.d/40_custom} to add simple superuser authentication, by
5487adding @kbd{set superusers=} and @kbd{password} or @kbd{password_pbkdf2}
5488commands.
5489
5490@node Using digital signatures
5491@section Using digital signatures in GRUB
5492
5493GRUB's @file{core.img} can optionally provide enforcement that all files
5494subsequently read from disk are covered by a valid digital signature.
5495This document does @strong{not} cover how to ensure that your
5496platform's firmware (e.g., Coreboot) validates @file{core.img}.
5497
5498If environment variable @code{check_signatures}
5499(@pxref{check_signatures}) is set to @code{enforce}, then every
5500attempt by the GRUB @file{core.img} to load another file @file{foo}
5501implicitly invokes @code{verify_detached foo foo.sig}
5502(@pxref{verify_detached}).  @code{foo.sig} must contain a valid
5503digital signature over the contents of @code{foo}, which can be
5504verified with a public key currently trusted by GRUB
5505(@pxref{list_trusted}, @pxref{trust}, and @pxref{distrust}).  If
5506validation fails, then file @file{foo} cannot be opened.  This failure
5507may halt or otherwise impact the boot process.
5508
5509@comment Unfortunately --pubkey is not yet supported by grub-install,
5510@comment but we should not bring up internal detail grub-mkimage here
5511@comment in the user guide (as opposed to developer's manual).
5512
5513@comment An initial trusted public key can be embedded within the GRUB
5514@comment @file{core.img} using the @code{--pubkey} option to
5515@comment @command{grub-mkimage} (@pxref{Invoking grub-install}).  Presently it
5516@comment is necessary to write a custom wrapper around @command{grub-mkimage}
5517@comment using the @code{--grub-mkimage} flag to @command{grub-install}.
5518
5519GRUB uses GPG-style detached signatures (meaning that a file
5520@file{foo.sig} will be produced when file @file{foo} is signed), and
5521currently supports the DSA and RSA signing algorithms. A signing key
5522can be generated as follows:
5523
5524@example
5525gpg --gen-key
5526@end example
5527
5528An individual file can be signed as follows:
5529
5530@example
5531gpg --detach-sign /path/to/file
5532@end example
5533
5534For successful validation of all of GRUB's subcomponents and the
5535loaded OS kernel, they must all be signed.  One way to accomplish this
5536is the following (after having already produced the desired
5537@file{grub.cfg} file, e.g., by running @command{grub-mkconfig}
5538(@pxref{Invoking grub-mkconfig}):
5539
5540@example
5541@group
5542# Edit /dev/shm/passphrase.txt to contain your signing key's passphrase
5543for i in `find /boot -name "*.cfg" -or -name "*.lst" -or \
5544  -name "*.mod" -or -name "vmlinuz*" -or -name "initrd*" -or \
5545  -name "grubenv"`;
5546do
5547  gpg --batch --detach-sign --passphrase-fd 0 $i < \
5548    /dev/shm/passphrase.txt
5549done
5550shred /dev/shm/passphrase.txt
5551@end group
5552@end example
5553
5554See also: @ref{check_signatures}, @ref{verify_detached}, @ref{trust},
5555@ref{list_trusted}, @ref{distrust}, @ref{load_env}, @ref{save_env}.
5556
5557Note that internally signature enforcement is controlled by setting
5558the environment variable @code{check_signatures} equal to
5559@code{enforce}.  Passing one or more @code{--pubkey} options to
5560@command{grub-mkimage} implicitly defines @code{check_signatures}
5561equal to @code{enforce} in @file{core.img} prior to processing any
5562configuration files.
5563
5564Note that signature checking does @strong{not} prevent an attacker
5565with (serial, physical, ...) console access from dropping manually to
5566the GRUB console and executing:
5567
5568@example
5569set check_signatures=no
5570@end example
5571
5572To prevent this, password-protection (@pxref{Authentication and
5573authorisation}) is essential.  Note that even with GRUB password
5574protection, GRUB itself cannot prevent someone with physical access to
5575the machine from altering that machine's firmware (e.g., Coreboot
5576or BIOS) configuration to cause the machine to boot from a different
5577(attacker-controlled) device.  GRUB is at best only one link in a
5578secure boot chain.
5579
5580@node Platform limitations
5581@chapter Platform limitations
5582
5583GRUB2 is designed to be portable and is actually ported across platforms. We
5584try to keep all platforms at the level. Unfortunately some platforms are better
5585supported than others. This is detailed in current and 2 following sections.
5586
5587ARC platform is unable to change datetime (firmware doesn't seem to provide a
5588function for it).
5589EMU has similar limitation.
5590
5591On EMU platform no serial port is available.
5592
5593Console charset refers only to firmware-assisted console. gfxterm is always
5594Unicode (see Internationalisation section for its limitations). Serial is
5595configurable to UTF-8 or ASCII (see Internationalisation). In case of qemu
5596and coreboot ports the refered console is vga_text. Loongson always uses
5597gfxterm.
5598
5599Most limited one is ASCII. CP437 provides additionally pseudographics.
5600GRUB2 doesn't use any language characters from CP437 as often CP437 is replaced
5601by national encoding compatible only in pseudographics.
5602Unicode is the most versatile charset which supports many languages. However
5603the actual console may be much more limited depending on firmware
5604
5605On BIOS network is supported only if the image is loaded through network.
5606On sparc64 GRUB is unable to determine which server it was booted from.
5607
5608Direct ATA/AHCI support allows to circumvent various firmware limitations but
5609isn't needed for normal operation except on baremetal ports.
5610
5611AT keyboard support allows keyboard layout remapping and support for keys not
5612available through firmware. It isn't needed for normal operation except
5613baremetal ports.
5614
5615Speaker allows morse and spkmodem communication.
5616
5617USB support provides benefits similar to ATA (for USB disks) or AT (for USB
5618keyboards). In addition it allows USBserial.
5619
5620Chainloading refers to the ability to load another bootloader through the same protocol
5621
5622Hints allow faster disk discovery by already knowing in advance which is the disk in
5623question. On some platforms hints are correct unless you move the disk between boots.
5624On other platforms it's just an educated guess.
5625Note that hint failure results in just reduced performance, not a failure
5626
5627BadRAM is the ability to mark some of the RAM as ``bad''. Note: due to protocol
5628limitations mips-loongson (with Linux protocol)
5629and mips-qemu_mips can use only memory up to first hole.
5630
5631@multitable @columnfractions .20 .20 .20 .20 .20
5632@item                    @tab BIOS    @tab Coreboot @tab Multiboot    @tab Qemu
5633@item video              @tab yes     @tab yes      @tab yes          @tab yes
5634@item console charset    @tab CP437   @tab CP437    @tab CP437        @tab CP437
5635@item network            @tab yes (*) @tab no       @tab no           @tab no
5636@item ATA/AHCI           @tab yes     @tab yes      @tab yes          @tab yes
5637@item AT keyboard        @tab yes     @tab yes      @tab yes          @tab yes
5638@item Speaker            @tab yes     @tab yes      @tab yes          @tab yes
5639@item USB                @tab yes     @tab yes      @tab yes          @tab yes
5640@item chainloader        @tab local   @tab yes      @tab yes          @tab no
5641@item cpuid              @tab partial @tab partial  @tab partial      @tab partial
5642@item hints              @tab guess   @tab guess    @tab guess        @tab guess
5643@item PCI                @tab yes     @tab yes      @tab yes          @tab yes
5644@item badram             @tab yes     @tab yes      @tab yes          @tab yes
5645@item compression        @tab always  @tab pointless @tab no           @tab no
5646@item exit               @tab yes     @tab no       @tab no           @tab no
5647@end multitable
5648
5649@multitable @columnfractions .20 .20 .20 .20 .20
5650@item                    @tab ia32 EFI    @tab amd64 EFI @tab ia32 IEEE1275 @tab Itanium
5651@item video              @tab yes         @tab yes       @tab no            @tab no
5652@item console charset    @tab Unicode     @tab Unicode   @tab ASCII         @tab Unicode
5653@item network            @tab yes         @tab yes       @tab yes           @tab yes
5654@item ATA/AHCI           @tab yes         @tab yes       @tab yes           @tab no
5655@item AT keyboard        @tab yes         @tab yes       @tab yes           @tab no
5656@item Speaker            @tab yes         @tab yes       @tab yes           @tab no
5657@item USB                @tab yes         @tab yes       @tab yes           @tab no
5658@item chainloader        @tab local       @tab local     @tab no            @tab local
5659@item cpuid              @tab partial     @tab partial   @tab partial       @tab no
5660@item hints              @tab guess       @tab guess     @tab good          @tab guess
5661@item PCI                @tab yes         @tab yes       @tab yes           @tab no
5662@item badram             @tab yes         @tab yes       @tab no            @tab yes
5663@item compression        @tab no          @tab no        @tab no            @tab no
5664@item exit               @tab yes         @tab yes       @tab yes           @tab yes
5665@end multitable
5666
5667@multitable @columnfractions .20 .20 .20 .20 .20
5668@item                    @tab Loongson    @tab sparc64 @tab Powerpc @tab ARC
5669@item video              @tab yes         @tab no      @tab yes     @tab no
5670@item console charset    @tab N/A         @tab ASCII   @tab ASCII   @tab ASCII
5671@item network            @tab no          @tab yes (*) @tab yes     @tab no
5672@item ATA/AHCI           @tab yes         @tab no      @tab no      @tab no
5673@item AT keyboard        @tab yes         @tab no      @tab no      @tab no
5674@item Speaker            @tab no          @tab no      @tab no      @tab no
5675@item USB                @tab yes         @tab no      @tab no      @tab no
5676@item chainloader        @tab yes         @tab no      @tab no      @tab no
5677@item cpuid              @tab no          @tab no      @tab no      @tab no
5678@item hints              @tab good        @tab good    @tab good    @tab no
5679@item PCI                @tab yes         @tab no      @tab no      @tab no
5680@item badram             @tab yes (*)     @tab no      @tab no      @tab no
5681@item compression        @tab configurable @tab no     @tab no      @tab configurable
5682@item exit               @tab no          @tab yes     @tab yes     @tab yes
5683@end multitable
5684
5685@multitable @columnfractions .20 .20 .20 .20 .20
5686@item                    @tab MIPS qemu @tab emu
5687@item video              @tab no        @tab yes
5688@item console charset    @tab CP437     @tab Unicode (*)
5689@item network            @tab no        @tab yes
5690@item ATA/AHCI           @tab yes       @tab no
5691@item AT keyboard        @tab yes       @tab no
5692@item Speaker            @tab no        @tab no
5693@item USB                @tab N/A       @tab yes
5694@item chainloader        @tab yes       @tab no
5695@item cpuid              @tab no        @tab no
5696@item hints              @tab guess     @tab no
5697@item PCI                @tab no        @tab no
5698@item badram             @tab yes (*)   @tab no
5699@item compression        @tab configurable @tab no
5700@item exit               @tab no        @tab yes
5701@end multitable
5702
5703@node Platform-specific operations
5704@chapter Outline
5705
5706Some platforms have features which allows to implement
5707some commands useless or not implementable on others.
5708
5709Quick summary:
5710
5711Information retrieval:
5712
5713@itemize
5714@item mipsel-loongson: lsspd
5715@item mips-arc: lsdev
5716@item efi: lsefisystab, lssal, lsefimmap, lsefi
5717@item i386-pc: lsapm
5718@item i386-coreboot: lscoreboot, coreboot_boottime, cbmemc
5719@item acpi-enabled (i386-pc, i386-coreboot, i386-multiboot, *-efi): lsacpi
5720@end itemize
5721
5722Workarounds for platform-specific issues:
5723@itemize
5724@item i386-efi/x86_64-efi: loadbios, fakebios, fix_video
5725@item acpi-enabled (i386-pc, i386-coreboot, i386-multiboot, *-efi):
5726    acpi (override ACPI tables)
5727@item i386-pc: drivemap
5728@item i386-pc: sendkey
5729@end itemize
5730
5731Advanced operations for power users:
5732@itemize
5733@item x86: iorw (direct access to I/O ports)
5734@end itemize
5735
5736Miscelaneous:
5737@itemize
5738@item cmos (x86-*, ieee1275, mips-qemu_mips, mips-loongson): cmostest
5739    (used on some laptops to check for special power-on key), cmosclean
5740@item i386-pc: play
5741@end itemize
5742
5743@node Supported kernels
5744@chapter Supported boot targets
5745
5746X86 support is summarised in the following table. ``Yes'' means that the kernel works on the given platform, ``crashes'' means an early kernel crash which we hope will be fixed by concerned kernel developers. ``no'' means GRUB doesn't load the given kernel on a given platform. ``headless'' means that the kernel works but lacks console drivers (you can still use serial or network console).  In case of ``no'' and ``crashes'' the reason is given in footnote.
5747@multitable @columnfractions .50 .22 .22
5748@item                                @tab BIOS    @tab Coreboot
5749@item BIOS chainloading              @tab yes     @tab no (1)
5750@item NTLDR                          @tab yes     @tab no (1)
5751@item Plan9                          @tab yes     @tab no (1)
5752@item Freedos                        @tab yes     @tab no (1)
5753@item FreeBSD bootloader             @tab yes     @tab crashes (1)
5754@item 32-bit kFreeBSD                @tab yes     @tab crashes (5)
5755@item 64-bit kFreeBSD                @tab yes     @tab crashes (5)
5756@item 32-bit kNetBSD                 @tab yes     @tab crashes (1)
5757@item 64-bit kNetBSD                 @tab yes     @tab crashes
5758@item 32-bit kOpenBSD                @tab yes     @tab yes
5759@item 64-bit kOpenBSD                @tab yes     @tab yes
5760@item Multiboot                      @tab yes     @tab yes
5761@item Multiboot2                     @tab yes     @tab yes
5762@item 32-bit Linux (legacy protocol) @tab yes     @tab no (1)
5763@item 64-bit Linux (legacy protocol) @tab yes     @tab no (1)
5764@item 32-bit Linux (modern protocol) @tab yes     @tab yes
5765@item 64-bit Linux (modern protocol) @tab yes     @tab yes
5766@item 32-bit XNU                     @tab yes     @tab ?
5767@item 64-bit XNU                     @tab yes     @tab ?
5768@item 32-bit EFI chainloader         @tab no (2)  @tab no (2)
5769@item 64-bit EFI chainloader         @tab no (2)  @tab no (2)
5770@item Appleloader                    @tab no (2)  @tab no (2)
5771@end multitable
5772
5773@multitable @columnfractions .50 .22 .22
5774@item                                @tab Multiboot    @tab Qemu
5775@item BIOS chainloading              @tab no (1)       @tab no (1)
5776@item NTLDR                          @tab no (1)       @tab no (1)
5777@item Plan9                          @tab no (1)       @tab no (1)
5778@item FreeDOS                        @tab no (1)       @tab no (1)
5779@item FreeBSD bootloader             @tab crashes (1)  @tab crashes (1)
5780@item 32-bit kFreeBSD                @tab crashes (5)  @tab crashes (5)
5781@item 64-bit kFreeBSD                @tab crashes (5)  @tab crashes (5)
5782@item 32-bit kNetBSD                 @tab crashes (1)  @tab crashes (1) 
5783@item 64-bit kNetBSD                 @tab yes          @tab yes
5784@item 32-bit kOpenBSD                @tab yes          @tab yes
5785@item 64-bit kOpenBSD                @tab yes          @tab yes
5786@item Multiboot                      @tab yes          @tab yes
5787@item Multiboot2                     @tab yes          @tab yes
5788@item 32-bit Linux (legacy protocol) @tab no (1)       @tab no (1)
5789@item 64-bit Linux (legacy protocol) @tab no (1)       @tab no (1)
5790@item 32-bit Linux (modern protocol) @tab yes          @tab yes
5791@item 64-bit Linux (modern protocol) @tab yes          @tab yes
5792@item 32-bit XNU                     @tab ?            @tab ?
5793@item 64-bit XNU                     @tab ?            @tab ?
5794@item 32-bit EFI chainloader         @tab no (2)       @tab no (2)
5795@item 64-bit EFI chainloader         @tab no (2)       @tab no (2)
5796@item Appleloader                    @tab no (2)       @tab no (2)
5797@end multitable
5798
5799@multitable @columnfractions .50 .22 .22
5800@item                                @tab ia32 EFI      @tab amd64 EFI
5801@item BIOS chainloading              @tab no (1)        @tab no (1)
5802@item NTLDR                          @tab no (1)        @tab no (1)
5803@item Plan9                          @tab no (1)        @tab no (1)
5804@item FreeDOS                        @tab no (1)        @tab no (1)
5805@item FreeBSD bootloader             @tab crashes (1)   @tab crashes (1)
5806@item 32-bit kFreeBSD                @tab headless      @tab headless
5807@item 64-bit kFreeBSD                @tab headless      @tab headless
5808@item 32-bit kNetBSD                 @tab crashes (1)   @tab crashes (1)
5809@item 64-bit kNetBSD                 @tab yes           @tab yes
5810@item 32-bit kOpenBSD                @tab headless      @tab headless
5811@item 64-bit kOpenBSD                @tab headless      @tab headless
5812@item Multiboot                      @tab yes           @tab yes
5813@item Multiboot2                     @tab yes           @tab yes
5814@item 32-bit Linux (legacy protocol) @tab no (1)        @tab no (1)
5815@item 64-bit Linux (legacy protocol) @tab no (1)        @tab no (1)
5816@item 32-bit Linux (modern protocol) @tab yes           @tab yes
5817@item 64-bit Linux (modern protocol) @tab yes           @tab yes
5818@item 32-bit XNU                     @tab yes           @tab yes
5819@item 64-bit XNU                     @tab yes (4)       @tab yes
5820@item 32-bit EFI chainloader         @tab yes           @tab no (3)
5821@item 64-bit EFI chainloader         @tab no (3)        @tab yes
5822@item Appleloader                    @tab yes           @tab yes
5823@end multitable
5824
5825@multitable @columnfractions .50 .22 .22
5826@item                                @tab ia32 IEEE1275
5827@item BIOS chainloading              @tab no (1)
5828@item NTLDR                          @tab no (1)
5829@item Plan9                          @tab no (1)
5830@item FreeDOS                        @tab no (1)
5831@item FreeBSD bootloader             @tab crashes (1)
5832@item 32-bit kFreeBSD                @tab crashes (5)
5833@item 64-bit kFreeBSD                @tab crashes (5)
5834@item 32-bit kNetBSD                 @tab crashes (1)
5835@item 64-bit kNetBSD                 @tab ?
5836@item 32-bit kOpenBSD                @tab ?
5837@item 64-bit kOpenBSD                @tab ?
5838@item Multiboot                      @tab ?
5839@item Multiboot2                     @tab ?
5840@item 32-bit Linux (legacy protocol) @tab no (1)
5841@item 64-bit Linux (legacy protocol) @tab no (1)
5842@item 32-bit Linux (modern protocol) @tab ?
5843@item 64-bit Linux (modern protocol) @tab ?
5844@item 32-bit XNU                     @tab ?
5845@item 64-bit XNU                     @tab ?
5846@item 32-bit EFI chainloader         @tab no (2)
5847@item 64-bit EFI chainloader         @tab no (2)
5848@item Appleloader                    @tab no (2)
5849@end multitable
5850
5851@enumerate
5852@item Requires BIOS
5853@item EFI only
5854@item 32-bit and 64-bit EFI have different structures and work in different CPU modes so it's not possible to chainload 32-bit bootloader on 64-bit platform and vice-versa
5855@item Some modules may need to be disabled
5856@item Requires ACPI
5857@end enumerate
5858
5859PowerPC, IA64 and Sparc64 ports support only Linux. MIPS port supports Linux
5860and multiboot2.
5861
5862@section Boot tests
5863
5864As you have seen in previous chapter the support matrix is pretty big and some of the configurations are only rarely used. To ensure the quality bootchecks are available for all x86 targets except EFI chainloader, Appleloader and XNU. All x86 platforms have bootcheck facility except ieee1275. Multiboot, multiboot2, BIOS chainloader, ntldr and freebsd-bootloader boot targets are tested only with a fake kernel images. Only Linux is tested among the payloads using Linux protocols.
5865
5866Following variables must be defined:
5867
5868@multitable  @columnfractions .30 .65
5869@item GRUB_PAYLOADS_DIR @tab directory containing the required kernels
5870@item GRUB_CBFSTOOL @tab cbfstoll from Coreboot package (for coreboot platform only)
5871@item GRUB_COREBOOT_ROM @tab empty Coreboot ROM
5872@item GRUB_QEMU_OPTS @tab additional options to be supplied to QEMU
5873@end multitable
5874
5875Required files are:
5876
5877@multitable  @columnfractions .40 .55
5878@item kfreebsd_env.i386 @tab 32-bit kFreeBSD device hints
5879@item kfreebsd.i386 @tab 32-bit FreeBSD kernel image
5880@item kfreebsd.x86_64, kfreebsd_env.x86_64 @tab same from 64-bit kFreeBSD
5881@item knetbsd.i386 @tab 32-bit NetBSD kernel image
5882@item knetbsd.miniroot.i386 @tab 32-bit kNetBSD miniroot.kmod.
5883@item knetbsd.x86_64, knetbsd.miniroot.x86_64  @tab same from 64-bit kNetBSD
5884@item kopenbsd.i386 @tab 32-bit OpenBSD kernel bsd.rd image
5885@item kopenbsd.x86_64 @tab same from 64-bit kOpenBSD
5886@item linux.i386 @tab 32-bit Linux
5887@item linux.x86_64 @tab 64-bit Linux
5888@end multitable
5889
5890@node Troubleshooting
5891@chapter Error messages produced by GRUB
5892
5893@menu
5894* GRUB only offers a rescue shell::
5895@end menu
5896
5897
5898@node GRUB only offers a rescue shell
5899@section GRUB only offers a rescue shell
5900
5901GRUB's normal start-up procedure involves setting the @samp{prefix}
5902environment variable to a value set in the core image by
5903@command{grub-install}, setting the @samp{root} variable to match, loading
5904the @samp{normal} module from the prefix, and running the @samp{normal}
5905command (@pxref{normal}).  This command is responsible for reading
5906@file{/boot/grub/grub.cfg}, running the menu, and doing all the useful
5907things GRUB is supposed to do.
5908
5909If, instead, you only get a rescue shell, this usually means that GRUB
5910failed to load the @samp{normal} module for some reason.  It may be possible
5911to work around this temporarily: for instance, if the reason for the failure
5912is that @samp{prefix} is wrong (perhaps it refers to the wrong device, or
5913perhaps the path to @file{/boot/grub} was not correctly made relative to the
5914device), then you can correct this and enter normal mode manually:
5915
5916@example
5917@group
5918# Inspect the current prefix (and other preset variables):
5919set
5920# Find out which devices are available:
5921ls
5922# Set to the correct value, which might be something like this:
5923set prefix=(hd0,1)/grub
5924set root=(hd0,1)
5925insmod normal
5926normal
5927@end group
5928@end example
5929
5930However, any problem that leaves you in the rescue shell probably means that
5931GRUB was not correctly installed.  It may be more useful to try to reinstall
5932it properly using @kbd{grub-install @var{device}} (@pxref{Invoking
5933grub-install}).  When doing this, there are a few things to remember:
5934
5935@itemize @bullet{}
5936@item
5937Drive ordering in your operating system may not be the same as the boot
5938drive ordering used by your firmware.  Do not assume that your first hard
5939drive (e.g. @samp{/dev/sda}) is the one that your firmware will boot from.
5940@file{device.map} (@pxref{Device map}) can be used to override this, but it
5941is usually better to use UUIDs or file system labels and avoid depending on
5942drive ordering entirely.
5943
5944@item
5945At least on BIOS systems, if you tell @command{grub-install} to install GRUB
5946to a partition but GRUB has already been installed in the master boot
5947record, then the GRUB installation in the partition will be ignored.
5948
5949@item
5950If possible, it is generally best to avoid installing GRUB to a partition
5951(unless it is a special partition for the use of GRUB alone, such as the
5952BIOS Boot Partition used on GPT).  Doing this means that GRUB may stop being
5953able to read its core image due to a file system moving blocks around, such
5954as while defragmenting, running checks, or even during normal operation.
5955Installing to the whole disk device is normally more robust.
5956
5957@item
5958Check that GRUB actually knows how to read from the device and file system
5959containing @file{/boot/grub}.  It will not be able to read from encrypted
5960devices with unsupported encryption scheme, nor from file systems for which
5961support has not yet been added to GRUB.
5962@end itemize
5963
5964
5965@node Invoking grub-install
5966@chapter Invoking grub-install
5967
5968The program @command{grub-install} generates a GRUB core image using
5969@command{grub-mkimage} and installs it on your system.  You must specify the
5970device name on which you want to install GRUB, like this:
5971
5972@example
5973grub-install @var{install_device}
5974@end example
5975
5976The device name @var{install_device} is an OS device name or a GRUB
5977device name.
5978
5979@command{grub-install} accepts the following options:
5980
5981@table @option
5982@item --help
5983Print a summary of the command-line options and exit.
5984
5985@item --version
5986Print the version number of GRUB and exit.
5987
5988@item --boot-directory=@var{dir}
5989Install GRUB images under the directory @file{@var{dir}/grub/}
5990This option is useful when you want to install GRUB into a
5991separate partition or a removable disk.
5992If this option is not specified then it defaults to @file{/boot}, so
5993
5994@example
5995@kbd{grub-install /dev/sda}
5996@end example
5997
5998is equivalent to
5999
6000@example
6001@kbd{grub-install --boot-directory=/boot/ /dev/sda}
6002@end example
6003
6004Here is an example in which you have a separate @dfn{boot} partition which is
6005mounted on
6006@file{/mnt/boot}:
6007
6008@example
6009@kbd{grub-install --boot-directory=/mnt/boot /dev/sdb}
6010@end example
6011
6012@item --recheck
6013Recheck the device map, even if @file{/boot/grub/device.map} already
6014exists. You should use this option whenever you add/remove a disk
6015into/from your computer.
6016
6017@item --no-rs-codes
6018By default on x86 BIOS systems, @command{grub-install} will use some
6019extra space in the bootloader embedding area for Reed-Solomon
6020error-correcting codes. This enables GRUB to still boot successfully
6021if some blocks are corrupted.  The exact amount of protection offered
6022is dependent on available space in the embedding area.  R sectors of
6023redundancy can tolerate up to R/2 corrupted sectors. This
6024redundancy may be cumbersome if attempting to cryptographically
6025validate the contents of the bootloader embedding area, or in more
6026modern systems with GPT-style partition tables (@pxref{BIOS
6027installation}) where GRUB does not reside in any unpartitioned space
6028outside of the MBR.  Disable the Reed-Solomon codes with this option.
6029@end table
6030
6031@node Invoking grub-mkconfig
6032@chapter Invoking grub-mkconfig
6033
6034The program @command{grub-mkconfig} generates a configuration file for GRUB
6035(@pxref{Simple configuration}).
6036
6037@example
6038grub-mkconfig -o /boot/grub/grub.cfg
6039@end example
6040
6041@command{grub-mkconfig} accepts the following options:
6042
6043@table @option
6044@item --help
6045Print a summary of the command-line options and exit.
6046
6047@item --version
6048Print the version number of GRUB and exit.
6049
6050@item -o @var{file}
6051@itemx --output=@var{file}
6052Send the generated configuration file to @var{file}.  The default is to send
6053it to standard output.
6054@end table
6055
6056
6057@node Invoking grub-mkpasswd-pbkdf2
6058@chapter Invoking grub-mkpasswd-pbkdf2
6059
6060The program @command{grub-mkpasswd-pbkdf2} generates password hashes for
6061GRUB (@pxref{Security}).
6062
6063@example
6064grub-mkpasswd-pbkdf2
6065@end example
6066
6067@command{grub-mkpasswd-pbkdf2} accepts the following options:
6068
6069@table @option
6070@item -c @var{number}
6071@itemx --iteration-count=@var{number}
6072Number of iterations of the underlying pseudo-random function.  Defaults to
607310000.
6074
6075@item -l @var{number}
6076@itemx --buflen=@var{number}
6077Length of the generated hash.  Defaults to 64.
6078
6079@item -s @var{number}
6080@itemx --salt=@var{number}
6081Length of the salt.  Defaults to 64.
6082@end table
6083
6084
6085@node Invoking grub-mkrelpath
6086@chapter Invoking grub-mkrelpath
6087
6088The program @command{grub-mkrelpath} makes a file system path relative to
6089the root of its containing file system.  For instance, if @file{/usr} is a
6090mount point, then:
6091
6092@example
6093$ @kbd{grub-mkrelpath /usr/share/grub/unicode.pf2}
6094@samp{/share/grub/unicode.pf2}
6095@end example
6096
6097This is mainly used internally by other GRUB utilities such as
6098@command{grub-mkconfig} (@pxref{Invoking grub-mkconfig}), but may
6099occasionally also be useful for debugging.
6100
6101@command{grub-mkrelpath} accepts the following options:
6102
6103@table @option
6104@item --help
6105Print a summary of the command-line options and exit.
6106
6107@item --version
6108Print the version number of GRUB and exit.
6109@end table
6110
6111
6112@node Invoking grub-mkrescue
6113@chapter Invoking grub-mkrescue
6114
6115The program @command{grub-mkrescue} generates a bootable GRUB rescue image
6116(@pxref{Making a GRUB bootable CD-ROM}).
6117
6118@example
6119grub-mkrescue -o grub.iso
6120@end example
6121
6122All arguments not explicitly listed as @command{grub-mkrescue} options are
6123passed on directly to @command{xorriso} in @command{mkisofs} emulation mode.
6124Options passed to @command{xorriso} will normally be interpreted as
6125@command{mkisofs} options; if the option @samp{--} is used, then anything
6126after that will be interpreted as native @command{xorriso} options.
6127
6128Non-option arguments specify additional source directories.  This is
6129commonly used to add extra files to the image:
6130
6131@example
6132mkdir -p disk/boot/grub
6133@r{(add extra files to @file{disk/boot/grub})}
6134grub-mkrescue -o grub.iso disk
6135@end example
6136
6137@command{grub-mkrescue} accepts the following options:
6138
6139@table @option
6140@item --help
6141Print a summary of the command-line options and exit.
6142
6143@item --version
6144Print the version number of GRUB and exit.
6145
6146@item -o @var{file}
6147@itemx --output=@var{file}
6148Save output in @var{file}.  This "option" is required.
6149
6150@item --modules=@var{modules}
6151Pre-load the named GRUB modules in the image.  Multiple entries in
6152@var{modules} should be separated by whitespace (so you will probably need
6153to quote this for your shell).
6154
6155@item --rom-directory=@var{dir}
6156If generating images for the QEMU or Coreboot platforms, copy the resulting
6157@file{qemu.img} or @file{coreboot.elf} files respectively to the @var{dir}
6158directory as well as including them in the image.
6159
6160@item --xorriso=@var{file}
6161Use @var{file} as the @command{xorriso} program, rather than the built-in
6162default.
6163
6164@item --grub-mkimage=@var{file}
6165Use @var{file} as the @command{grub-mkimage} program, rather than the
6166built-in default.
6167@end table
6168
6169
6170@node Invoking grub-mount
6171@chapter Invoking grub-mount
6172
6173The program @command{grub-mount} performs a read-only mount of any file
6174system or file system image that GRUB understands, using GRUB's file system
6175drivers via FUSE.  (It is only available if FUSE development files were
6176present when GRUB was built.)  This has a number of uses:
6177
6178@itemize @bullet
6179@item
6180It provides a convenient way to check how GRUB will view a file system at
6181boot time.  You can use normal command-line tools to compare that view with
6182that of your operating system, making it easy to find bugs.
6183
6184@item
6185It offers true read-only mounts.  Linux does not have these for journalling
6186file systems, because it will always attempt to replay the journal at mount
6187time; while you can temporarily mark the block device read-only to avoid
6188this, that causes the mount to fail.  Since GRUB intentionally contains no
6189code for writing to file systems, it can easily provide a guaranteed
6190read-only mount mechanism.
6191
6192@item
6193It allows you to examine any file system that GRUB understands without
6194needing to load additional modules into your running kernel, which may be
6195useful in constrained environments such as installers.
6196
6197@item
6198Since it can examine file system images (contained in regular files) just as
6199easily as file systems on block devices, you can use it to inspect any file
6200system image that GRUB understands with only enough privileges to use FUSE,
6201even if nobody has yet written a FUSE module specifically for that file
6202system type.
6203@end itemize
6204
6205Using @command{grub-mount} is normally as simple as:
6206
6207@example
6208grub-mount /dev/sda1 /mnt
6209@end example
6210
6211@command{grub-mount} must be given one or more images and a mount point as
6212non-option arguments (if it is given more than one image, it will treat them
6213as a RAID set), and also accepts the following options:
6214
6215@table @option
6216@item --help
6217Print a summary of the command-line options and exit.
6218
6219@item --version
6220Print the version number of GRUB and exit.
6221
6222@item -C
6223@itemx --crypto
6224Mount encrypted devices, prompting for a passphrase if necessary.
6225
6226@item -d @var{string}
6227@itemx --debug=@var{string}
6228Show debugging output for conditions matching @var{string}.
6229
6230@item -K prompt|@var{file}
6231@itemx --zfs-key=prompt|@var{file}
6232Load a ZFS encryption key.  If you use @samp{prompt} as the argument,
6233@command{grub-mount} will read a passphrase from the terminal; otherwise, it
6234will read key material from the specified file.
6235
6236@item -r @var{device}
6237@itemx --root=@var{device}
6238Set the GRUB root device to @var{device}.  You do not normally need to set
6239this; @command{grub-mount} will automatically set the root device to the
6240root of the supplied file system.
6241
6242If @var{device} is just a number, then it will be treated as a partition
6243number within the supplied image.  This means that, if you have an image of
6244an entire disk in @file{disk.img}, then you can use this command to mount
6245its second partition:
6246
6247@example
6248grub-mount -r 2 disk.img mount-point
6249@end example
6250
6251@item -v
6252@itemx --verbose
6253Print verbose messages.
6254@end table
6255
6256
6257@node Invoking grub-probe
6258@chapter Invoking grub-probe
6259
6260The program @command{grub-probe} probes device information for a given path
6261or device.
6262
6263@example
6264grub-probe --target=fs /boot/grub
6265grub-probe --target=drive --device /dev/sda1
6266@end example
6267
6268@command{grub-probe} must be given a path or device as a non-option
6269argument, and also accepts the following options:
6270
6271@table @option
6272@item --help
6273Print a summary of the command-line options and exit.
6274
6275@item --version
6276Print the version number of GRUB and exit.
6277
6278@item -d
6279@itemx --device
6280If this option is given, then the non-option argument is a system device
6281name (such as @samp{/dev/sda1}), and @command{grub-probe} will print
6282information about that device.  If it is not given, then the non-option
6283argument is a filesystem path (such as @samp{/boot/grub}), and
6284@command{grub-probe} will print information about the device containing that
6285part of the filesystem.
6286
6287@item -m @var{file}
6288@itemx --device-map=@var{file}
6289Use @var{file} as the device map (@pxref{Device map}) rather than the
6290default, usually @samp{/boot/grub/device.map}.
6291
6292@item -t @var{target}
6293@itemx --target=@var{target}
6294Print information about the given path or device as defined by @var{target}.
6295The available targets and their meanings are:
6296
6297@table @samp
6298@item fs
6299GRUB filesystem module.
6300@item fs_uuid
6301Filesystem Universally Unique Identifier (UUID).
6302@item fs_label
6303Filesystem label.
6304@item drive
6305GRUB device name.
6306@item device
6307System device name.
6308@item partmap
6309GRUB partition map module.
6310@item abstraction
6311GRUB abstraction module (e.g. @samp{lvm}).
6312@item cryptodisk_uuid
6313Crypto device UUID.
6314@item msdos_parttype
6315MBR partition type code (two hexadecimal digits).
6316@item hints_string
6317A string of platform search hints suitable for passing to the
6318@command{search} command (@pxref{search}).
6319@item bios_hints
6320Search hints for the PC BIOS platform.
6321@item ieee1275_hints
6322Search hints for the IEEE1275 platform.
6323@item baremetal_hints
6324Search hints for platforms where disks are addressed directly rather than
6325via firmware.
6326@item efi_hints
6327Search hints for the EFI platform.
6328@item arc_hints
6329Search hints for the ARC platform.
6330@item compatibility_hint
6331A guess at a reasonable GRUB drive name for this device, which may be
6332used as a fallback if the @command{search} command fails.
6333@item disk
6334System device name for the whole disk.
6335@end table
6336
6337@item -v
6338@itemx --verbose
6339Print verbose messages.
6340@end table
6341
6342
6343@node Invoking grub-script-check
6344@chapter Invoking grub-script-check
6345
6346The program @command{grub-script-check} takes a GRUB script file
6347(@pxref{Shell-like scripting}) and checks it for syntax errors, similar to
6348commands such as @command{sh -n}.  It may take a @var{path} as a non-option
6349argument; if none is supplied, it will read from standard input.
6350
6351@example
6352grub-script-check /boot/grub/grub.cfg
6353@end example
6354
6355@command{grub-script-check} accepts the following options:
6356
6357@table @option
6358@item --help
6359Print a summary of the command-line options and exit.
6360
6361@item --version
6362Print the version number of GRUB and exit.
6363
6364@item -v
6365@itemx --verbose
6366Print each line of input after reading it.
6367@end table
6368
6369
6370@node Obtaining and Building GRUB
6371@appendix How to obtain and build GRUB
6372
6373@quotation
6374@strong{Caution:} GRUB requires binutils-2.9.1.0.23 or later because the
6375GNU assembler has been changed so that it can produce real 16bits
6376machine code between 2.9.1 and 2.9.1.0.x. See
6377@uref{http://sources.redhat.com/binutils/}, to obtain information on
6378how to get the latest version.
6379@end quotation
6380
6381GRUB is available from the GNU alpha archive site
6382@uref{ftp://ftp.gnu.org/gnu/grub} or any of its mirrors. The file
6383will be named grub-version.tar.gz. The current version is
6384@value{VERSION}, so the file you should grab is:
6385
6386@uref{ftp://ftp.gnu.org/gnu/grub/grub-@value{VERSION}.tar.gz}
6387
6388To unbundle GRUB use the instruction:
6389
6390@example
6391@kbd{zcat grub-@value{VERSION}.tar.gz | tar xvf -}
6392@end example
6393
6394which will create a directory called @file{grub-@value{VERSION}} with
6395all the sources. You can look at the file @file{INSTALL} for detailed
6396instructions on how to build and install GRUB, but you should be able to
6397just do:
6398
6399@example
6400@group
6401@kbd{cd grub-@value{VERSION}}
6402@kbd{./configure}
6403@kbd{make install}
6404@end group
6405@end example
6406
6407Also, the latest version is available using Git. See
6408@uref{http://www.gnu.org/software/grub/grub-download.html} for more
6409information.
6410
6411@node Reporting bugs
6412@appendix Reporting bugs
6413
6414These are the guideline for how to report bugs. Take a look at this
6415list below before you submit bugs:
6416
6417@enumerate
6418@item
6419Before getting unsettled, read this manual through and through. Also,
6420see the @uref{http://www.gnu.org/software/grub/grub-faq.html, GNU GRUB FAQ}.
6421
6422@item
6423Always mention the information on your GRUB. The version number and the
6424configuration are quite important. If you build it yourself, write the
6425options specified to the configure script and your operating system,
6426including the versions of gcc and binutils.
6427
6428@item
6429If you have trouble with the installation, inform us of how you
6430installed GRUB. Don't omit error messages, if any. Just @samp{GRUB hangs
6431up when it boots} is not enough.
6432
6433The information on your hardware is also essential. These are especially
6434important: the geometries and the partition tables of your hard disk
6435drives and your BIOS.
6436
6437@item
6438If GRUB cannot boot your operating system, write down
6439@emph{everything} you see on the screen. Don't paraphrase them, like
6440@samp{The foo OS crashes with GRUB, even though it can boot with the
6441bar boot loader just fine}. Mention the commands you executed, the
6442messages printed by them, and information on your operating system
6443including the version number.
6444
6445@item
6446Explain what you wanted to do. It is very useful to know your purpose
6447and your wish, and how GRUB didn't satisfy you.
6448
6449@item
6450If you can investigate the problem yourself, please do. That will give
6451you and us much more information on the problem. Attaching a patch is
6452even better.
6453
6454When you attach a patch, make the patch in unified diff format, and
6455write ChangeLog entries. But, even when you make a patch, don't forget
6456to explain the problem, so that we can understand what your patch is
6457for.
6458
6459@item
6460Write down anything that you think might be related. Please understand
6461that we often need to reproduce the same problem you encountered in our
6462environment. So your information should be sufficient for us to do the
6463same thing---Don't forget that we cannot see your computer directly. If
6464you are not sure whether to state a fact or leave it out, state it!
6465Reporting too many things is much better than omitting something
6466important.
6467@end enumerate
6468
6469If you follow the guideline above, submit a report to the
6470@uref{http://savannah.gnu.org/bugs/?group=grub, Bug Tracking System}.
6471Alternatively, you can submit a report via electronic mail to
6472@email{bug-grub@@gnu.org}, but we strongly recommend that you use the
6473Bug Tracking System, because e-mail can be passed over easily.
6474
6475Once we get your report, we will try to fix the bugs.
6476
6477
6478@node Future
6479@appendix Where GRUB will go
6480
6481GRUB 2 is now quite stable and used in many production systems.  We are
6482currently working towards a 2.0 release.
6483
6484If you are interested in the development of GRUB 2, take a look at
6485@uref{http://www.gnu.org/software/grub/grub.html, the homepage}.
6486
6487
6488
6489
6490
6491@node Copying This Manual
6492@appendix Copying This Manual
6493
6494@menu
6495* GNU Free Documentation License::  License for copying this manual.
6496@end menu
6497
6498@include fdl.texi
6499
6500
6501@node Index
6502@unnumbered Index
6503
6504@c Currently, we use only the Concept Index.
6505@printindex cp
6506
6507
6508@bye
6509
6510Some notes:
6511
6512  This is an attempt to make a manual for GRUB 2. The contents are
6513  copied from the GRUB manual in GRUB Legacy, so they are not always
6514  appropriate yet for GRUB 2.
Note: See TracBrowser for help on using the repository browser.