Sitemap

Linux Boot Process

3 min readMar 4, 2025

--

In this blog, we will learn the Linux boot process in the simplest way. The reason for writing this blog is curiosity within me pulls down to know about what happens behind the scenes when an operating system starts. After learning about it, I couldn’t resist sharing my knowledge with all of you. I firmly believe that no individual can learn everything alone, but by sharing knowledge, we make it easier for others to understand complex concepts in a shorter span of time. Always strive to share what you know — it not only deepens your own understanding but also helps others save valuable time.

Press enter or click to view image in full size
Linux boot sequence

What happens after pressing the Power ON button of the computer?

There are six steps involved in linux booting process:-

  1. BIOS/UEFI/ Initialization:-

When the computer is powered on, the BIOS (Basic Input/ Output System) or UEFI (Unified Extensible Firmware Interface) is loaded from the motherboard firmware.

The system performs a power-on self-test (POST) to check hardware components like CPU, RAM, and disk drives.

BIOS/UEFI searches for a bootable device (HDD, SSD, USB, etc) and loads the bootloader from the boot sector.

  • Commands to check BIOS Details:-
$ sudo dmidecode -t bios

What is BIOS?

BIOS (Basic Input/Output System) is a firmware embedded in a computer’s motherboard. It is the first software that runs when you power on your computer and is responsible for initializing hardware components and starting the operating system.

Function of BIOS:- POST, locate MBR, and load boot loader from MBR.

2. Bootloader Execution (GRUB):-

Master boot record must be so small, it is also not very smart and does not understand filesystem structures. Therefore the sole purpose of MBR is to locate and load GRUB. In order to accomplish this, GRUB must be located in the space between MBR till the first partition on the drive. After loading GRUB into RAM, MBR handles control over the GRUB program.

Note:- GRUB stands for Grand Unified Boot Loader.

GRUB searches for kernel image file and its parameter. It load the linux kernel into memory. Then GRUB handover the control to kernel.

  • GRUB — most common boot loader.
  • /boot/grub/grub.cfg — GRUB config file.

Note:- The general difference between BIOS & UEFI is that BIOS is traditional and UEFI is modern one.

3. Kernel Initialization:-

The linux kernel is extracted & loaded into memory.

It initializes hardware components like CPU, memory, and device drivers.

Get Ritesh Aldak’s stories in your inbox

Join Medium for free to get updates from this writer.

It mount root filesystem as well as start init or systemd as PID 1.

4. System Initialization:-

Once the kernel is loaded, it starts the init system (systemd, SysVinit, or Upstart).

The init system is responsible for starting the system processes and services.

Systemd → Used in modern linux distributions like Ubuntu, RHEL, CentOS.

SysVinit → Used in older linux systems.

Upstart → Legacy system, replaced by systemd.

5. Run level / Target Initialization:-

Linux boots into a specific runlevel or target (systemd).

The system determines whether to boot in CLI mode, GUI mode or Other states.

Press enter or click to view image in full size

6. User Login & Shell Execution:-

  • System displays a login prompt (CLI or GUI).
  • The user enters credentials to log in.
  • The shell (bash, zsh, fish) starts, allowing command execution.
$ who # show logged-in users

$ echo $SHELL # Display default shell.

How do you change the target from graphical to multi-user?

==> First we will learn, how can we check the default systemd target set on this system?

We can use the following command to check the default systemd target

$ systemctl get-default

Now, we will change the target to multi-user. target by using the below command that is:

$ sudo systemctl set-default multi-user.target

We have to use sudo before using this root privilege command.

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

--

--