Booting Process In Linux

Booting Process In Linux System

Introduction To Booting Process In Linux

Booting Process In Linux is a method of starting the computer system when it is powered on. You might have observed in any programmable electronics system like computer, mobile, etc. that it takes some time after you powered on. Suppose you have pressed the power switch to turn it on and it takes some time to be available for you to interact with the system. Basically, this time is noting but the booting process.

This booting is nothing but the full verification and validation of the computer system. So that the machine will be ready for the user. Here we will discuss the Linux OS booting system. We all are knowing that there are different Operating Systems are available. But mostly we can say that all the Operating System booting processes nearly equivalent. Since the Linux OS is very famous & important to learn for everyone as it is open-source. Here we will only discuss on Linux Operating System Booting process.

Booting Process Stages In Linux OS

Every time when you power on your Linux System, it goes through a series of stages before it displaying a login screen that prompts for your username or password. There are 4 distinct stages that every Linux distribution goes through in a typical boot-up process. It basically takes 4 stages to start your Linux Kernel or Operating System. But the real application will be available after a series of 6 stage processes. So let us discuss all these 6 booting processes that I am going to explain boot process in Linux.

  1. BIOS: Basic Input Output System.
  2. MBR: Master Boot Record.
  3. GRUB: Grand Unified Bootloader.
  4. Kernel: Linux Core Operating System.
  5. Init: Executes The Run Level System Application Init.
  6. Run-Level: Main Application Software starts execution.

BIOS In Linux Booting Process

The BIOS is the first stage of the Linux Booting Process. The BIOS stands for Basic Input Output Operating System. It is the very first program that is stored in nonvolatile memory like ROM or flash memory. It allows you to set up and access your computer system at a very basic level. The advanced version of BIOS is UEFI. The main purpose or objective of BIOS is:

  • POST: It performs the POST nothing but the Power On Self Test. It Checks for System Integrity and ensures the proper functioning of computer hardware with its inbuild self-diagnostic program.
  • BIOS Drivers: The BIOS drivers are stored in non-volatile memory, its main function is to supply the basic computer hardware information.
  • BIOS Setup Utility Program: It is a CMOS setup configuration software. It is used to configure the hardware settings and also the device settings, time and date, computer password etc. The Non-volatile Memory is used to store the settings of memory, type of Disk, and also the information about the computer system. These informations are not stored in the BIOS chip.
  • Bootstrap Loader: It Searches, loads, and executes the MBR program from ROM to RAM. It looks for boot loader in Floppy, CD-ROM, or Hard Drive as per the priority set. You can also press a key like F8, F2 or F12 depends on your System OEM. It does it during the BIOS startup to change the boot sequence. After the successfull detection and loaded into the executable memory, it gives the control to it. We can say that the BIOS loades and executes the MBR.

MBR In Linux Booting Process

The MBR is the second stage of the Linux Booting Process. It is extended for Master Boot Record. It is always stored at the first sector of the Bootable Disk. Basically, the MBR path is “/dev/hda“, or “/dev/sda” in Linux System. The advanced version of MBR is called GPT.

The MBR is a small program with less than 512 bytes in size. The main functions of MBR are to store the 3 components data records, such as:

  1. Primary Boot-Loader Information in first 446 bytes.
  2. Partition Table information in next 64 bytes.
  3. MBR Validation check information status in last 2 bytes.

GRUB In Linux Booting Process

GRUB is extended for Grand Unified Bootloader In Linux Booting Process. It is an advanced version of an older Linux loader called LILO. This is also called Primary Boot Loader (PBL) in Linux Booting Process. The main function of the GRUB is:

  1. To select the type of Kernel Image should be loaded if you have multiple OS in your computer system.
  2. To display a splash screen and waits for few seconds. if you don’t enter anything, it loads the default kernel image that is specified in the grub configuration file.
  3. This Configuration file is available in /boot/grub/menu.list path that contains the kernel and Initial RAM Disk (initrd) image to load and execute it.

Kernel In Linux Booting Process

Initially, the Kernel loads in the Read-Only Mode.

  1. Mounts the root file system as specified in the “root=” in menu.list.
  2. Loads the actual root file system.
  3. Fetches details from the drivers.
  4. Mounts the Root filesystem in Read Only Mode and validates the rootfile system if it requires.
  5. Switches the root filesystem into the actual filesystem in Read Only Mode.
  6. Loads the Ethernet, RAID, SCSI devices.
  7. Setup hostname from etc/rc.sysinit
  8. Checks the Kernel filesystem.
  9. Remounts the filesystem in r,w mode.
  10. Reads fstab and mount then up.

Init In Linux Booting Process

The Init is available in “sbin/init” path. This is the first program that is being executed. The main functions of init are:

  1. It Executes the “fsck” if it is requires.
  2. This coordinates the rest of the boot process and configures the environment for the user.
  3. It becomes the parent or grandparent of all the processes that starts automatically on the system.
  4. It checks the Run Level in the path of “/etc/inittab” file to decide the Linux run level.
  5. The Init identifies the default initlevel from “/etc/inittab” and uses that to load all the appropriate programs.
  6. It Execute the ‘grep initdefault /etc/inittab’ on the system to identify the default Run level sets in the system.

Run-Level In Linux Booting Process

When the Linux system is booting up, you might have seen the various service settings displays on the screen. The run level is a state of init of the whole system that defines what system services are operating.

0It Shuts down the system
1Single-user mode
2Multi-user mode without networking
3multi-user mode with networking
5X11 with Multi-user mode without networking
6Reboots the system to restart it
Different Runlevel in Linux Booting process
  • It determines what are the programs should execute after the Operating System boots up.
  • The runlevel defines the state of the machine after boot.
  • The system executes the default init level setting programs as per the user configuration available in the below directories:
    • Run level 0 – “/etc/rc.d/rc0.d/“.
    • Run level 1 – “/etc/rc.d/rc1.d/“.
    • Run level 2 – “/etc/rc.d/rc2.d/“.
    • Run level 3 – “/etc/rc.d/rc3.d/“.
    • Run level 4 – “/etc/rc.d/rc4.d/“.
    • Run level 5 – “/etc/rc.d/rc5.d/“.
    • Run level 6 – “/etc/rc.d/rc6.d/“.

there are also symbolic links available for these directories under “/etc/” directly. So the “/etc/rc0.d” is linked to “/etc/rc.d/rc0.d“.

You can go to the “/etc/rc.d/rc*.d/” directories to see that some of the files start with S and K. The programs start with S are used during startup (Start). The programs that start with K are used during shutdown (Kill). You can look at the numbers right next to the S and K in the program names. Those are the sequence numbers in which the programs will be started or killed. The above 6 stages of the Linux process are used for a complete startup of any Linux system.

Then finally the “/etc/rc.d/rc.local” will be executed to prompt for User login. Now your system is ready for the user to do any task or run any application program.

Notify of
1 Comment
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Scroll to Top