Lecture #4 System Runlevels
Agenda
Exercise: Install CentOS-5 onto the virtual machine named Computer 2 that you made last week. (Refer to last week's notes for partition information.)
Boot a Linux system into System Maintenance mode.
Shutdown a system in a safe and secure manner.
Lecture on
/etc/inittab
file.
Exercise: Configure your Computer2 as follows:
Disable ctr-alt-del reboot.
Password protect single user mode.
Remove these services from runlevel 2: isdn, pcmcia, apmd, sendmail, and anacron.
Troubleshoot a system that won't root because of a failed system service
Assignment
Read the first half of Chapter 11.
Review
PowerPoint Slides
Labs 1 and 2
video
System Startup and Shutdown
Booting the System
Power On Self Test (POST) - loads the BIOS
BIOS loads the Master Boot Record
MBR reads its partition table to determine which partition to boot into
MBR loads the boot program in the active partition
Boot program presents user with a boot prompt
Based upon user selection, boot program loads the desired kernel along with any supplied boot options
Kernel uncompresses and loads into memory
Kernel detects hardware and initializes its data
Rooting the System
Kernel mounts the root file system
Kernel creates and starts the
init
process
Init reads
/etc/inittab
for its instructions
Init performs system initialization:
presents some kind of welcome banner
allows for an interactive startup
sets up keyboard mapping, system fonts, plug and play devices, ...
checks for dirty file systems, and cleans them if necessary
checks disk quotas and swap space
mounts all file systems
Chooses which runlevel to come up in and executes those scripts via rc script
daemons load
getty processes are spawned on terminal devices
LILO, GRUB and Dual Booting
LILO boot manager
The
/etc/lilo.conf
file
The
lilo
command
GRUB boot manager
The
/boot/grub/grub.conf
file
stage1
and
stage2
boot loaders
Init and Runlevels
The
/etc/inittab
file
A two letter system identifier
id
A list of runlevels for specified actions
An action - How and when should a command be run
process - which command to run
Runlevels
Runlevel 0
Runlevel 1
Runlevel 2
Runlevel 3,4,5
Runlevel 6
rc
scripts and/or
rc.d
directories for each runlevel
RC Script Naming conventions
Start with S or K
A number
A daemon shell script
Shutting the System Down
Users log out
Services halt
Data is saved
File systems are unmounted
System powers off
Types of shutdowns:
init 0
- no user warning
shutdown [-hcr] time
- warns users before shutting down
halt
and
reboot
- shortcuts for shutdown
CTRL-ALT-DEL - shutdown behavior can be disabled.
Relevant Commands and Files
Commands
Files
init
- Parent of all processes
/etc/inittab
runlevel
- Tell you which runlevel
/etc/rc.d/*
reboot
and
ctrl-alt-del
- Reboots the system
/etc/rc.d/init.d
halt
and
shutdown
- Powers down the system
/etc/rc.d/rc*.d