The Linux Booting Process: Step by Step Explained in Detail

The Linux Booting Process: Step by Step Explained in Detail

Boot Process In Linux In 6 Levels will be checked on this tutorial. After you press the power button on your system and after a while, you will see the login prompt Linux.

Ever wonder what happens when you press the power button and until you see the Linux login prompt page?

List Of The 6 Steps In The Linux Boot Process

  1. BIOS – POST(Power-on-self-testing)
  2. MBR (Master Boot Record)
  3. GRUB (GRand Unified Bootloader)
  4. Linux Kernel
  5. Init
  6. Run Level

BIOS POST boot process

  • BIOS stands for Basic Input / Output System.
  • It does some health checks on the system.
  • The boot loader program searches, loads, and executes.
  • To find the boot loader, go to Floppy, CD-ROM, or hard drive. You can press a key to change the boot process while starting the BIOS. (Usually F12 and F2 depending on your system)
  • As soon as the boot loader program is detected and loaded into memory, the bios give it control (boot loader).
  • So in simple terms, the BIOS loads and executes the MBR boot loader.

MBR boot process

  • MBR stands for Master Boot Record.
  • MBR is located in the first sector of the bootable disk. It is usually /dev/hda/ or /dev/sda/.
  • The MBR size is less than 512 bytes, which has 3 components: 1– Primary boot loader information in the first 446 bytes 2– Partition table
  • information in the next 64 bytes. 3– Check or check MBR validation which is done in the last 2 bytes.
  • MBR contains information about GRUB (or LILO in older systems).
  • So in simple terms, MBR is responsible for loading and running the GRUP boot loader.

GRUB boot process

  • GRUB stands for Grand Unified Bootloader.
  • If you have multiple kernels installed on your system, you can select one to run.
  • GRUB displays the splash page (meaning the operating system logo), waits for a few seconds, if you do not enter anything, Grab itself executes the default kernel specified in its configuration file.
  • GRUB has filesystem knowledge. (The old LILO Linux didn’t detect filesystem)
  • The GRUB settings file is in the path /boot/grub/grub.conf/ (which is linked to the /etc/grub.conf file)
  • Below is an example of the grub.conf file for CentOS.
  • As you can see in the information above, this file contains the kernel and initrd image.
  • So, simply put, GRUB only loads and executes Kernel and initrd image.

Kernel boot process

  • The file mounts the root system according to what is specified against “root =” in the grub.conf file.
  • Kernel runs the program /sbin/init/.
  • Since init was the first program to run by Kernel Linux, it has been the No. 1 process id or PID. 
  • Pe -ef | command Run grep init to check the PID.
  • initrd stands for Initial RAM Disk.
  • initrd is used by the kernel as a temporary root system file until the kernel is booted and the main root file system is mounted. It also
  • includes drivers needed to compile itself, which will help it access hard drive partitions or other hardware.

Init boot process

  • init examines the /etc/inittab file to decide on the run level in Linux.
  • Below you can see the running levels
    • 0 – halt
    • 1 – single user mode
    • 2 – multiuser, without NFS
    • 3 – full multiuser mode
    • 4 – unused
    • 5 – x11
    • 6 – reboot
  • init actually identifies the default init level via the /etc/inittab file and uses it to load all the required programs.
  • Run the grep –color initdefault/etc/inittab command on your system to see the run level or default execution levels.
  • If you want to create trouble for yourself, you can set your default run level to 6 or 0. Since you know the meaning of 0 and 6, you never do that. 🙂
  • You may want to set your default run level to 3 or 5.

Runlevel applications

  • When the Linux system is booting, you may see various services starting up. For example, it may tell you that the Sendmail service was successfully launched. “starting Sendmail… OK,” which are run-level programs from the run-level directory (specified by your run level).
  • Depending on your default init level settings, the system will run through one of its subroutine 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/

  • Note that there are also symbolic links directly to the following directories in /etc. So /etc/rc0.d is linked to /etc/rc.d/rc0.d.
    rc0.d -> rc.d / rc0.d
  • In the /etc/rc.d/rc*.d/ directory, you should see programs that started with S and K.
  • Programs that start with S are used when the operating system is up. S is for the startup.
  • Programs that start with K are used during the operating system’s shutdown. K is for the kill.
  • Along with S and K, several numbers in the program name indicate the sequence number of the program to be started or killed.
  • For example, S12syslog is for starting a Syslog service, whose sequence number is 12S80sendmail is for starting the Sendmail service, which has sequence number 80. So the Syslog program should start before Sendmail.

In this tutorial, we explain the boot process in Linux in a quickest way possible.

I hope you enjoyed reading this article.
Please do share your opinions with us.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top