Certification System Initialization and Services
UNIT 3 System Initialization and Services
UNIT 3: Objectives Upon completion of this unit the student should be able to: Describe BIOS functions with respect to the boot process Describe the functions of the boot loader List the functions performed by the kernel during boot State the functions of init Use inittab to configure init List the System V run levels and state the function of each Configure init scripts manually and with appropriate tools Shutdown and reboot a system into any run level 2
UNIT 3: Agenda BIOS boot time responsibilities kernel boot time responsibilities init boot time responsibilities System V run levels Boot scripts Shutdown and reboot 3
Boot Sequence BIOS Initialization Boot Loader Kernel initialization init starts and enters desired run level 4
BIOS Initialization Peripherals detected Boot device selected First sector of boot device read and executed 5
Boot Loader Boot loader loads and runs the kernel Broken into two separate stages First stage: located in boot sector Second stage: a file under /boot Choice of two standard boot loaders GRUB LILO 6
Kernel Initialization Kernel boot time functions Device detection Device driver initialization Mounts root filesystem read only Loads initial process (usually init ) 7
init Initialization init reads its config: /etc/inittab initial run level system initialization scripts run level specific script directories trap certain key sequences define UPS power fail / restore scripts spawn gettys on virtual consoles initialize X in run level 5 8
Run levels init defines run levels 0-6, S, emergency The run level is selected by either the default in /etc/inittab at boot passing an argument from the boot loader running init x after boot (where x is the desired run level) Show current and previous run levels /sbin/runlevel 9
Daemon Processes A daemon process is a program that is run in the background, providing some system service Two types of daemons: standalone Transient - controlled by the "super-daemon" xinetd 0
/etc/rc.d/rc.sysinit Important tasks include: - Sets kernel parameters in /etc/sysctl.conf - Sets the system clock - Loads keymaps - Enables swap partitions - Sets hostname - Root filesystem check and mount - Add RAID devices - Enable disk quotas - Check and mount other filesystems - Cleans up stale locks and PID files
/etc/rc.d/rc Initializes the default run level per the /etc/inittab file initdefault line (eg. Id:3:initdefault:). l0:0:wait:/etc/rc.d/rc 0 l::wait:/etc/rc.d/rc l2:2:wait:/etc/rc.d/rc 2 l3:3:wait:/etc/rc.d/rc 3 <---- (run level 3) l4:4:wait:/etc/rc.d/rc 4 l5:5:wait:/etc/rc.d/rc 5 l6:6:wait:/etc/rc.d/rc 6 2
System V run levels Run level defines which services to start Service scripts reside in /etc/rc.d/init.d Each run level has a corresponding directory: /etc/rc.d/rcx.d Symbolic links in the run level directories call the init.d scripts with a start or stop argument 3
/etc/rc.d/rc.local Run after the run level specific scripts Common place for custom modification 4
Virtual Consoles Multiple independent VT00-like terminals Defined in /etc/inittab Accessed with Alt-F_key or Ctrl-Alt-F_key from an X session /dev/ttyn: virtual console n /dev/tty0: the current virtual console Default Red Hat Linux configuration: 2 consoles defined consoles -6 accept logins X server starts on first available console, usually 7 5
Controlling Services Utilities to control default service startup ntsysv: ncurses based utility usable in virtual consoles chkconfig: command line utility that works well with scripts and Kickstart serviceconf (redhat-config-services): graphical utility that requires an X interface Utilities to control services manually service: immediately start or stop a standalone service chkconfig immediately starts and stops xinetdmanaged services 6
System Shutdown Shutting down the system shutdown -h now Halt poweroff init 0 7
System Reboot Rebooting the system Shutdown -r now reboot init 6 8
End of Unit 3 Questions and answers Summary What functions does the kernel perform at boot? What are the System V run levels? What commands can you use for shutting down and rebooting? 9