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