24.2. Boot, Initialization, Shutdown, and Runlevels (Topic 1.106) 24.2.1. Objective 1: Boot the System 24.2.1.1. LILO, the Linux loader LILO is a utility designed to load a Linux kernel (or another operating system) into memory and launch it. It has two parts:
The boot loader A two-stage program intended to find and load a kernel. The first stage resides in the disk boot sector and is started by the system BIOS. It locates and launches a second, larger stage residing elsewhere on disk.
The lilo command The map installer, used to install and configure the LILO boot loader. It reads /etc/lilo.conf and writes a corresponding map file. The /etc/lilo.conf file contains options and kernel image information. Popular directives are:
boot The name of the hard disk partition that contains the boot sector.
image Refers to a specific kernel file.
install The file installed as the new boot sector.
label Provides a label, or name, for each image.
map Directory where the map file is located.
prompt Prompts the user for input (such as kernel parameters or runlevels) before booting and without a keystroke from the user.
read-only The root filesystem should initially be mounted read-only.
root Used following each image, this specifies the device that should be mounted as root.
timeout The amount of time, in tenths of a second, the system waits for user input. 24.2.1.2. Kernel parameters and module configuration LILO can pass kernel parameters using name=value pairs. Linux kernels are modular, with portions of kernel functionality compiled as modules to be used as needed. Parameters to modules can be specified in /etc/conf.modules. 24.2.1.3. Boot-time messages 24.2.2. Objective 2: Change Runlevels and Shut Down or Reboot System Runlevels specify how a system is used by controlling which services are running. Runlevels are numbered through 6, as well as with a few single characters. Runlevel 0 implies system shutdown. Runlevel 6 implies system reboot. The intermediate runlevels differ in meaning among distributions. Runlevel 1 (also s or S) is usually single-user (maintenance) mode. Runlevels 2 through 5 usually define some kind of multiuser state, including an X login screen. 24.2.2.1. Single-user mode Runlevel 1 is a bare-bones operating environment intended for maintenance. Remote logins are disabled, networking is disabled, and most daemons are shut down. Single-user mode can be entered with the single, or simply 1, parameter at the LILO prompt. Switching to single-user mode is done using init 1. 24.2.2.2. The /etc/rc.d directory 24.2.2.3. Default runlevel, determining runlevel, changing runlevels The default runlevel is located in /etc/inittab on the line containing initdefault:
id:n:initdefault: n is a valid runlevel number such as 3. Runlevel is determined by the runlevel command, which displays the previous and current runlevels. An N for previous runlevel indicates that the runlevel has not changed since startup. Runlevels can be changed using init:
init n Change to runlevel n. System shutdown can also be initiated using shutdown:
shutdown time Bring the system down in a secure, organized fashion. time is mandatory, in the form of hh:mm, now, or +n for n minutes. |