Certification Objective 3.03: Boot Loaders: GRUB and LILO

 < Day Day Up > 



There are two main boot loaders associated with Red Hat Enterprise Linux: GRUB, the GRand Unified Bootloader, and LILO, the Linux Loader. Red Hat is moving toward making GRUB the only boot loader for its Linux distributions. You can't even install LILO during the Fedora Linux installation process.

There are a couple more clues. LILO is still included in the RHCE and RHCT exam requirements as of this writing. However, LILO is no longer included in the publically available outline for RH300, the main Red Hat prep course for the RHCE exam. But you'll need to come to your own conclusion on whether to study LILO for your exam.

On The Job 

You'll see the terms 'bootloader' and 'boot loader' used interchangeably. They both refer to software stored on the MBR of a hard disk which can load one or more operating systems. You may also see 'Grand Unified Boot Loader' and 'Grand Unified Bootloader' both referring to GRUB.

Boot Loader Background

To understand the role of a boot loader, take a step back from Linux. When you boot your computer, the BIOS starts by detecting basic hardware, including your hard drives. Once it's done, it looks for the boot loader on the Master Boot Record of the first available disk. If you're working with an older PC, the BIOS can't find your boot loader unless it's located within the first 1,024 cylinders of the hard disk.

Newer BIOSes overcome this problem with Logical Block Addressing, which is also known as LBA mode. LBA mode reads 'logical' values for the cylinder, head, and sector, which allows the BIOS to 'see' a larger disk drive.

If you have multiple hard drives, there is one more caveat. If your drives are IDE hard drives, the /boot directory must be on a hard drive attached to the primary IDE controller. If your drives are all SCSI hard drives, the /boot directory must be located on a hard drive with SCSI ID 0 or ID 1. If you have a mix of hard drives, the /boot directory must be located on either the first IDE drive or a SCSI drive with ID 0. In other words, this is not an issue on the Red Hat exams unless the computer that you're tested on has more than two hard drives. And I believe that's less likely, as that would increase the cost of the exam.

GRUB, the GRand Unified Bootloader

Red Hat is moving toward GRUB, the GRand Unified Bootloader as the only way to start its Linux distributions. When you start your computer, your BIOS looks for the /boot directory and finds the GRUB menu, which will look similar to Figure 3-2. If you've configured your computer with multiple operating systems, you can use the GRUB menu to boot any operating system detected during the Linux installation process.

click to expand
Figure 3-2: The GRand Unified Bootloader (GRUB)

If you need to do something special with GRUB, you can edit the commands. If GRUB is password protected, you'll need to start with the p command. Use the e command to temporarily edit the file. You'll see a number of basic commands that you can use to modify GRUB, as shown in Figure 3-3 and Table 3-3. You can use these commands to test different GRUB configurations. They can help you troubleshoot problems with the GRUB configuration file without booting, editing, and rebooting your system. That could possibly help you save time during the Troubleshooting and System Maintenance exam. But once you find the solution, make sure to record the change in the GRUB configuration file, /etc/grub.conf.

click to expand
Figure 3-3: Details of GRUB

Table 3-3: GRUB Editing Commands

Command

Description

b

Boot the currently listed operating system

d

Delete the current line

e

Edit the current line

o

Create an empty line underneath the current line

O

Create an empty line above the current line

You can also use GRUB to boot other operating systems, including various versions of Microsoft Windows. See Chapters 5 and 11 for more information, including a detailed line-by-line analysis of a dual-boot /etc/grub.conf file in Chapter 5.

If you've previously installed LILO and now want to install GRUB, edit the /etc/grub.conf file and then run the grub-install /dev/xdy command, where xdy represents the hard disk with your /boot directory.

On The Job 

The /etc/grub.conf file is linked to the actual GRUB configuration file, /boot/grub/grub.conf. When you edit /etc/grub.conf, changes are automatically reflected in /boot/grub/grub.conf.

start sidebar
Inside The Exam

Troubleshooting GRUB

If you're troubleshooting GRUB, the GRUB menu can help you experiment with changes quickly. However, if you find the solution in this way, you'll still need to change (and test) the GRUB configuration file, /etc/grub.conf. If you find a problem with GRUB during the Troubleshooting and System Maintenance exam and are unsure about the solution, testing changes through the GRUB menu could save you time. However, until you record the change in the GRUB configuration file, /etc/grub.conf, you won't get credit for the work that you've done.

end sidebar

The LILO Alternative

The more traditional boot loader is LILO, the Linux Loader. It has been deprecated from RHEL 3 as well as Fedora Linux. Since it's no longer a part of the RH300 curriculum, I doubt that you'll see it on the RHCE exam. However, it is still a part of the RHCT prep course (RH133) curriculum as of this writing. You'll have to make your own judgment on whether you want to take the time to study LILO for your Red Hat exam.

