Linux RedHat - Initialization and system services

December 2016


  • The aim of this tip is:
    • Describe the functions of the BIOS from the boot process
    • Describe the functions of the bootloader
    • Give the list of functions performed by the kernel at boot
    • Describe the functions of "init"
    • Give the list of runlevels (System V) and indicate the function of each
    • Turn off and turn on a system at any level of performance
  • Note that: the standard sequence for starting a Linux system is as follows:
    • Initializing the BIOS
    • Bootloader
    • Kernel initialization
    • Starting from "init"



Initializing the BIOS

  • The BIOS (Basic Input/Output System) is the interface between the hardware and software at a very basic level, it provides all the basic instructions used by the operating system.
  • The BIOS begins by executing an auto-ignition test (POST), then it searches for devices.
  • After the POST, a boot device is selected from a list that is configurable in the BIOS.
  • The BIOS reads and executes the first physical sector of the boot media selected on the system, which is usually contained in the first 512 bytes of hard disk.

Bootloader


The bootloader is usually contained in the first sector of the disk and then read and executed by the BIOS. The storage space that reads the BIOS is not sufficient to contain all the bootloader but just a part sufficient enough to start the rest of the bootloader, which is usually contained in a configuration file stored elsewhere on the disc. Hence the start is done in two steps:
  • Launch via BIOS
  • Launch a file under/boot


The bootloader is designed to load and run the system kernel. The standard bootloader is GRUB but we can also shift to LILO.

Kernel initialization


The kernel initialization includes:
  • The detection and initialization of devices: any device drivers compiled into the kernel are called and try to locate their corresponding devices.
  • Mounting the root filesystem in read-only mode
  • Loading the initial process "init"


The kernel initialization is very rapid, therefore very difficult to follow visually, so to check what happened during kernel initialization, it is possible to read the log that is stored under:
  • /var/log/dmesg  

Initialize "init"

  • "init" is the main process, it will always have a PID value: 1.
  • "init" reads its configuration from the /etc/inittab file. that contains the settings for the system at every level of execution.

Runlevels


"init"defines the X level of performance standards for Linux:
  • Level 0: Stop (not to be attributed to the initdefault)
  • Level 1, S: single user mode (only the root user can log). Typically used for maintenance.
  • Level 2: Multi-user mode without NFS network
  • Level 3: full mode for multiple users including network
  • Level 4: User Configurable duplicate but the level 3 by default.
  • Level 5: X11 (including network)
  • Level 6: Restart


At the /etc/inittab file level, control of runlevel is default, after the system is started following this format:
Id :x :initdefault :
Where x is the desired runlevel after boot.

Runlevel (System V)


The ability to change runlevel offers easy interaction with administrators, this allows you to switch between different levels of startup.
Scripts services are in /etc/rc.d/init.d. Each runlevel correspond to a /etc/rc.d/rcX.d directory, where X is the runlevel.

System Shutdown


To stop the system, use commands like:

#Shutdown -h now   
#halt   
#poweroff  
#init 0



Related :

This document entitled « Linux RedHat - Initialization and system services » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.