Boot, Initialization, Shutdown, and Runlevels (Topic 1.106)

Objective 1: Boot the System

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.

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.

Boot-time messages

  • The kernel gives detailed status information as it boots. This information can also be found in system logs such as /var/log/messages and from the dmesg command.

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.

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.

The /etc/rc.d directory

  • The /etc/rc.d file contains initialization scripts and links controlling the boot process for many Linux distributions:

    rc.sysinit

    The startup script launched by init at boot time

    rc.local

    A script for local startup customizations, started automatically after the system is running

    rc

    A script used to change runlevels

    init.d

    The directory containing scripts to start and stop system services

    rc0.d through rc6.d

    Links to scripts in init.d

  • Names of the links are [K|S][nn][init.d_name]:

    • K and S prefixes mean kill and start, respectively.

    • nn is a sequence number controlling startup or shutdown order.

    • init.d_name is the name of the script being linked.

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset