4.2. Configure the GRUB boot
loader
GRUB is a boot loader designed to
boot a wide range of operating systems from a wide range of
filesystems. GRUB is becoming popular
due to the increasing number of possible root filesystems that can
Linux can reside upon.
GRUB is documented in a
GNU info file. Type info grub
to view the documentation.
The GRUB configuration file is
/boot/grub/menu.lst. Some distributions use
another configuration file; for example, Red Hat
Linux uses the file
/boot/grub/grub.conf.
GRUB configuration files are
interpreted. Syntax errors will not be detected until the machine
is rebooted, so take care not to make typing errors.
Edit the GRUB configuration file
and remove any splashimage entries. If these
entries are not removed GRUB 0.90
behaves very oddly, transferring control between the serial console
and the attached monitor and keyboard.
If there is not already a password command
in the GRUB configuration file then
create a hashed password, see Figure 4-4. The password should be
good, as it can be used to gain root access.
Use that hashed password in the
GRUB configuration file, this is shown
in Figure 4-5.
Define the serial port and configure
GRUB to use the serial port, as shown in
Figure 4-6.
--unit is the number of the
serial port, counting from zero, unit 0 being
COM1.
Note that the values of
--parity are spelt out in full:
no, even and
odd. The common abbreviations
n, e and o
are not accepted.
If there is mysteriously no output on the serial port then
suspect a syntax error in the serial or
terminal commands.
If you also want to use and attached monitor and keyboard as
well as the serial port to control the
GRUB boot loader then use the
alternative configuration in Figure 4-7.
When both the serial port and the attached monitor and
keyboard are configured they will both ask for a key to be pressed
until the timeout expires. If a key is pressed then the boot menu
is displayed to that device. Disconcertingly, the other device
sees nothing.
If no key is pressed then the boot menu is displayed on the
whichever of serial or
console is listed first in the
terminal command. After the timeout set by the
timeout the default option set by
default is booted.
If you are not using a VT100 terminal then
the cursor keys may not work to select a
GRUB menu item. The instructions shown
in Figure 4-8 are literally
correct: Use the ^ and v keys means that the
caret key
(Shift-6)
moves the cursor up and letter vee key (V) moves
the cursor down.
Note when configuring GRUB that
there are two timeouts involved. Press any key to
continue is printed for terminal
--timeout=10 seconds, waiting for someone on the keyboard
or terminal to press a key to get the input focus. Then the menu
is displayed for timeout 10 seconds before the
default boot option is taken.
If the terminal attached to the serial port is not a real or
emulated VT100, then force
GRUB to use it's command line interface.
This interface is much more difficult to use than
GRUB's menu interface; however, the
command line interface does not assume the
VT100's terminal language.
This HOWTO does not discuss the use of
GRUB's command line. It is far too
complex and error-prone to recommend for use on production
machines. Wizards will know to consult
GRUB's info
manual for the commands required to boot the kernel.
GRUB's menu's can be edited
interactively after P is pressed and the password
supplied. A better approach is to add menu items to boot the
machine into alternative run levels. A sample configuration
showing a menu entry for the default run level and an alternative
menu entry for single user mode (run level
s) is shown in Figure 4-10. Remember to use
the lock command to require a password for
single user mode, as single user mode does not ask for a
Linux password.
File names in the kernel and
initrd commands are relative to the
GRUB installation directory, which is
usually /boot/grub. So
/vmlinuz-2.4.9-21 is actually the file
/boot/grub/vmlinuz-2.4.9-21.
GRUB is now configured to use the
serial console. The kernels booted from
GRUB are yet to be configured to use the
serial console.