5) Describe Linux boot-up sequence A) BIOS reads the MBR where Boot Loader sits, Boot Loader reads
Kernel into memory, Kernel starts Init process, Init reads inittab, executes rc.sysinit, the rc script than starts services to reach the default run level and once this is done the last thing that gets run is the rc.local script.
Q: - What does /boot directory contains? The /boot/ directory contains static files required to boot the system, such as the Linux kernel, boot loader configuration files. These files are essential for the system to boot properly. Q: - If some one deletes /boot directory from your server, than what will happen? In that case your server will be in unbootable state. Your Server cant boot without /boot directory because this directory contains all bootable files
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 Standard boot loader GRUB
Kernel Initialization Kernel boot time functions Device detection Device driver initialization Mounts root filesystem read only Loads initial process (init)
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 z in run level 5
Init Init is the parent of all processes. This is easily shown by running the pstree Command: S pstree Init - + - apmd 1 atd 1 automount 1 crond--- crond 1 deskguide_apple 1 gdm-+-x 1 - gdm---gnome-session Because init is the first process, it will always have a PID of number 1. The file /etc/inittab contains the information on how init should set the system in every run level, as well as the run level to use as default. When changing to run level 5, the file /etc/sysconfig/desktop determines which display manager (graphical login program) will run. Possible values are GNOME and KDE. This file is read when init runs the script /etc/x11/prefdm. If the /etc/inittab file is missing or seriously corrupt, you will not be able to boot to to any of the standard run levels (0-6) and will need to use single or emergency mode instead. This procedure in depth in Unit 10 of this course. 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 run level) Show current and previous run levels /sbin/runlevel
run levels (7.9) are also valid, though not really documented. This is because traditional UNIX variants dont use them. 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
What is a daemon? On a Lunix system, some processes start at boot time and continue running until the system is powered down or until you execute a kill command. These processes typically provide some specific function such as serving web pages. Sharing print queues, or processing login requests. In the UNIX world these types of processes are called daemons, pronounced deemon or daymon A daemon process runs in the background. Waiting for events to happen. When the daemon receives a request, typically it forks a copy of itself to process the request. Meanwhile, the parent goes back to waiting for the next event or request. The Apache webserver is an example of a daemon. It starts running when the system first boots. And remains in memory servicing requests for web page until the system is shut down, or the httpd daemon is manually stopped. /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.local
Run after the run level specific scripts Common place for custom modification
Rc.local Final system V Initialization Because the rc. Local script is run each time the systes enters a run level, it is a convenient place to start processes that need to be running.