grubby/boot/grub/persistent/docs/16_available_commands

1462 lines
52 KiB
Text

16 The list of available commands
*********************************
In this chapter, we list all commands that are available in GRUB.
Commands belong to different groups. A few can only be used in the
global section of the configuration file (or "menu"); most of them can
be entered on the command-line and can be used either anywhere in the
menu or specifically in the menu entries.
In rescue mode, only the 'insmod' (*note insmod::), 'ls' (*note
ls::), 'set' (*note set::), and 'unset' (*note unset::) commands are
normally available. If you end up in rescue mode and do not know what
to do, then *note GRUB only offers a rescue shell::.
16.1 The list of commands for the menu only
===========================================
The semantics used in parsing the configuration file are the following:
* The files _must_ be in plain-text format.
* '#' at the beginning of a line in a configuration file means it is
only a comment.
* Options are separated by spaces.
* All numbers can be either decimal or hexadecimal. A hexadecimal
number must be preceded by '0x', and is case-insensitive.
These commands can only be used in the menu:
16.1.1 menuentry
----------------
-- Command: menuentry TITLE ['--class=class' ...] ['--users=users']
['--unrestricted'] ['--hotkey=key'] ['--id=id'] [ARG ...] {
COMMAND; ... }
This defines a GRUB menu entry named TITLE. When this entry is
selected from the menu, GRUB will set the CHOSEN environment
variable to value of '--id' if '--id' is given, execute the list of
commands given within braces, and if the last command in the list
returned successfully and a kernel was loaded it will execute the
'boot' command.
The '--class' option may be used any number of times to group menu
entries into classes. Menu themes may display different classes
using different styles.
The '--users' option grants specific users access to specific menu
entries. *Note Security::.
The '--unrestricted' option grants all users access to specific
menu entries. *Note Security::.
The '--hotkey' option associates a hotkey with a menu entry. KEY
may be a single letter, or one of the aliases 'backspace', 'tab',
or 'delete'.
The '--id' may be used to associate unique identifier with a menu
entry. ID is string of ASCII aphanumeric characters, underscore
and hyphen and should not start with a digit.
All other arguments including TITLE are passed as positional
parameters when list of commands is executed with TITLE always
assigned to '$1'.
16.1.2 submenu
--------------
-- Command: submenu TITLE ['--class=class' ...] ['--users=users']
['--unrestricted'] ['--hotkey=key'] ['--id=id'] { MENU ENTRIES
... }
This defines a submenu. An entry called TITLE will be added to the
menu; when that entry is selected, a new menu will be displayed
showing all the entries within this submenu.
All options are the same as in the 'menuentry' command (*note
menuentry::).
16.2 The list of general commands
=================================
Commands usable anywhere in the menu and in the command-line.
16.2.1 serial
-------------
-- Command: serial ['--unit=unit'] ['--port=port'] ['--speed=speed']
['--word=word'] ['--parity=parity'] ['--stop=stop']
Initialize a serial device. UNIT is a number in the range 0-3
specifying which serial port to use; default is 0, which
corresponds to the port often called COM1. PORT is the I/O port
where the UART is to be found; if specified it takes precedence
over UNIT. SPEED is the transmission speed; default is 9600. WORD
and STOP are the number of data bits and stop bits. Data bits must
be in the range 5-8 and stop bits must be 1 or 2. Default is 8
data bits and one stop bit. PARITY is one of 'no', 'odd', 'even'
and defaults to 'no'.
The serial port is not used as a communication channel unless the
'terminal_input' or 'terminal_output' command is used (*note
terminal_input::, *note terminal_output::).
See also *note Serial terminal::.
16.2.2 terminal_input
---------------------
-- Command: terminal_input ['--append'|'--remove'] [terminal1]
[terminal2] ...
List or select an input terminal.
With no arguments, list the active and available input terminals.
With '--append', add the named terminals to the list of active
input terminals; any of these may be used to provide input to GRUB.
With '--remove', remove the named terminals from the active list.
With no options but a list of terminal names, make only the listed
terminal names active.
16.2.3 terminal_output
----------------------
-- Command: terminal_output ['--append'|'--remove'] [terminal1]
[terminal2] ...
List or select an output terminal.
With no arguments, list the active and available output terminals.
With '--append', add the named terminals to the list of active
output terminals; all of these will receive output from GRUB.
With '--remove', remove the named terminals from the active list.
With no options but a list of terminal names, make only the listed
terminal names active.
16.2.4 terminfo
---------------
-- Command: terminfo [-a|-u|-v] [term]
Define the capabilities of your terminal by giving the name of an
entry in the terminfo database, which should correspond roughly to
a 'TERM' environment variable in Unix.
The currently available terminal types are 'vt100', 'vt100-color',
'ieee1275', and 'dumb'. If you need other terminal types, please
contact us to discuss the best way to include support for these in
GRUB.
The '-a' ('--ascii'), '-u' ('--utf8'), and '-v' ('--visual-utf8')
options control how non-ASCII text is displayed. '-a' specifies an
ASCII-only terminal; '-u' specifies logically-ordered UTF-8; and
'-v' specifies "visually-ordered UTF-8" (in other words, arranged
such that a terminal emulator without bidirectional text support
will display right-to-left text in the proper order; this is not
really proper UTF-8, but a workaround).
If no option or terminal type is specified, the current terminal
type is printed.
16.3 The list of command-line and menu entry commands
=====================================================
These commands are usable in the command-line and in menu entries. If
you forget a command, you can run the command 'help' (*note help::).
16.3.1 [
--------
-- Command: '[' expression ']'
Alias for 'test EXPRESSION' (*note test::).
16.3.2 acpi
-----------
-- Command: acpi ['-1'|'-2']
['--exclude=table1,...'|'--load-only=table1,...']
['--oemid=id'] ['--oemtable=table'] ['--oemtablerev=rev']
['--oemtablecreator=creator'] ['--oemtablecreatorrev=rev']
['--no-ebda'] filename ...
Modern BIOS systems normally implement the Advanced Configuration
and Power Interface (ACPI), and define various tables that describe
the interface between an ACPI-compliant operating system and the
firmware. In some cases, the tables provided by default only work
well with certain operating systems, and it may be necessary to
replace some of them.
Normally, this command will replace the Root System Description
Pointer (RSDP) in the Extended BIOS Data Area to point to the new
tables. If the '--no-ebda' option is used, the new tables will be
known only to GRUB, but may be used by GRUB's EFI emulation.
16.3.3 authenticate
-------------------
-- Command: authenticate [userlist]
Check whether user is in USERLIST or listed in the value of
variable 'superusers'. See *note superusers:: for valid user list
format. If 'superusers' is empty, this command returns true.
*Note Security::.
16.3.4 background_color
-----------------------
-- Command: background_color color
Set background color for active terminal. For valid color
specifications see *note Colors: Theme file format. Background
color can be changed only when using 'gfxterm' for terminal output.
This command sets color of empty areas without text. Text
background color is controlled by environment variables
COLOR_NORMAL, COLOR_HIGHLIGHT, MENU_COLOR_NORMAL,
MENU_COLOR_HIGHLIGHT. *Note Special environment variables::.
16.3.5 background_image
-----------------------
-- Command: background_image [['--mode' 'stretch'|'normal'] file]
Load background image for active terminal from FILE. Image is
stretched to fill up entire screen unless option '--mode' 'normal'
is given. Without arguments remove currently loaded background
image. Background image can be changed only when using 'gfxterm'
for terminal output.
16.3.6 badram
-------------
-- Command: badram addr,mask[,addr,mask...]
Filter out bad RAM.
This command notifies the memory manager that specified regions of
RAM ought to be filtered out (usually, because they're damaged). This
remains in effect after a payload kernel has been loaded by GRUB, as
long as the loaded kernel obtains its memory map from GRUB. Kernels that
support this include Linux, GNU Mach, the kernel of FreeBSD and
Multiboot kernels in general.
Syntax is the same as provided by the Memtest86+ utility
(http://www.memtest.org/): a list of address/mask pairs. Given a
page-aligned address and a base address / mask pair, if all the bits of
the page-aligned address that are enabled by the mask match with the
base address, it means this page is to be filtered. This syntax makes
it easy to represent patterns that are often result of memory damage,
due to physical distribution of memory cells.
16.3.7 blocklist
----------------
-- Command: blocklist file
Print a block list (*note Block list syntax::) for FILE.
16.3.8 boot
-----------
-- Command: boot
Boot the OS or chain-loader which has been loaded. Only necessary
if running the fully interactive command-line (it is implicit at
the end of a menu entry).
16.3.9 cat
----------
-- Command: cat ['--dos'] file
Display the contents of the file FILE. This command may be useful
to remind you of your OS's root partition:
grub> cat /etc/fstab
If the '--dos' option is used, then carriage return / new line
pairs will be displayed as a simple new line. Otherwise, the
carriage return will be displayed as a control character ('<d>') to
make it easier to see when boot problems are caused by a file
formatted using DOS-style line endings.
16.3.10 chainloader
-------------------
-- Command: chainloader ['--force'] file
Load FILE as a chain-loader. Like any other file loaded by the
filesystem code, it can use the blocklist notation (*note Block
list syntax::) to grab the first sector of the current partition
with '+1'. If you specify the option '--force', then load FILE
forcibly, whether it has a correct signature or not. This is
required when you want to load a defective boot loader, such as SCO
UnixWare 7.1.
16.3.11 clear
-------------
-- Command: clear
Clear the screen.
16.3.12 cmosclean
-----------------
-- Command: cmosclean byte:bit
Clear value of bit in CMOS at location BYTE:BIT. This command is
available only on platforms that support CMOS.
16.3.13 cmosdump
----------------
-- Dump: CMOS contents
Dump full CMOS contents as hexadecimal values. This command is
available only on platforms that support CMOS.
16.3.14 cmostest
----------------
-- Command: cmostest byte:bit
Test value of bit in CMOS at location BYTE:BIT. Exit status is
zero if bit is set, non zero otherwise. This command is available
only on platforms that support CMOS.
16.3.15 cmp
-----------
-- Command: cmp file1 file2
Compare the file FILE1 with the file FILE2. If they differ in
size, print the sizes like this:
Differ in size: 0x1234 [foo], 0x4321 [bar]
If the sizes are equal but the bytes at an offset differ, then
print the bytes like this:
Differ at the offset 777: 0xbe [foo], 0xef [bar]
If they are completely identical, nothing will be printed.
16.3.16 configfile
------------------
-- Command: configfile file
Load FILE as a configuration file. If FILE defines any menu
entries, then show a menu containing them immediately. Any
environment variable changes made by the commands in FILE will not
be preserved after 'configfile' returns.
16.3.17 cpuid
-------------
-- Command: cpuid [-l] [-p]
Check for CPU features. This command is only available on x86
systems.
With the '-l' option, return true if the CPU supports long mode
(64-bit).
With the '-p' option, return true if the CPU supports Physical
Address Extension (PAE).
If invoked without options, this command currently behaves as if it
had been invoked with '-l'. This may change in the future.
16.3.18 crc
-----------
-- Command: crc arg ...
Alias for 'hashsum --hash crc32 arg ...'. See command 'hashsum'
(*note hashsum::) for full description.
16.3.19 cryptomount
-------------------
-- Command: cryptomount device|'-u' uuid|'-a'|'-b'
Setup access to encrypted device. If necessary, passphrase is
requested interactively. Option DEVICE configures specific grub
device (*note Naming convention::); option '-u' UUID configures
device with specified UUID; option '-a' configures all detected
encrypted devices; option '-b' configures all geli containers that
have boot flag set.
GRUB suports devices encrypted using LUKS and geli. Note that
necessary modules (LUKS and GELI) have to be loaded manually before
this command can be used.
16.3.20 date
------------
-- Command: date [[year-]month-day] [hour:minute[:second]]
With no arguments, print the current date and time.
Otherwise, take the current date and time, change any elements
specified as arguments, and set the result as the new date and
time. For example, 'date 01-01' will set the current month and day
to January 1, but leave the year, hour, minute, and second
unchanged.
16.3.21 linux
-------------
-- Command: devicetree file
Load a device tree blob (.dtb) from a filesystem, for later use by
a Linux kernel. Does not perform merging with any device tree
supplied by firmware, but rather replaces it completely. *note
GNU/Linux::.
16.3.22 distrust
----------------
-- Command: distrust pubkey_id
Remove public key PUBKEY_ID from GRUB's keyring of trusted keys.
PUBKEY_ID is the last four bytes (eight hexadecimal digits) of the
GPG v4 key id, which is also the output of 'list_trusted' (*note
list_trusted::). Outside of GRUB, the key id can be obtained using
'gpg --fingerprint'). These keys are used to validate signatures
when environment variable 'check_signatures' is set to 'enforce'
(*note check_signatures::), and by some invocations of
'verify_detached' (*note verify_detached::). *Note Using digital
signatures::, for more information.
16.3.23 drivemap
----------------
-- Command: drivemap '-l'|'-r'|['-s'] from_drive to_drive
Without options, map the drive FROM_DRIVE to the drive TO_DRIVE.
This is necessary when you chain-load some operating systems, such
as DOS, if such an OS resides at a non-first drive. For
convenience, any partition suffix on the drive is ignored, so you
can safely use ${root} as a drive specification.
With the '-s' option, perform the reverse mapping as well, swapping
the two drives.
With the '-l' option, list the current mappings.
With the '-r' option, reset all mappings to the default values.
For example:
drivemap -s (hd0) (hd1)
16.3.24 echo
------------
-- Command: echo ['-n'] ['-e'] string ...
Display the requested text and, unless the '-n' option is used, a
trailing new line. If there is more than one string, they are
separated by spaces in the output. As usual in GRUB commands,
variables may be substituted using '${var}'.
The '-e' option enables interpretation of backslash escapes. The
following sequences are recognised:
'\\'
backslash
'\a'
alert (BEL)
'\c'
suppress trailing new line
'\f'
form feed
'\n'
new line
'\r'
carriage return
'\t'
horizontal tab
'\v'
vertical tab
When interpreting backslash escapes, backslash followed by any
other character will print that character.
16.3.25 eval
------------
-- Command: eval string ...
Concatenate arguments together using single space as separator and
evaluate result as sequence of GRUB commands.
16.3.26 export
--------------
-- Command: export envvar
Export the environment variable ENVVAR. Exported variables are
visible to subsidiary configuration files loaded using
'configfile'.
16.3.27 false
-------------
-- Command: false
Do nothing, unsuccessfully. This is mainly useful in control
constructs such as 'if' and 'while' (*note Shell-like scripting::).
16.3.28 gettext
---------------
-- Command: gettext string
Translate STRING into the current language.
The current language code is stored in the 'lang' variable in
GRUB's environment (*note lang::). Translation files in MO format
are read from 'locale_dir' (*note locale_dir::), usually
'/boot/grub/locale'.
16.3.29 gptsync
---------------
-- Command: gptsync device [partition[+/-[type]]] ...
Disks using the GUID Partition Table (GPT) also have a legacy
Master Boot Record (MBR) partition table for compatibility with the
BIOS and with older operating systems. The legacy MBR can only
represent a limited subset of GPT partition entries.
This command populates the legacy MBR with the specified PARTITION
entries on DEVICE. Up to three partitions may be used.
TYPE is an MBR partition type code; prefix with '0x' if you want to
enter this in hexadecimal. The separator between PARTITION and
TYPE may be '+' to make the partition active, or '-' to make it
inactive; only one partition may be active. If both the separator
and type are omitted, then the partition will be inactive.
16.3.30 halt
------------
-- Command: halt '--no-apm'
The command halts the computer. If the '--no-apm' option is
specified, no APM BIOS call is performed. Otherwise, the computer
is shut down using APM.
16.3.31 hashsum
---------------
-- Command: hashsum '--hash' hash '--keep-going' '--uncompress'
'--check' file ['--prefix' dir]|file ...
Compute or verify file hashes. Hash type is selected with option
'--hash'. Supported hashes are: 'adler32', 'crc64', 'crc32',
'crc32rfc1510', 'crc24rfc2440', 'md4', 'md5', 'ripemd160', 'sha1',
'sha224', 'sha256', 'sha512', 'sha384', 'tiger192', 'tiger',
'tiger2', 'whirlpool'. Option '--uncompress' uncompresses files
before computing hash.
When list of files is given, hash of each file is computed and
printed, followed by file name, each file on a new line.
When option '--check' is given, it points to a file that contains
list of HASH NAME pairs in the same format as used by UNIX 'md5sum'
command. Option '--prefix' may be used to give directory where
files are located. Hash verification stops after the first
mismatch was found unless option '--keep-going' was given. The
exit code '$?' is set to 0 if hash verification is successful. If
it fails, '$?' is set to a nonzero value.
16.3.32 help
------------
-- Command: help [pattern ...]
Display helpful information about builtin commands. If you do not
specify PATTERN, this command shows short descriptions of all
available commands.
If you specify any PATTERNS, it displays longer information about
each of the commands whose names begin with those PATTERNS.
16.3.33 initrd
--------------
-- Command: initrd file
Load an initial ramdisk for a Linux kernel image, and set the
appropriate parameters in the Linux setup area in memory. This may
only be used after the 'linux' command (*note linux::) has been
run. See also *note GNU/Linux::.
16.3.34 initrd16
----------------
-- Command: initrd16 file
Load an initial ramdisk for a Linux kernel image to be booted in
16-bit mode, and set the appropriate parameters in the Linux setup
area in memory. This may only be used after the 'linux16' command
(*note linux16::) has been run. See also *note GNU/Linux::.
This command is only available on x86 systems.
16.3.35 insmod
--------------
-- Command: insmod module
Insert the dynamic GRUB module called MODULE.
16.3.36 keystatus
-----------------
-- Command: keystatus ['--shift'] ['--ctrl'] ['--alt']
Return true if the Shift, Control, or Alt modifier keys are held
down, as requested by options. This is useful in scripting, to
allow some user control over behaviour without having to wait for a
keypress.
Checking key modifier status is only supported on some platforms.
If invoked without any options, the 'keystatus' command returns
true if and only if checking key modifier status is supported.
16.3.37 linux
-------------
-- Command: linux file ...
Load a Linux kernel image from FILE. The rest of the line is
passed verbatim as the "kernel command-line". Any initrd must be
reloaded after using this command (*note initrd::).
On x86 systems, the kernel will be booted using the 32-bit boot
protocol. Note that this means that the 'vga=' boot option will
not work; if you want to set a special video mode, you will need to
use GRUB commands such as 'set gfxpayload=1024x768' or 'set
gfxpayload=keep' (to keep the same mode as used in GRUB) instead.
GRUB can automatically detect some uses of 'vga=' and translate
them to appropriate settings of 'gfxpayload'. The 'linux16'
command (*note linux16::) avoids this restriction.
16.3.38 linux16
---------------
-- Command: linux16 file ...
Load a Linux kernel image from FILE in 16-bit mode. The rest of
the line is passed verbatim as the "kernel command-line". Any
initrd must be reloaded after using this command (*note
initrd16::).
The kernel will be booted using the traditional 16-bit boot
protocol. As well as bypassing problems with 'vga=' described in
*note linux::, this permits booting some other programs that
implement the Linux boot protocol for the sake of convenience.
This command is only available on x86 systems.
16.3.39 list_env
----------------
-- Command: list_env ['--file' file]
List all variables in the environment block file. *Note
Environment block::.
The '--file' option overrides the default location of the
environment block.
16.3.40 list_trusted
--------------------
-- Command: list_trusted
List all public keys trusted by GRUB for validating signatures.
The output is in GPG's v4 key fingerprint format (i.e., the output
of 'gpg --fingerprint'). The least significant four bytes (last
eight hexadecimal digits) can be used as an argument to 'distrust'
(*note distrust::). *Note Using digital signatures::, for more
information about uses for these keys.
16.3.41 load_env
----------------
-- Command: load_env ['--file' file] ['--skip-sig']
[whitelisted_variable_name] ...
Load all variables from the environment block file into the
environment. *Note Environment block::.
The '--file' option overrides the default location of the
environment block.
The '--skip-sig' option skips signature checking even when the
value of environment variable 'check_signatures' is set to
'enforce' (*note check_signatures::).
If one or more variable names are provided as arguments, they are
interpreted as a whitelist of variables to load from the
environment block file. Variables set in the file but not present
in the whitelist are ignored.
The '--skip-sig' option should be used with care, and should always
be used in concert with a whitelist of acceptable variables whose
values should be set. Failure to employ a carefully constructed
whitelist could result in reading a malicious value into critical
environment variables from the file, such as setting
'check_signatures=no', modifying 'prefix' to boot from an
unexpected location or not at all, etc.
When used with care, '--skip-sig' and the whitelist enable an
administrator to configure a system to boot only signed
configurations, but to allow the user to select from among multiple
configurations, and to enable "one-shot" boot attempts and
"savedefault" behavior. *Note Using digital signatures::, for more
information.
16.3.42 loadfont
----------------
-- Command: loadfont file ...
Load specified font files. Unless absolute pathname is given, FILE
is assumed to be in directory '$prefix/fonts' with suffix '.pf2'
appended. *Note Fonts: Theme file format.
16.3.43 loopback
----------------
-- Command: loopback ['-d'] device file
Make the device named DEVICE correspond to the contents of the
filesystem image in FILE. For example:
loopback loop0 /path/to/image
ls (loop0)/
With the '-d' option, delete a device previously created using this
command.
16.3.44 ls
----------
-- Command: ls [arg ...]
List devices or files.
With no arguments, print all devices known to GRUB.
If the argument is a device name enclosed in parentheses (*note
Device syntax::), then print the name of the filesystem of that
device.
If the argument is a directory given as an absolute file name
(*note File name syntax::), then list the contents of that
directory.
16.3.45 lsfonts
---------------
-- Command: lsfonts
List loaded fonts.
16.3.46 lsmod
-------------
-- Command: lsmod
Show list of loaded modules.
16.3.47 md5sum
--------------
-- Command: md5sum arg ...
Alias for 'hashsum --hash md5 arg ...'. See command 'hashsum'
(*note hashsum::) for full description.
16.3.48 module
--------------
-- Command: module [--nounzip] file [arguments]
Load a module for multiboot kernel image. The rest of the line is
passed verbatim as the module command line.
16.3.49 multiboot
-----------------
-- Command: multiboot [--quirk-bad-kludge]
[--quirk-modules-after-kernel] file ...
Load a multiboot kernel image from FILE. The rest of the line is
passed verbatim as the "kernel command-line". Any module must be
reloaded after using this command (*note module::).
Some kernels have known problems. You need to specify -quirk-* for
those. -quirk-bad-kludge is a problem seen in several products
that they include loading kludge information with invalid data in
ELF file. GRUB prior to 0.97 and some custom builds prefered ELF
information while 0.97 and GRUB 2 use kludge. Use this option to
ignore kludge. Known affected systems: old Solaris, SkyOS.
-quirk-modules-after-kernel is needed for kernels which load at
relatively high address e.g. 16MiB mark and can't cope with
modules stuffed between 1MiB mark and beginning of the kernel.
Known afftected systems: VMWare.
16.3.50 nativedisk
------------------
-- Command: nativedisk
Switch from firmware disk drivers to native ones. Really useful
only on platforms where both firmware and native disk drives are
available. Currently i386-pc, i386-efi, i386-ieee1275 and
x86_64-efi.
16.3.51 normal
--------------
-- Command: normal [file]
Enter normal mode and display the GRUB menu.
In normal mode, commands, filesystem modules, and cryptography
modules are automatically loaded, and the full GRUB script parser
is available. Other modules may be explicitly loaded using
'insmod' (*note insmod::).
If a FILE is given, then commands will be read from that file.
Otherwise, they will be read from '$prefix/grub.cfg' if it exists.
'normal' may be called from within normal mode, creating a nested
environment. It is more usual to use 'configfile' (*note
configfile::) for this.
16.3.52 normal_exit
-------------------
-- Command: normal_exit
Exit normal mode (*note normal::). If this instance of normal mode
was not nested within another one, then return to rescue mode.
16.3.53 parttool
----------------
-- Command: parttool partition commands
Make various modifications to partition table entries.
Each COMMAND is either a boolean option, in which case it must be
followed with '+' or '-' (with no intervening space) to enable or
disable that option, or else it takes a value in the form
'COMMAND=VALUE'.
Currently, 'parttool' is only useful on DOS partition tables (also
known as Master Boot Record, or MBR). On these partition tables,
the following commands are available:
'boot' (boolean)
When enabled, this makes the selected partition be the active
(bootable) partition on its disk, clearing the active flag on
all other partitions. This command is limited to _primary_
partitions.
'type' (value)
Change the type of an existing partition. The value must be a
number in the range 0-0xFF (prefix with '0x' to enter it in
hexadecimal).
'hidden' (boolean)
When enabled, this hides the selected partition by setting the
"hidden" bit in its partition type code; when disabled,
unhides the selected partition by clearing this bit. This is
useful only when booting DOS or Windows and multiple primary
FAT partitions exist in one disk. See also *note
DOS/Windows::.
16.3.54 password
----------------
-- Command: password user clear-password
Define a user named USER with password CLEAR-PASSWORD. *Note
Security::.
16.3.55 password_pbkdf2
-----------------------
-- Command: password_pbkdf2 user hashed-password
Define a user named USER with password hash HASHED-PASSWORD. Use
'grub-mkpasswd-pbkdf2' (*note Invoking grub-mkpasswd-pbkdf2::) to
generate password hashes. *Note Security::.
16.3.56 play
------------
-- Command: play file | tempo [pitch1 duration1] [pitch2 duration2] ...
Plays a tune
If the argument is a file name (*note File name syntax::), play the
tune recorded in it. The file format is first the tempo as an
unsigned 32bit little-endian number, then pairs of unsigned 16bit
little-endian numbers for pitch and duration pairs.
If the arguments are a series of numbers, play the inline tune.
The tempo is the base for all note durations. 60 gives a 1-second
base, 120 gives a half-second base, etc. Pitches are Hz. Set
pitch to 0 to produce a rest.
16.3.57 probe
-------------
-- Command: probe ['--set' var]
'--driver'|'--partmap'|'--fs'|'--fs-uuid'|'--label' device
Retrieve device information. If option '--set' is given, assign
result to variable VAR, otherwise print information on the screen.
16.3.58 pxe_unload
------------------
-- Command: pxe_unload
Unload the PXE environment (*note Network::).
This command is only available on PC BIOS systems.
16.3.59 rdmsr
-------------
-- Command:: rdmsr 0xADDR [-v VARNAME]
Read a model-specific register at address 0xADDR. If the parameter
'-v' is used and an environment variable VARNAME is given, set that
environment variable to the value that was read.
Please note that on SMP systems, reading from a MSR that has a
scope per hardware thread, implies that the value that is returned
only applies to the particular cpu/core/thread that runs the
command.
Also, if you specify a reserved or unimplemented MSR address, it
will cause a general protection exception (which is not currently
being handled) and the system will reboot.
16.3.60 read
------------
-- Command: read [var]
Read a line of input from the user. If an environment variable VAR
is given, set that environment variable to the line of input that
was read, with no terminating newline.
16.3.61 reboot
--------------
-- Command: reboot
Reboot the computer.
16.3.62 regexp
--------------
-- Command: regexp ['--set' [number:]var] regexp string
Test if regular expression REGEXP matches STRING. Supported
regular expressions are POSIX.2 Extended Regular Expressions. If
option '--set' is given, store NUMBERth matched subexpression in
variable VAR. Subexpressions are numbered in order of their
opening parentheses starting from '1'. NUMBER defaults to '1'.
16.3.63 rmmod
-------------
-- Command: rmmod module
Remove a loaded MODULE.
16.3.64 save_env
----------------
-- Command: save_env ['--file' file] var ...
Save the named variables from the environment to the environment
block file. *Note Environment block::.
The '--file' option overrides the default location of the
environment block.
This command will operate successfully even when environment
variable 'check_signatures' is set to 'enforce' (*note
check_signatures::), since it writes to disk and does not alter the
behavior of GRUB based on any contents of disk that have been read.
It is possible to modify a digitally signed environment block file
from within GRUB using this command, such that its signature will
no longer be valid on subsequent boots. Care should be taken in
such advanced configurations to avoid rendering the system
unbootable. *Note Using digital signatures::, for more
information.
16.3.65 search
--------------
-- Command: search ['--file'|'--label'|'--fs-uuid'] ['--set' [var]]
['--no-floppy'] name
Search devices by file ('-f', '--file'), filesystem label ('-l',
'--label'), or filesystem UUID ('-u', '--fs-uuid').
If the '--set' option is used, the first device found is set as the
value of environment variable VAR. The default variable is 'root'.
The '--no-floppy' option prevents searching floppy devices, which
can be slow.
The 'search.file', 'search.fs_label', and 'search.fs_uuid' commands
are aliases for 'search --file', 'search --label', and 'search
--fs-uuid' respectively.
16.3.66 sendkey
---------------
-- Command: sendkey
['--num'|'--caps'|'--scroll'|'--insert'|'--pause'|'--left-shift'|'--right-shift'|'--sysrq'|'--numkey'|'--capskey'|'--scrollkey'|'--insertkey'|'--left-alt'|'--right-alt'|'--left-ctrl'|'--right-ctrl'
'on'|'off']... ['no-led'] keystroke
Insert keystrokes into the keyboard buffer when booting. Sometimes
an operating system or chainloaded boot loader requires particular
keys to be pressed: for example, one might need to press a
particular key to enter "safe mode", or when chainloading another
boot loader one might send keystrokes to it to navigate its menu.
You may provide up to 16 keystrokes (the length of the BIOS
keyboard buffer). Keystroke names may be upper-case or lower-case
letters, digits, or taken from the following table:
Name Key
-------------------------------------------------------------------
escape Escape
exclam !
at @
numbersign #
dollar $
percent %
caret ^
ampersand &
asterisk *
parenleft (
parenright )
minus -
underscore _
equal =
plus +
backspace Backspace
tab Tab
bracketleft [
braceleft {
bracketright ]
braceright }
enter Enter
control press and release Control
semicolon ;
colon :
quote '
doublequote "
backquote '
tilde ~
shift press and release left Shift
backslash \
bar |
comma ,
less <
period .
greater >
slash /
question ?
rshift press and release right Shift
alt press and release Alt
space space bar
capslock Caps Lock
F1 F1
F2 F2
F3 F3
F4 F4
F5 F5
F6 F6
F7 F7
F8 F8
F9 F9
F10 F10
F11 F11
F12 F12
num1 1 (numeric keypad)
num2 2 (numeric keypad)
num3 3 (numeric keypad)
num4 4 (numeric keypad)
num5 5 (numeric keypad)
num6 6 (numeric keypad)
num7 7 (numeric keypad)
num8 8 (numeric keypad)
num9 9 (numeric keypad)
num0 0 (numeric keypad)
numperiod . (numeric keypad)
numend End (numeric keypad)
numdown Down (numeric keypad)
numpgdown Page Down (numeric keypad)
numleft Left (numeric keypad)
numcenter 5 with Num Lock inactive (numeric
keypad)
numright Right (numeric keypad)
numhome Home (numeric keypad)
numup Up (numeric keypad)
numpgup Page Up (numeric keypad)
numinsert Insert (numeric keypad)
numdelete Delete (numeric keypad)
numasterisk * (numeric keypad)
numminus - (numeric keypad)
numplus + (numeric keypad)
numslash / (numeric keypad)
numenter Enter (numeric keypad)
delete Delete
insert Insert
home Home
end End
pgdown Page Down
pgup Page Up
down Down
up Up
left Left
right Right
As well as keystrokes, the 'sendkey' command takes various options
that affect the BIOS keyboard status flags. These options take an
'on' or 'off' parameter, specifying that the corresponding status
flag be set or unset; omitting the option for a given status flag
will leave that flag at its initial state at boot. The '--num',
'--caps', '--scroll', and '--insert' options emulate setting the
corresponding mode, while the '--numkey', '--capskey',
'--scrollkey', and '--insertkey' options emulate pressing and
holding the corresponding key. The other status flag options are
self-explanatory.
If the '--no-led' option is given, the status flag options will
have no effect on keyboard LEDs.
If the 'sendkey' command is given multiple times, then only the
last invocation has any effect.
Since 'sendkey' manipulates the BIOS keyboard buffer, it may cause
hangs, reboots, or other misbehaviour on some systems. If the
operating system or boot loader that runs after GRUB uses its own
keyboard driver rather than the BIOS keyboard functions, then
'sendkey' will have no effect.
This command is only available on PC BIOS systems.
16.3.67 set
-----------
-- Command: set [envvar=value]
Set the environment variable ENVVAR to VALUE. If invoked with no
arguments, print all environment variables with their values.
16.3.68 sha1sum
---------------
-- Command: sha1sum arg ...
Alias for 'hashsum --hash sha1 arg ...'. See command 'hashsum'
(*note hashsum::) for full description.
16.3.69 sha256sum
-----------------
-- Command: sha256sum arg ...
Alias for 'hashsum --hash sha256 arg ...'. See command 'hashsum'
(*note hashsum::) for full description.
16.3.70 sha512sum
-----------------
-- Command: sha512sum arg ...
Alias for 'hashsum --hash sha512 arg ...'. See command 'hashsum'
(*note hashsum::) for full description.
16.3.71 sleep
-------------
-- Command: sleep ['--verbose'] ['--interruptible'] count
Sleep for COUNT seconds. If option '--interruptible' is given,
allow <ESC> to interrupt sleep. With '--verbose' show countdown of
remaining seconds. Exit code is set to 0 if timeout expired and to
1 if timeout was interrupted by <ESC>.
16.3.72 source
--------------
-- Command: source file
Read FILE as a configuration file, as if its contents had been
incorporated directly into the sourcing file. Unlike 'configfile'
(*note configfile::), this executes the contents of FILE without
changing context: any environment variable changes made by the
commands in FILE will be preserved after 'source' returns, and the
menu will not be shown immediately.
16.3.73 test
------------
-- Command: test expression
Evaluate EXPRESSION and return zero exit status if result is true,
non zero status otherwise.
EXPRESSION is one of:
STRING1 '==' STRING2
the strings are equal
STRING1 '!=' STRING2
the strings are not equal
STRING1 '<' STRING2
STRING1 is lexicographically less than STRING2
STRING1 '<=' STRING2
STRING1 is lexicographically less or equal than STRING2
STRING1 '>' STRING2
STRING1 is lexicographically greater than STRING2
STRING1 '>=' STRING2
STRING1 is lexicographically greater or equal than STRING2
INTEGER1 '-eq' INTEGER2
INTEGER1 is equal to INTEGER2
INTEGER1 '-ge' INTEGER2
INTEGER1 is greater than or equal to INTEGER2
INTEGER1 '-gt' INTEGER2
INTEGER1 is greater than INTEGER2
INTEGER1 '-le' INTEGER2
INTEGER1 is less than or equal to INTEGER2
INTEGER1 '-lt' INTEGER2
INTEGER1 is less than INTEGER2
INTEGER1 '-ne' INTEGER2
INTEGER1 is not equal to INTEGER2
PREFIXINTEGER1 '-pgt' PREFIXINTEGER2
INTEGER1 is greater than INTEGER2 after stripping off common
non-numeric PREFIX.
PREFIXINTEGER1 '-plt' PREFIXINTEGER2
INTEGER1 is less than INTEGER2 after stripping off common
non-numeric PREFIX.
FILE1 '-nt' FILE2
FILE1 is newer than FILE2 (modification time). Optionally
numeric BIAS may be directly appended to '-nt' in which case
it is added to the first file modification time.
FILE1 '-ot' FILE2
FILE1 is older than FILE2 (modification time). Optionally
numeric BIAS may be directly appended to '-ot' in which case
it is added to the first file modification time.
'-d' FILE
FILE exists and is a directory
'-e' FILE
FILE exists
'-f' FILE
FILE exists and is not a directory
'-s' FILE
FILE exists and has a size greater than zero
'-n' STRING
the length of STRING is nonzero
STRING
STRING is equivalent to '-n STRING'
'-z' STRING
the length of STRING is zero
'(' EXPRESSION ')'
EXPRESSION is true
'!' EXPRESSION
EXPRESSION is false
EXPRESSION1 '-a' EXPRESSION2
both EXPRESSION1 and EXPRESSION2 are true
EXPRESSION1 EXPRESSION2
both EXPRESSION1 and EXPRESSION2 are true. This syntax is not
POSIX-compliant and is not recommended.
EXPRESSION1 '-o' EXPRESSION2
either EXPRESSION1 or EXPRESSION2 is true
16.3.74 true
------------
-- Command: true
Do nothing, successfully. This is mainly useful in control
constructs such as 'if' and 'while' (*note Shell-like scripting::).
16.3.75 trust
-------------
-- Command: trust ['--skip-sig'] pubkey_file
Read public key from PUBKEY_FILE and add it to GRUB's internal list
of trusted public keys. These keys are used to validate digital
signatures when environment variable 'check_signatures' is set to
'enforce'. Note that if 'check_signatures' is set to 'enforce'
when 'trust' executes, then PUBKEY_FILE must itself be properly
signed. The '--skip-sig' option can be used to disable
signature-checking when reading PUBKEY_FILE itself. It is expected
that '--skip-sig' is useful for testing and manual booting. *Note
Using digital signatures::, for more information.
16.3.76 unset
-------------
-- Command: unset envvar
Unset the environment variable ENVVAR.
16.3.77 uppermem
----------------
This command is not yet implemented for GRUB 2, although it is planned.
16.3.78 verify_detached
-----------------------
-- Command: verify_detached ['--skip-sig'] file signature_file
[pubkey_file]
Verifies a GPG-style detached signature, where the signed file is
FILE, and the signature itself is in file SIGNATURE_FILE.
Optionally, a specific public key to use can be specified using
PUBKEY_FILE. When environment variable 'check_signatures' is set
to 'enforce', then PUBKEY_FILE must itself be properly signed by an
already-trusted key. An unsigned PUBKEY_FILE can be loaded by
specifying '--skip-sig'. If PUBKEY_FILE is omitted, then public
keys from GRUB's trusted keys (*note list_trusted::, *note trust::,
and *note distrust::) are tried.
Exit code '$?' is set to 0 if the signature validates successfully.
If validation fails, it is set to a non-zero value. *Note Using
digital signatures::, for more information.
16.3.79 videoinfo
-----------------
-- Command: videoinfo [[WxH]xD]
List available video modes. If resolution is given, show only
matching modes.
16.3.80 wrmsr
-------------
-- Command:: wrmsr 0xADDR 0xVALUE
Write a 0xVALUE to a model-specific register at address 0xADDR.
Please note that on SMP systems, writing to a MSR that has a scope
per hardware thread, implies that the value that is written only
applies to the particular cpu/core/thread that runs the command.
Also, if you specify a reserved or unimplemented MSR address, it
will cause a general protection exception (which is not currently
being handled) and the system will reboot.
16.3.81 xen_hypervisor
----------------------
-- Command: xen_hypervisor file [arguments] ...
Load a Xen hypervisor binary from FILE. The rest of the line is
passed verbatim as the "kernel command-line". Any other binaries
must be reloaded after using this command. This command is only
available on AArch64 systems.
16.3.82 xen_module
------------------
-- Command: xen_module [--nounzip] file [arguments]
Load a module for xen hypervisor at the booting process of xen.
The rest of the line is passed verbatim as the module command line.
Modules should be loaded in the following order: - dom0 kernel
image - dom0 ramdisk if present - XSM policy if present This
command is only available on AArch64 systems.
16.4 The list of networking commands
====================================
16.4.1 net_add_addr
-------------------
-- Command: net_add_addr INTERFACE CARD ADDRESS
Configure additional network INTERFACE with ADDRESS on a network
CARD. ADDRESS can be either IP in dotted decimal notation, or
symbolic name which is resolved using DNS lookup. If successful,
this command also adds local link routing entry to the default
subnet of ADDRESS with name INTERFACE':local' via INTERFACE.
16.4.2 net_add_dns
------------------
-- Command: net_add_dns SERVER
Resolve SERVER IP address and add to the list of DNS servers used
during name lookup.
16.4.3 net_add_route
--------------------
-- Command: net_add_route SHORTNAME IP[/PREFIX] [INTERFACE | 'gw'
GATEWAY]
Add route to network with address IP as modified by PREFIX via
either local INTERFACE or GATEWAY. PREFIX is optional and defaults
to 32 for IPv4 address and 128 for IPv6 address. Route is
identified by SHORTNAME which can be used to remove it (*note
net_del_route::).
16.4.4 net_bootp
----------------
-- Command: net_bootp [CARD]
Perform configuration of CARD using DHCP protocol. If no card name
is specified, try to configure all existing cards. If
configuration was successful, interface with name CARD':dhcp' and
configured address is added to CARD. Additionally the following
DHCP options are recognized and processed:
'1 (Subnet Mask)'
Used to calculate network local routing entry for interface
CARD':dhcp'.
'3 (Router)'
Adds default route entry with the name CARD':dhcp:default' via
gateway from DHCP option. Note that only option with single
route is accepted.
'6 (Domain Name Server)'
Adds all servers from option value to the list of servers used
during name resolution.
'12 (Host Name)'
Sets environment variable 'net_'<CARD>'_dhcp_hostname' (*note
net_<INTERFACE>_hostname::) to the value of option.
'15 (Domain Name)'
Sets environment variable 'net_'<CARD>'_dhcp_domain' (*note
net_<INTERFACE>_domain::) to the value of option.
'17 (Root Path)'
Sets environment variable 'net_'<CARD>'_dhcp_rootpath' (*note
net_<INTERFACE>_rootpath::) to the value of option.
'18 (Extensions Path)'
Sets environment variable 'net_'<CARD>'_dhcp_extensionspath'
(*note net_<INTERFACE>_extensionspath::) to the value of
option.
16.4.5 net_del_addr
-------------------
-- Command: net_del_addr INTERFACE
Remove configured INTERFACE with associated address.
16.4.6 net_del_dns
------------------
-- Command: net_del_dns ADDRESS
Remove ADDRESS from list of servers used during name lookup.
16.4.7 net_del_route
--------------------
-- Command: net_del_route SHORTNAME
Remove route entry identified by SHORTNAME.
16.4.8 net_get_dhcp_option
--------------------------
-- Command: net_get_dhcp_option VAR INTERFACE NUMBER TYPE
Request DHCP option NUMBER of TYPE via INTERFACE. TYPE can be one
of 'string', 'number' or 'hex'. If option is found, assign its
value to variable VAR. Values of types 'number' and 'hex' are
converted to string representation.
16.4.9 net_ipv6_autoconf
------------------------
-- Command: net_ipv6_autoconf [CARD]
Perform IPv6 autoconfiguration by adding to the CARD interface with
name CARD':link' and link local MAC-based address. If no card is
specified, perform autoconfiguration for all existing cards.
16.4.10 net_ls_addr
-------------------
-- Command: net_ls_addr
List all configured interfaces with their MAC and IP addresses.
16.4.11 net_ls_cards
--------------------
-- Command: net_ls_cards
List all detected network cards with their MAC address.
16.4.12 net_ls_dns
------------------
-- Command: net_ls_dns
List addresses of DNS servers used during name lookup.
16.4.13 net_ls_routes
---------------------
-- Command: net_ls_routes
List routing entries.
16.4.14 net_nslookup
--------------------
-- Command: net_nslookup NAME [SERVER]
Resolve address of NAME using DNS server SERVER. If no server is
given, use default list of servers.