Table of Content
Weight: 2
Description: Candidates should be able to select, install and configure a boot manager.
Key Knowledge Areas:
- Providing alternative boot locations and backup boot options
- Install and configure a boot loader such as GRUB Legacy
- Perform basic configuration changes for GRUB 2
- Interact with the boot loader
The following is a partial list of the used files, terms and utilities:
menu.lst, grub.cfg and grub.conf grub-install grub-mkconfig MBR
firmware in RAM
- Basic Input/Output System (BIOS)
- Extensible Firmware Interface (EFI) and its Unified EFI (UEFI) since 2011
boot loader
1) DOS/Window MBR Master Boot Record 2) Linux - LILO LInux LOader - Grand Unified Boot Loader (GRUB) in disk GRUB Legacy (with version numbers up to 0.97) GRUB 2 (with version numbers from 1.9x to 2.x
boot process
- firmware reads the boot loader into memory from the hard disk and executes it
- The boot loader, in turn, is responsible for loading the Linux kernel into memory and starting it running
BIOS loads code from the Master Boot Record (MBR), which is the first sector on the hard disk. This code is the primary boot loader code.
the primary boot loader does one of two things:
option A
- MBR X86 DOS and Windows
- examines the partition table and locates the bootable partition
- loads the boot sector from that partition and executes
- this boot sector contains a secondary boot loader, which continues the process by locating an OS kernel, loading it, and executing it
option B
- Linux LILO or GRUB
- boot loader locates an OS kernel, loads it, and executes it directly
- this approach bypasses the secondary boot loader entirely
GUID Partition Table (GPT) partitioning system
- standard for the layout of the partition table on a physical hard disk, using globally unique identifiers (GUID)
-GRUB stores part of itself in a special partition, known as the BIOS Boot Partition
The widespread MBR partitioning scheme
- dating from the early 1980s
- main limitations is the usage of 32 bits for storing block addresses and quantity information. For hard disks with 512-byte sectors, the MBR partition table entries allow up to a maximum of 2 TB (232 × 512 bytes)
grub
cat /boot/grub/menu.lst default 0 timeout 3 title Ubuntu 15.04, kernel 3.19.0-15-generic uuid bb1f38c8-4af9-4e33-ae34-389cd3496734 kernel /boot/vmlinuz-3.19.0-15-generic root=UUID=bb1f38c8-4af9-4e33-ae34-389cd3496734 ro quiet splash initrd /boot/initrd.img-3.19.0-15-generic
grub2
GRUB 2
- support for loadable modules for specific filesystems and modes of operation
- supports conditional logic statements, enabling loading modules or displaying menu entries only if particular conditions are met
/boot/grub/grub.cfg set default="0" set timeout=0 menuentry 'Ubuntu, with Linux 3.19.0-15-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-15-generic-advanced-bb1f38c8-4af9-4e33-ae34-389cd3496734' { set root='hd0,msdos1' linux /boot/vmlinuz-3.19.0-15-generic root=UUID=bb1f38c8-4af9-4e33-ae34-389cd3496734 ro find_preseed=/preseed.cfg noprompt quiet initrd /boot/initrd.img-3.19.0-15-generic }
update grub2
change grub 2 config - don't change /boot/grub/grub/cfg file directly - edit files in /etc/grub.d, and the /etc/default/grub file - rebuild the grub.cfg file by update-grub or grub-mkconfig > /boot/grub/grub.cfg
build grub bootable CD image
cd ~ mkdir -p grubcd/root/grub locate stage2 /usr/lib/grub/x86_64-pc/stage2_eltorito cp /usr/lib/grub/x86_64-pc/stage2_eltorito grubcd/root/grub genisoimage -R -b root/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o grubcd.iso grubcd file grubcd.iso grubcd.iso: ISO 9660 CD-ROM filesystem data 'CDROM' (bootable)
grub2 pkg
dpkg -l|grep grub dpkg -L grub-common|grep "bin/"
UUID
blkid
Quiz questions
1. What must be done after editing /etc/lilo.conf to make changes take effect? 2. What is the difference between LILO and GRUB? 3. How would you go about booting up a Linux installation where no boot loader has been installed?
Answers to quiz questions
1. Run lilo 2. LILO records absolute sector addresses for the files it loads, while GRUB understand how to read various filesystems. 3. a) Provide a floppy disk with a kernel image, and supply the correct root device using rdev. b) Boot off a floppy containing GRUB, and enter the correct parameters to locate the kernel and root device. c) Boot off a distribution or rescue CDROM, but specify a specific root device on the kernel command line. d) Boot a rescue system, mount the installed system (e.g. mount /dev/hda4 /mnt), and change root to the mounted system (chroot /mnt) and then install a boot loader on a floppy disk or on the hard disk.