Mastering GRUB 1 Legacy on Linux: Configure the Old Boot Loader
Boot managers are programs that load the Linux Kernel and even allow you to choose another operating system. The main Linux boot manager is GRUB and there are two versions. The first version is Grub 1 on Linux (legacy).
Right after the hardware tests performed by the BIOS, the computer looks in the boot sector of the active partition or in the Master Boot Record - MBR for a small software to start loading the operating system.
Grand Unified Boot Loader (GRUB - 1)
Most distributions already adopt GRUB 1 as the default manager. It is flexible, functional and powerful, and can load operating systems such as Windows (9x, ME, NT, 2000 and XP), DOS, Linux, GNU Hurd, *BSD, OS/2 and others.
GRUB 1 also allows fetching Kernel images over the network, via serial cable, supports IDE, SATA, PATA and SCSI hard drives and has an interface focused on the command line or menus. It supports diskless systems and remote terminals.
Since it has numerous features, this article will present its basic usage, enough for you to pass the exam, with the suggestion that readers further explore its possible uses and configuration.
The disk device notation used by GRUB 1 differs somewhat from the usual, so disk names will always be "hd", followed by the disk number starting from zero, followed by the partition number, also starting from zero.
See the comparative table:
Disk Notation in Grub 1
| Linux Notation | Grub 1 Notation |
| /dev/hda | (hd0) |
| /dev/hda1 | (hd0,0) |
| Linux Notation | Grub 1 Notation |
| /dev/hda2 | (hd0,1) |
| /dev/hdb | (hd1) |
| /dev/hdb1 | (hd1,0) |
| /dev/hdb2 | (hd1,1) |
| /dev/sda | (hd0) |
| /dev/sda1 | (hd0,0) |
| /dev/sda2 | (hd0,1) |
| /dev/sdb | (hd1) |
| /dev/sdb1 | (hd1,0) |
| /dev/sdb2 | (hd1,1) |
| /dev/fd0 | (fd0) |
There is no distinction between IDE and SCSI disks. Both are referenced as (hd?) by GRUB.
Natively GRUB does not support EFI in versions prior to kernel 3.30.
GRUB has a configuration file called /boot/grub/menu.lst. Some distributions like Fedora, RedHat and Gentoo prefer to use grub.conf instead of menu.lst.
This file is divided into Global parameters, which affect GRUB and parameters that only take effect for the system images that will be loaded.
Parameters of grub.conf
Let's look at the global parameters:
- timeout: Defines a time (in seconds) to wait for the prompt or menu. If no user intervention occurs during boot, GRUB 1 loads the default image;
- default: Defines which will be the default image that will be loaded if no other is selected;
- fallback: If an unexpected error occurs and the default option cannot be loaded, this parameter defines which other image should be used;
- color: Allows you to choose the colors used in the boot menu;
- password: Allows you to specify a password for any action other than loading available images. For example, accessing the GRUB 1 command line;
- hiddenmenu: This option makes the options menu not be shown and that the image specified by the "default" line is loaded. The user can request the menu with options by pressing the <ESC> key before the time defined in timeout expires.
Parameters that affect only the images:
- title: Defines a text that will be presented in the boot menu to identify the system;
- root: Determines which is the root partition of a given image;
- rootnoverify: Identical to the root option, but does not try to mount the root partition. Used for some systems like Microsoft Windows;
- kernel: This option specifies which Kernel image will be loaded. Some Kernel parameters can be passed;
- module: Makes a module required for boot be loaded. Remember that these are not Kernel modules (sound, network modules, etc.) but rather modules required for booting some systems, such as GNU Hurd;
- lock: Locks the Kernel image loading by password. The password must be specified with the password option;
- makeactive: Makes the partition active for boot. This command is limited to primary partitions of disks;
- chainloader: Specifies the location of the boot manager of other operating systems. Some systems, like Microsoft Windows, store their own boot manager at the beginning of the partition where they are installed.
GRUB 1 has many available options. The suggestion is for the reader to read more about this boot manager using the info grub command at the Linux command line.
The grub-install Utility
Usage:
# /sbin/grub-install options partition
This command installs GRUB 1 as the boot manager on the MBR of the first disk and creates the /boot/grub directory. This directory contains the files necessary for its operation.
The most frequent options are:
- — root-directory=directory: This option installs GRUB 1 in a directory other than the root. It is useful for installing it on other partitions;
- — recheck: This option rechecks the device map at /boot/grub/device.map. It is useful when a new disk is added or removed from the system.
Getting to Know Menu.lst
See below an example menu.lst file:
timeout 30
default 0
fallback 1
color light-cyan/black white/blue
password minha-senha-secreta
title GNU/Hurd
root (hd0,0)
kernel /boot/gnumach.gz root=hd0s1
module /boot/serverboot.gz
title Linux 3.14.16
lock
root (hd0,0)
kernel (hd0,0)/boot/vmlinuz-3.14.16 vga=6 mem=512M radisk=0
title FreeBSD 3.4
root (hd0,2,a)
kernel /boot/loader
title Windows 9x, ME, NT, 2000, XP
unhide (hd0,0)
rootnoverify (hd0,0)
chainloader +1
makeactive
root = (hd0,0)
setup = (hd0)
GRUB 1 also has a special shell that accepts all the options from the menu.lst configuration file and many others. It is a powerful boot manager configuration tool.
Undoubtedly free software is becoming the great rival of companies that produce "proprietary" software.
Learn much more about Linux in our online course. You can enroll here. If you already have an account, or want to create one, just log in or create your user here.
Did you like it? Share
That was just one piece. The course teaches the whole path — from your first command to exam day.