Booting Process of Linux System

Booting Process of Linux System


6 Stages of Linux Boot Process (Startup Sequence) 
Here we are learn about the booting process of linux system. We are study how to boot the linux operating system into our physical hardware or virtual environment.

Steps to Follow the Process -:

1. Introduction -:

The start-up of a Linux operating system follows a step-by-step process.
This process starts with the power on or by running a command in the

How Linux Kernel Boots? - GeeksforGeeks 

This tutorial, we will go through the booting process of a Linux system.


2. Basic Input/Output System (BIOS) -:

First, the BIOS (Basic Input/Output System) or UEFI (Unified
Extensible Firmware Interface) program kicks in once the system powers
up. Usually, the BIOS contains all the code to gain initial access to
the main machine devices:

  • keyboard
  • display screen
  • disk drives
  • serial communications

However, most of these devices will have dedicated device drivers taking over once the system boots fully.

BIOS and UEFI are firmware interfaces that computers use to boot up the operating system (OS). Yet, the two programs differ in how they store metadata on and about the drive.

  1. BIOS uses the Master Boot Record (MBR)
  2. UEFI uses the GUID Partition Table (GPT)

Next, the BIOS or UEFI runs the power-on self-test (POST). The POST does a series of tasks:

  • verify the hardware components and peripherals
  • carry out tests to ensure that the computer is in proper working condition

Further, if this test finds any error, it commonly shows an error
message on the screen. In case the test fails to detect the RAM, POST
triggers a beeping sound.

Finally, if the system passes the POST, it signals the start-up process to the next stage.


3. BootLoader -:

The BIOS or UEFI has run the POST to check the state of the machine. Moving on, the BIOS/UEFI selects a boot device depending on the system configuration. Usually, there’s a default boot order -:

  1. Hard drives
  2. USB drives
  3. CD drives

Of course, we can configure the BIOS or UEFI to choose the boot
device in any order. Whatever their order, the computer looks for the
boot loader in these devices one by one. 

A BIOS system has the boot loader located in the first sector of the boot device; this is the MBR. It takes up the first 512 bytes on the disk. On the other hand, a UEFI system stores all startup data in an .efi file. The file is on the EFI System Partition, which contains the boot loader.

For example, we can use fdisk to check the system partition on our machine:

$ sudo fdisk -l
Disk /dev/sda: 15 GiB, 16106127360 bytes, 31457280 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 82557390-5BF9-4C36-A455-93139BA1B7B6

Device       Start      End  Sectors  Size Type
/dev/sda1     2048     4095     2048    1M BIOS boot
/dev/sda2     4096  1054719  1050624  513M EFI System
/dev/sda3  1054720 31455231 30400512 14.5G Linux filesystem

The boot loader is a small program that loads the operating system.
The main job of the boot loader is to perform three actions with the
kernel: locate on the disk, insert into memory, and execute with the
supplied options.

The following are some of the available boot loaders for a Linux system:

  • LILO
  • GRUB2

In general, once the computer finds the boot loader on a device, it
will run it. Consequently, this loads a larger and more complex program
which eventually starts our operating system.


4. Kernal -:

After going through BIOS or UEFI, POST, and using a boot loader to initiate the kernel, the operating system now controls access to our computer resources.

Here, the Linux kernel follows a predefined procedure:

  1. decompress itself in place
  2. perform hardware checks
  3. gain access to vital peripheral hardware
  4. run the init process

Next, the init process continues the system startup by running init
scripts for the parent process. Also, the init process inserts more
kernel modules (like device drivers).


5. Systemd -:

To reiterate, the kernel initiates the init process, which starts the parent process. Here, the parent of all Linux processes is Systemd, which replaces the old SysVinit process. Following the booting steps, Systemd performs a range of tasks:

  • probe all remaining hardware
  • mount filesystems
  • initiate and terminate services
  • manage essential system processes like user login
  • run a desktop environment

Indeed, these and other tasks allow users to interact with the system. systemd uses the /etc/systemd/system/ file to decide the state or target the Linux system boots into.


6. Target/Run Level -:

The run level stands for the current state of the operating system. Run levels define which system services are running. Previously, SysVinit identified run levels by number. However, .target files now replace run levels in Systemd.

Further, Systemd activates the unit by default when the system boots. Let’s check our default target:

# systemctl get-default

Now, let’s see the link between run level numbers and targets:

  1., run level 0: turn off (shut down) the computer
  2. rescue.targetrun level 1: initiate a rescue shell process
  3. multi-user.targetrun level 3: configure the system as a non-graphical (console) multi-user environment
  4., run level 5: establish a graphical multi-user interface with network services
  5. reboot.targetrun level 6: restart the machine
  6. emergency run level

For instance, the target value for a desktop workstation with a graphical user interface (GUI) is 5. This value stands for run level 5 which is Also, the run level for a server without a GUI is 3 because the default target is

In addition, we can change the target (run level) while the system runs. This change entails that only services and other units defined under that target will now run on the system.

For example, to switch to run level 3 from run level 5, we can run the following command:

$ systemctl isolate

Then, to take the system to run level 5, let’s run the command:

$ systemctl isolate

This command returns the run level to, equivalent to level 5 for GUI.


7. Result -:

Linux Boot Process Step by Step Explained

In this article, we’ve seen the boot process of a Linux system. Also, we
discussed several boot loaders and their functions. Finally, we went
over the various run levels that a Linux system can enter during the
boot process.

Thanks you for reading this post. I hope this is helpful for you.