The LILO configuration file is /etc/lilo.conf. If you edit this file, you need to implement these changes with the lilo command. The following shows a typical /etc/lilo.conf file:

On The Job 

If you've installed GRUB on your system, you can still find a LILO configuration file in /etc/lilo.conf.anaconda.

prompt timeout=50 default=linux boot=/dev/hda map=/boot/map install=/boot/boot.b message=/boot/message linear image=/boot/vmlinuz-2.4.21-3         label=linux         initrd=/boot/initrd-2.4.21-3.img         read-only         append="hdc=ide-scsi root=LABEL=/"  other=/dev/hda1         label=Win98         table=/dev/hda 

Now here's the line-by-line interpretation of this file:

prompt

This forces the lilo boot: prompt to appear on the console.

timeout=50 default=linux

This forces LILO to wait five seconds (50 tenths of a second) before moving to the default operating system, labeled linux.

boot=/dev/hda map=/boot/map

The system looks for boot and map information on the first IDE hard disk.

install=/boot/boot.b

This is the secondary boot loader.

message=/boot/message

This opens a graphical file that you see during the boot process.

linear

This uses linear addresses, and not standard hard disk geometry, to find the /boot directory.

image=/boot/vmlinuz-2.4.21-4

This is the actual virtual memory compressed kernel (version 2.4.21, with the -4 representing the Red Hat build number) used for this particular Linux system.

label=linux

This identifies the 'boot option' label that appears if you press TAB at the LILO prompt.

initrd=/boot/initrd-2.4.21-4.img 

This reveals the location of the second stage loader, the RAM disk.

read-only

During installation, the RAM disk filesystem is started in read-only mode. After the second stage is finished with a few tests, the RAM disk is unloaded from memory, and the real root partition is mounted from the filesystem, normally in read/write mode.

append="root=LABEL=/"

This adds a command to the kernel. The root=LABEL=/ command points to the label associated with the root directory, which you can find with the e2label command described in Chapter 11.

The next section is another boot option-in this case, to boot Windows 98 on the first partition, /dev/hda1.

other=/dev/hda1         label=Win98         table=/dev/hda

The table is the location of the partition table to be used-in this case, the first physical IDE hard disk. If you edit this file, you need to run the lilo command to write the result to the appropriate boot record, usually the Master Boot Record (MBR) of your hard drive.

GRUB and LILO Parameters

To pass a parameter to GRUB, type the a command in the first GRUB menu. This allows you to append the command sent to the kernel. After typing the a command, you might see a command line similar to the following:

grub append> ro root=LABEL=/

You can add the command of your choice to the end of this command. For example, if you add 'single' after the end of this line, Linux starts in single-user mode. If you're having trouble getting Linux to recognize all of the RAM on your computer, try adding mem=xyzM (where xyzM represents the amount of memory on your computer) to the end of the line.

LILO works in a similar way. At the LILO boot: prompt, type the parameter after the label name. For example, if you wanted to start your system in rescue mode, you would type linux rescue. If you wanted to start your system in single-user mode, type the following command at the prompt:

lilo boot: linux single 

A wide variety of boot parameters are available; run the man bootparam command for more information.

Single-User Mode

Except for a normal boot of Linux, single-user mode is the most commonly used option. This is the system maintenance mode for experienced Linux administrators. It allows you to perform clean backups and restores to any partitions as needed from local hardware. It also allows you to run administration commands, recover or repair password and shadow password files, run filesystem checks, and so forth.

In some cases, to get out of single-user mode you just have to type exit and your system will go into multiuser mode. If you have made changes or repairs to any partitions, you should reboot the computer with the reboot command. If you've made changes during your exam, you'll want to test those changes with a reboot.

LILO Errors

The LILO first stage will also indicate some common and not-so-common problems:

(nothing)    did not get to lilo at all L            first stage loaded and started LI           second stage loaded from /boot LILO         all of lilo is loaded correctly

Occasionally, there may be an error due to partition table changes, bad blocks, and so forth. On these rare occurrences, you will only get partial LILO prompts:

LIL             second stage boot loader is started LIL?            Second stage loaded at an incorrect address LIL-            the descriptor table is corrupt



 < Day Day Up > 



RCHE Red Hat Certified Engineer Linux Study Guide[c] Exam (Rh302)
RCHE Red Hat Certified Engineer Linux Study Guide[c] Exam (Rh302)
ISBN: 71765654
EAN: N/A
Year: 2003
Pages: 194

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net