When you use blocklist notation, you tell GRUB which blocks on the
disk contain the file you want. Each section of a file is specified
as the offset on the partition where the block begins plus the number
of blocks in the section. The offset starts at 0 for the first block
on the partition. The syntax for blocklist notation is:
In this case, too, the device name is optional for a file on the root
device. With blocklist notation, you can also omit the offset if it
is 0. A typical use of blocklist notation is when using a chainloader
to boot Windows. If GRUB is installed in the MBR, you can chainload
Windows by setting the root device to the partition that has the
Windows boot loader, making it the active partition, and then using
the chainloader command to read the Windows boot
sector:
4.3.2. The GRUB Configuration File
GRUB uses a configuration file that sets
up the menu interface. The configuration file is called
grub.conf and is found with the other GRUB files
in the /boot/grub directory.
grub.conf is also known as
menu.lst, and at least on some distributions
(e.g., Red Hat 8), menu.lst is a symbolic link
to grub.conf.
The configuration file begins with a section containing global
commands that apply to all boot entries, followed by an entry for
each Linux image or other operating system that you want to be able
to boot. Here is an example of a global section (a hash sign,
#, begins a comment):
default=0 # default to the first entry
timeout=20 # set the timeout to 20 seconds
splashimage=(hd0,0)/grub/splash.xpm.gz # the splash image displayed with
# the menu
Certain GRUB commands are available only in the global section of the
configuration file, for use with the GRUB menu. These commands are
described in the following list. All other commands can be used
either in the configuration file or on the command line and are
described later in Section 4.4.
- default num
-
Set the default menu entry to num. The default
entry is started if the user does not make a selection before the
timeout time. Menu entries are numbered from 0. If no default is
specified, the first entry (0) is used as the default.
- fallback num
-
Specify the entry to be used if for any reason the default entry has
errors. If this command is specified and the default
doesn't work, GRUB boots the fallback entry
automatically instead of waiting for user input.
- hiddenmenu
-
Specify that the menu is not to be displayed. The user can press Esc
before the end of the timeout period to have the menu displayed;
otherwise the default entry is booted at the end of the timeout.
- timeout time
-
Specify the timeout period, in seconds. The timeout is the amount of
time GRUB waits for user input before booting the default entry.
- title name
-
Start a new boot entry with specified name.
Following the global section, the configuration file includes an
entry for each boot image. An entry begins with a title command that specifies the text that
will appear on the menu for that entry when the system boots. A
typical boot entry might look like this one from a Red Hat 8.0
system:
title Red Hat Linux (2.4.18-14)
root (hd0,1)
kernel /vmlinuz-2.4.18-14 ro root=LABEL=/ hdc=ide-scsi
initrd /initrd-2.4.18-14.img
This entry provides the information GRUB needs to boot to Linux. When
the menu is displayed, it will include an entry that says:
Red Hat Linux (2.4.18-14)
The GRUB root is on the second partition of the first hard drive
(hd0,1). The kernel command
specifies which Linux kernel to run and passes some parameters to the
kernel, and the initrd command sets
up an initial RAM disk.
The configuration file also provides some
security features, such as the
ability to set passwords and to lock certain entries so only the root
user can boot them. The configuration file can be set up so that a
password is required to run interactively (i.e., for editing menu
entries or using the command interface) or simply to protect certain
menu entries while leaving other entries available to all users. See
the explanation of the password and
lock commands in Section 4.4.
In addition to providing a password feature, GRUB provides the
command md5crypt to encrypt
passwords in MD5 format, and a corresponding Linux command, grub-md5-crypt. grub-md5-crypt is a shell script that acts as
a frontend to the grub shell,
calling md5crypt. Passwords
encrypted either directly with md5crypt or with grub-md5-crypt can be used with the password command to set up a GRUB password.
grub-md5-crypt has three possible
options:
- --help
-
Print help message and exit.
- --grub-shell=file
-
Specify that file is to be used as the GRUB
shell.
- --version
-
Print version information and exit.