44
Linux+ Guide to Linux Certification Chapter Nine System Initialization

Linux+ Guide to Linux Certification Chapter Nine System Initialization

Embed Size (px)

Citation preview

Page 1: Linux+ Guide to Linux Certification Chapter Nine System Initialization

Linux+ Guide to Linux Certification

Chapter Nine

System Initialization

Page 2: Linux+ Guide to Linux Certification Chapter Nine System Initialization

ObjectivesObjectives

• 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

Page 3: Linux+ Guide to Linux Certification Chapter Nine System Initialization

The Boot ProcessThe 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

Page 4: Linux+ Guide to Linux Certification Chapter Nine System Initialization

The Boot ProcessThe Boot Process

• Active partition– Partition that the MBR points to

• /boot– Directory that contains the kernel and boot-

related files

• Vmlinuz-<kernel version>– The Linux kernel file

Page 5: Linux+ Guide to Linux Certification Chapter Nine System Initialization

The Boot ProcessThe 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

Page 6: Linux+ Guide to Linux Certification Chapter Nine System Initialization

The Boot ProcessThe Boot Process

Figure 9-1: The boot process

Page 7: Linux+ Guide to Linux Certification Chapter Nine System Initialization

Boot LoadersBoot 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

Page 8: Linux+ Guide to Linux Certification Chapter Nine System Initialization

LILOLILO

Figure 9-2: LILO boot loader screen

Page 9: Linux+ Guide to Linux Certification Chapter Nine System Initialization

LILOLILO

• /etc/lilo.conf– The LILO configuration file

Table 9-1: Common /etc/lilo.conf keywords

Page 10: Linux+ Guide to Linux Certification Chapter Nine System Initialization

LILOLILO

Table 9-1 (continued): Common /etc/lilo.conf keywords

Page 11: Linux+ Guide to Linux Certification Chapter Nine System Initialization

LILOLILO

Table 9-1 (continued): Common /etc/lilo.conf keywords

Page 12: Linux+ Guide to Linux Certification Chapter Nine System Initialization

LILOLILO

• 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

Page 13: Linux+ Guide to Linux Certification Chapter Nine System Initialization

LILOLILO

Table 9-2: LILO error codes

Page 14: Linux+ Guide to Linux Certification Chapter Nine System Initialization

GRUBGRUB

• 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

Page 15: Linux+ Guide to Linux Certification Chapter Nine System Initialization

GRUBGRUB

Figure 9-3: GRUB boot loader screen

Page 16: Linux+ Guide to Linux Certification Chapter Nine System Initialization

GRUBGRUB

• /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

Page 17: Linux+ Guide to Linux Certification Chapter Nine System Initialization

GRUBGRUB

• 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

Page 18: Linux+ Guide to Linux Certification Chapter Nine System Initialization

GRUBGRUB

Figure 9-4: GRUB configuration boot loader screen

Page 19: Linux+ Guide to Linux Certification Chapter Nine System Initialization

GRUBGRUB

Figure 9-5: GRUB prompt boot loader screen

Page 20: Linux+ Guide to Linux Certification Chapter Nine System Initialization

GRUBGRUB

Figure 9-6: GRUB boot loader help screen

Page 21: Linux+ Guide to Linux Certification Chapter Nine System Initialization

GRUBGRUB

• Recall that you are required to choose a boot loader during installation

• Grub-install command– Command used to install the GRUB boot loader

Page 22: Linux+ Guide to Linux Certification Chapter Nine System Initialization

Using LILO or GRUB to Dual Using LILO or GRUB to Dual Boot other Operating SystemsBoot 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

Page 23: Linux+ Guide to Linux Certification Chapter Nine System Initialization

Using LILO or GRUB to Dual Using LILO or GRUB to Dual Boot other Operating SystemsBoot other Operating Systems

Figure 9-7: Partitioning for a dual boot system

Page 24: Linux+ Guide to Linux Certification Chapter Nine System Initialization

Using LILO or GRUB to Dual Using LILO or GRUB to Dual Boot other Operating SystemsBoot other Operating Systems

Figure 9-8: Choosing a boot loader for a dual boot system

Page 25: Linux+ Guide to Linux Certification Chapter Nine System Initialization

Using FIPSUsing 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

Page 26: Linux+ Guide to Linux Certification Chapter Nine System Initialization

Using FIPSUsing 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

Page 27: Linux+ Guide to Linux Certification Chapter Nine System Initialization

Using a Windows Boot Loader to Using a Windows Boot Loader to Dual Boot LinuxDual 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

Page 28: Linux+ Guide to Linux Certification Chapter Nine System Initialization

Using a Windows Boot Loader to Using a Windows Boot Loader to Dual Boot LinuxDual Boot Linux

Figure 9-9: Configuration screen to put GRUB or LILO to the boot partition

Page 29: Linux+ Guide to Linux Certification Chapter Nine System Initialization

Using a Windows Boot Loader to Using a Windows Boot Loader to Dual Boot LinuxDual 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

Page 30: Linux+ Guide to Linux Certification Chapter Nine System Initialization

Using a Windows Boot Loader to Using a Windows Boot Loader to Dual Boot LinuxDual Boot Linux

Figure 9-10: Dual boot operating system choice screen at start up

Page 31: Linux+ Guide to Linux Certification Chapter Nine System Initialization

Linux InitializationLinux 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

Page 32: Linux+ Guide to Linux Certification Chapter Nine System Initialization

RunlevelsRunlevels

• 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

Page 33: Linux+ Guide to Linux Certification Chapter Nine System Initialization

RunlevelsRunlevels

Table 9-3: Linux runlevels

Page 34: Linux+ Guide to Linux Certification Chapter Nine System Initialization

RunlevelsRunlevels

Table 9-3 (continued): Linux runlevels

Page 35: Linux+ Guide to Linux Certification Chapter Nine System Initialization

RunlevelsRunlevels

• 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

Page 36: Linux+ Guide to Linux Certification Chapter Nine System Initialization

The /etc/inittab FileThe /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

Page 37: Linux+ Guide to Linux Certification Chapter Nine System Initialization

The /etc/inittab FileThe /etc/inittab File

Figure 9-11: System startup as a result of /etc/rc.d/rc.sysinit

Page 38: Linux+ Guide to Linux Certification Chapter Nine System Initialization

The /etc/inittab FileThe /etc/inittab File

Figure 9-12: System startup as a result of /etc/rc.d/rc*.d

Page 39: Linux+ Guide to Linux Certification Chapter Nine System Initialization

The /etc/inittab FileThe /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

Page 40: Linux+ Guide to Linux Certification Chapter Nine System Initialization

The /etc/inittab FileThe /etc/inittab File

Figure 9-13: The Linux initialization process

Page 41: Linux+ Guide to Linux Certification Chapter Nine System Initialization

Configuring Daemon StartupConfiguring 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

Page 42: Linux+ Guide to Linux Certification Chapter Nine System Initialization

Configuring Daemon StartupConfiguring Daemon Startup

Figure 9-14: Results of ntsysv --level 5 command

Page 43: Linux+ Guide to Linux Certification Chapter Nine System Initialization

Chapter SummaryChapter 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

Page 44: Linux+ Guide to Linux Certification Chapter Nine System Initialization

Chapter SummaryChapter 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