How a Linux Machine boots

Reading Time: 3 minutes

Introduction

In the Linux Operating system User press the power button and operating system will be loaded automatically and the user will start working on the computer (Linux machine).The linux booting process is start pressing the power button and done the reaching user interface in the machine.

Booting Process
Booting Process

There are Six steps available in booting process:

  1. BIOS
  2. MBR
  3. GRUB
  4. Kernel
  5. Init
  6. Run levels

Booting Process

BIOS

Switch on the power of machine, And it supply power to all the component of the machine after this performed POST (Power on self test) Operation. It check all the components if the connectivity is good It provide a healthy beep otherwise give an error message on the screen.

It will search the booting device, Once the Boot loader is detected and load into the memory and BIOS give the control. The simple term bios loads and executes the MBR boot loader.

MBR

MBR stands for Master Boot Record. It is located in the First sector of the Bootable disk /dev/sda or dev/hda .

Depending on your hardware and the MBR is 512 Bytes in size. It contain the information about the GRUB and liloBut lilo is very old system. The simple word MBR loads and executed the GRUB boot load and Grub contain the information of file system.

GRUB

It is stand for Grand Unified Bootloader, If you have multiple Kernel image install in your system, you can choose which one to be execute. Grub displays a splash, wait for few second , if you don’t enter anything, it loads the default Kernel image as specified in the grub configuration file. Grub configuration file is /boot/grub/grub.conf, it contains Kernel and initrd image.

Kernel

Kernel mount the root file system as specified in the grub.conf file. Once the kernel start working first step is executing the sbin/init process. The Initrd (initial ram disk) is used by the kernel as a temporary root file system. until kernel is booted and the real root file system is mount. It contains the necessary drives of the drivers compiled inside, which helps to access the hard partition or the other hardware.

INIT/SystemD

Init stand for Initialization and system Daemon. Init is the parents process and Pid is 1.

The /etc/inittab file to decide the Linux run level. Run levels are decided which Initial programs are load at start up.

Following are the run levels.

  • 0 – Halt/Power on.
  • 1 – Single User Mode.
  • 2 – Multi User,Without Networking.
  • 3 – Full Multi User Mode.
  • 4 – Unused.
  • 5 – X11 (Display Manager).
  • 6 – Reboot.

Parents Process
Parents Process
system boot process
All the init/Systemd Process

Run level Programs

Depending on the init level, system will execute the program from one of the following directories.

Run level 0 — /etc/rc.d/rc0.d/ or /etc/rc0.d
Run level 1— /etc/rc.d/rc1.d/ or /etc/rc1.d
Run level 2— /etc/rc.d/rc2.d/ or /etc/rc2.d
Run level 3— /etc/rc.d/rc3.d/ or /etc/rc3.d
Run level 4— /etc/rc.d/rc4.d/ or /etc/rc4.d
Run level 5— /etc/rc.d/rc5.d/ or /etc/rc5.d
Run level 6— /etc/rc.d/rc6.d/ or /etc/rc6.d

Under the /etc/rc.d/rc*/ Directories, you would see programs that start with S and K. Programs start with S are used for startup (S for startup). Programs start with K are used for shut down (K for kill), Login prompt will be displayed to enter username or password.

Reference

https://www.freecodecamp.org/news/the-linux-booting-process-6-steps-described-in-detail/

https://blog.knoldus.com/

knoldus