1.106.1 Boot the system Weight 3

Linux Professional Institute Certification — 102

                Angus Lees gus@inodes.org

Geoffrey Robertson ge@ffrey.com

               Nick Urbanik nicku@nicku.org

2005 July

Description of Objective

Candidates should be able to guide the system through the booting process. This includes giving commands to the boot loader and giving options to the kernel at boot time, and checking the events in the log files.

Key files, terms, and utilities include:

/var/log/messages
/etc/conf.modules or /etc/modules.conf
dmesg
LILO
GRUB

Boot the system

Candidates should be able to guide the system through the booting process. This includes giving commands to the boot loader and giving options to the kernel at boot time, and checking the events in the log files.

\underline{2}

Boot the system

dmesg
/var/log/messages
/etc/conf.modules or /etc/modules.conf
LILO
GRUB
• Note that 2.6 kernels use the file /etc/modprobe.conf, not /etc/modules.conf

• The name /etc/conf.modules has been out of favour for some years

Booting • Machine powers up, BIOS POST, spin up SCSI drives, etc

• BIOS boots boot loader

• (Boot loader may load its “second stage” from somewhere else)

    – e.g., grub loads /boot/grub/stage2

• Boot loader loads Linux kernel

• Linux kernel starts up, detects hardware, etc

• Linux kernel creates a ram disk with kernel modules from initrd image file

– The drivers in the /boot/initrd.img file are often needed to access the hard

disk.

• After loading the

• Linux kernel mounts /

• Linux kernel starts init(8)

• init(8) starts up rest of system

Finding the boot loader • (i386-specific)

• BIOS boots Master Boot Record (MBR), located at the beginning of the disk.

• Usual DOS MBR looks for “active” partition and loads the boot loader found in that partition.

\underline{3}

• You can either install your boot loader – in the MBR, replacing the DOS boot loader, or

– use a DOS-compatible boot loader and install your boot loader in the active partition.

Boot Loaders

• “Usual” i386 boot loader – at least it was a few years ago.

• lilo(8) install command generates suitable assembly code and installs it into either the MBR or a partition. Configured through /etc/lilo.conf

• Remembers actual disk blocks of kernel and uses that to access the file directly (using BIOS disk routines).

• Because the calculations are done at install time, LILO can get confused by changes in disk configuration.

Boot Loaders • The Grand United boot loader.

• Unlike LILO, GRUB understands some partition formats and reads files through “normal” means.

• GRUB has drivers for a number of different file systems

• depends on BIOS to be able to access the hard disk

• Reads the menu file /boot/grub/menu.lst directly from the hard disk

• No need to change MBR when install a new kernel

Boot loaders • CDROMs often use isolinux as the bootloader

\underline{4}

Chaining Boot loaders

• One bootloader can load another bootloader

• This is how GRUB or LILO start Windows

– Windows has its own bootloader at the start of its partition

– We tell GRUB or LILO to “chainload” that boot loader

• It is often useful to have one GRUB bootloader start another bootloader

– For example, if you have several distributions on one disk, have one’s GRUB install its stage1 into the MBR

– Other distributions install GRUB at start of their partition

– The first GRUB chainloads the other GRUBs

– Keeps maintenance local within each distribution

Snarfing kernel output

• dmesg(8) gives you the last 16k of kernel messages.

• syslog usually logs this to /var/log/messages and /var/log/dmesg or
  /var/log/kern.log for posterity.

• syslog gathers messages from many daemons as well as the kernel, and sends them

  to /var/log/messages

/etc/modules.conf

• Configuration for modprobe(8)

• AKA /etc/modules.conf, or with the 2.6 kernel, /etc/modprobe.conf

– Used to be called /etc/conf.modules till people realised that seems back to front

• Gives kernel module options, module aliases and a few more exotic options (like module pre/post load commands).

License Of This Document

Copyright \begin{matrix}c \\ ◯ \end{matrix} 2005, 2003 Angus Lees <gus@inodes.org>, Geoffrey Robertson <ge@ffrey.com> and Nick Urbanik <nicku@nicku.org>. Permission is granted to make and distribute verbatim copies or modified versions of this document provided that this copyright notice and this permission notice are preserved on all copies under the terms of the GNU General Public License as published by the Free Software Foundation—either version 2 of the License or (at your option) any later version.