Linux+ Guide to Linux Certification Chapter Nine System Initialization
Download
Report
Transcript Linux+ Guide to Linux Certification Chapter Nine System Initialization
Linux+ Guide to Linux Certification
Chapter Nine
System Initialization
Objectives
• Summarize the major steps necessary to boot a
Linux system
• Configure the LILO boot loader
• Configure the GRUB boot loader
• Dual boot Linux with the Windows operating
system using LILO, GRUB, and NTLOADER
• Understand how the init daemon initializes the
system at boot time
The Boot Process
• Power On Self Test (POST)
– Initial series of tests run when a computer is powered
on to ensure that hardware components are functional
• Master Boot Record (MBR)
– Small program normally located on the first sector of
the first hard disk drive used to define partitions and a
boot loader
• Boot loader
– Program used to load an operating system
The Boot Process
• Active partition
– Partition that the MBR points to
• /boot
– Directory that contains the kernel and bootrelated files
• Vmlinuz-<kernel version>
– The Linux kernel file
The Boot Process
• Daemon
– A Linux system process that provides a certain
service
• Init (initialize) daemon
– The first process started by the Linux kernel
– It is responsible for starting and stopping other
daemons
The Boot Process
Figure 9-1:
The boot
process
Boot Loaders
• The primary function of boot loaders during
the boot process is to load the Linux kernel
into memory
• Boot loaders may perform other functions as
well
• The two most common boot loaders:
– LILO
– GRUB
LILO
Figure 9-2: LILO boot loader screen
LILO
• /etc/lilo.conf
– The LILO configuration file
Table 9-1: Common /etc/lilo.conf keywords
LILO
Table 9-1 (continued): Common /etc/lilo.conf keywords
LILO
Table 9-1 (continued): Common /etc/lilo.conf keywords
LILO
• Almost any hardware information may be
passed to the kernel via the append= keyword
– The format of the information depends on the
type of hardware involved
• To uninstall LILO from an active partition or
the MBR, you may use the lilo –u command
LILO
Table 9-2: LILO error codes
GRUB
• GRand Unified Bootloader (GRUB)
– Resembles common UNIX boot loaders
– More recent than the LILO boot loader
– First major part of the GRUB loader typically
resides on the MBR
– The remaining parts of the boot loader reside in
the /boot/grub directory
GRUB
Figure 9-3:
GRUB boot
loader screen
GRUB
• /boot/grub/grub.conf
– The GRUB configuration file
• GRUB root partition
– The partition containing the second stage of the
GRUB boot loader and the /boot/grub.conf file
GRUB
• Normally, GRUB allows users to manipulate
the boot loader during system startup
– To prevent this, you may optionally password
protect GRUB modifications during boot time
• grub-md5-crypt command
– Used to generate an encrypted password for use
in the /etc/grub/grub.conf file
GRUB
Figure 9-4: GRUB configuration boot loader screen
GRUB
Figure 9-5:
GRUB
prompt boot
loader
screen
GRUB
Figure 9-6: GRUB boot loader help screen
GRUB
• Recall that you are required to choose a boot
loader during installation
• Grub-install command
– Command used to install the GRUB boot loader
Using LILO or GRUB to Dual
Boot other Operating Systems
• Dual boot
– Configuration where two or more operating
systems exist on the hard disk of a computer
• If you are using LILO or GRUB to dual boot
another operating system in addition to Linux,
it is easiest if Linux is installed after the other
operating system has been installed
Using LILO or GRUB to Dual
Boot other Operating Systems
Figure 9-7:
Partitioning
for a dual
boot system
Using LILO or GRUB to Dual
Boot other Operating Systems
Figure 9-8:
Choosing a
boot loader
for a dual
boot system
Using FIPS
• First non-destructive Interactive Partition
Splitter (FIPS)
– Program used to create a new partition out of the
free space on an existing FAT16 or FAT32
partition
– Resizing the Windows partition using FIPS will
preserve the Windows operating system on the
Windows partition yet allow for free space to
install Linux
Using FIPS
• Guidelines/limitations to using FIPS:
– Version 2.0 of FIPS supports the FAT16 and FAT32
filesystems only
– FIPS will only work with primary Windows partition and
will not resize logical drives within extended partitions
– FIPS works by splitting the Windows partition into two
primary partition
– There must be sufficient free space within the existing
Windows to allow for the installation of Linux once the
partition for FIPS to use
Using a Windows Boot Loader to
Dual Boot Linux
• NTLOADER
– Boot loader available with Windows NT/2000/XP
– Can be used to display a screen at boot time that
prompts you to choose an operating system to
boot
– Similar to LILO and GRUB
Using a Windows Boot Loader to
Dual Boot Linux
Figure 9-9:
Configuration
screen to put
GRUB or
LILO to the
boot partition
Using a Windows Boot Loader to
Dual Boot Linux
• It is important to create a boot disk when
prompted to do so during the installation
• Boot.ini
– The file used to configure NTLOADER
Using a Windows Boot Loader to
Dual Boot Linux
Figure 9-10: Dual boot operating system choice screen at start up
Linux Initialization
• Once a boot loader loads the Linux operating
system kernel into memory, the kernel
resumes control and executes the first daemon
process on the system called init
• /etc/inittab
– The configuration file for the init daemon
Runlevels
• Runlevel
– Term that defines a certain type and number of
daemons on a Linux system
– Since the init daemon is responsible for starting
and stopping daemons and hence changing
runlevels, runlevels are often called initstates as
well
Runlevels
Table 9-3: Linux runlevels
Runlevels
Table 9-3 (continued): Linux runlevels
Runlevels
• runlevel command
– Command used to display the current and most
recent previous runlevel
• init command
– Command used to change the operating system
from one runlevel to another
• telinit command
– An alias to the init command
The /etc/inittab File
• When the init daemon needs to change the
runlevel of the system by starting or stopping
daemons, it consults the /etc/inittab file
• /etc/rc.d/rc.sysinit
– The first script executed during system startup
The /etc/inittab File
Figure 9-11: System startup as a result of /etc/rc.d/rc.sysinit
The /etc/inittab File
Figure 9-12: System startup as a result of /etc/rc.d/rc*.d
The /etc/inittab File
• Mingetty
– Program used to display a login prompt on a
character-based terminal
• /etc/rc.d/rc.local
– Final script executed during system startup
The /etc/inittab File
Figure 9-13: The Linux initialization process
Configuring Daemon Startup
• /etc/rc.d/rc*.d
– The directories used to start and kill daemons in
each runlevel
• /etc/rc.d/init.d
– The directory in which most daemons are located
Configuring Daemon Startup
Figure 9-14: Results of ntsysv --level 5 command
Chapter Summary
• Boot loaders are typically loaded by the system
BIOS from the MBR or the first sector of the active
partition of a hard disk
• The boot loader is responsible for loading the Linux
kernel
• The LILO boot loader uses the /etc/lilo.conf
configuration file, whereas the GRUB boot loader
uses the /boot/grub/grub.conf configuration file
• You may use the LILO or GRUB boot loader to dual
boot Linux and the Windows operating system
Chapter Summary
• The FIPS utility may be used to split a FAT16 or FAT32
partition in order to create enough space to install Linux
• There are seven standard runlevels used to categorize a
Linux system based on the number and type of daemons
loaded in memory
• The init daemon is responsible for loading and
unloading daemons using its configuration file
/etc/inittab
• Daemons are typically stored in the /etc/rc.d/init.d
directory and loaded at system startup from entries in the
/etc/rc.d/rc*.d directories