Categories: Linux How To

Linux Boot Process Explained Step by Step in Detail

In this article I will give you an step by step overview of Linux boot process with some flowchart diagrams which can help you understand better.

Stages of Linux Boot Process (flowchart)

  • BIOS Stage
  • Boot Loader Stage
  • Kernel Stage

BIOS Stage

  • When the machine is powered on BIOS is the first one to be called to verify if the hardware is present in the machine and if it is functioning.
  • This is done by performing a Power On Self Test (POST)
  • After a successful test, BIOS checks the MBR (Master Boot Record) in the hard disk to check if it refers to the location of the boot loader.

Boot Loader Stage

The boot loader will be installed if an operating system is installed on the system.

Two of the most common boot loaders are

  • LILO (Linux Loader)
  • GRUB (Grand Unified Boot Loader)

  • The boot loader will present the user with a list of menu entries, each of which corresponds to different operating system
  • The boot loader will then start to boot the operating system
  • When you select the the option to start Linux, it decompresses the Linux kernel in memory
  • After that Linux kernel creates initrd (Initial ramdisk)
  • The initrd is used by the Linux kernel as a temporary filesystem in the memory
  • It contains tools and kernel modules which will continue the boot process including mounting a virtual root file system temporarily.
  • Instead of using initrd, some Linux filesystem will also use initramfs.
  • It serves the same purpose of initrd, it is just that it is a successor of initrd
  • linuxrc is an executable file that is next spawn, it probes the mass storage hardware and finds a suitable kernel module to drive the mass storage hardware
  • This is required to prepare the real root filesystem to be mounted by the Linux kernel

Kernel Stage

    • In the kernel stage of the Linux boot sequence, the Linux kernel based on the result of linuxrc can then mount the real root file system
    • The real root file system in Linux is referenced as "/" and it is where all other sub directory and files visible when Linux is running exist
    • The kernel will then spawn the init process, this process always has the process identifier (PID) as "1" because it is the first background process or daemon started by the kernel upon boot
    • All other background daemons are spawned from the init process
    • So the init process will load other system daemons depending upon the configuration of different runlevel

For example:

  • If the system boots into runlevel 3 then the init process will start all the daemons from this runlevel.
IMPORTANT NOTE:
Run level 3 refers to multi-user.target

Lastly I hope the Linux Boot process explained using flowchart in this article was helpful. So, let me know your suggestions and feedback using the comment section.

View Comments

  • This is the best explanation I've ever seen in the Internet for the Linux boot process.

Share
Published by
admin

Recent Posts

2 commands to copy folder from local to remote or vice versa in Linux

ssh copy folder from local to remote. ssh copy folder from remote to local server. ssh copy folder from one…

2 weeks ago

How to check if string contains numbers, letters or characters in shell script

bash check if string contains numbers. bash check string contains letters. bash check if string contains special characters. bash check…

2 weeks ago

How to get script execution time from within the shell script in Linux

In my last article I shared examples to get script name and script path in a shell script, Now let…

2 weeks ago

How to get script name, script path within the bash script in Linux

Get script full path, bash get script directory, bash get script path, bash get script name, shell get script name…

3 weeks ago

How to add a user to a group or remove user from a group in Linux

How to add or remove user from a group in Linux. How to add a user to a group in…

3 weeks ago

How to restrict or allow ssh only from certain users, groups or hosts in Linux

How to configure SSH to permit root login only from specific host or IP address? How to configure SSH to…

3 weeks ago