Linux Boot Process


If you’re a Linux newbie, the Linux Boot Process is one of the most crucial, important and fundamental thing you should know. It gives a detailed idea about how the system works, how it starts and in which order all the processes are executed. It will also help you troubleshoot problems, if the system fails to load or start. The moment you press the on button, the following process takes place, taking you to the login prompt.

How linux boott process works

How linux boott process works

1. BIOS.

  • BIOS performs a POST (Power On Self Test) to check and scan if all the hardware devices are properly connected.
  • Then it scans the first sector of Hard-drive partition to find the boot loader (GRUB LILO for Linux).
  • BIOS loads the MBR into memory.
  • Gives the control to MBR

2. MBR.

  • MBR or Master Boot Record holds information of your current Boot-loader of your Operating System.
  • MBR is less than 512 bytes in size and holds various information like boot loader information, validation check and the partition table present in your hard-drive.
  • It is always stored in the first sector of your hard-drive.
  • MBR loads the first stage loader (stage1).
  • The first stage boot loader (stage 1), loads the rest of boot loader prompting you an option to select multiple OS (if you have installed multiple OS) or loads the Operating System on hard-drive.
  • MBR loads the GRUB (boot loader for mostly all Linux OS) and gives the control over to GRUB.

3. GRUB.

  • GRUB, also known as Grand Unified Bootloader is the most common boot loader for various Linux distributions.
  • GRUB gives you an option to select multiple OS, if you have them in your hard-drive partitions.
  • The second stage loader (stage2) is loaded, giving you the GRUB screen where you can select multiple OS or change the default settings or edit start-up parameters.
  • GRUB has the kernel and intrid images, which it loads and executes.

4. Kernel.

  • Kernelis loaded in two steps:
    1. Kernel is loaded in Memory and decompressed and sets up the crucial functions.
    2. Kernel then runs the init process (in /sbin/init). It also sets up user space and essential processes needed for environment and for user login.
  • To initialize the scheduler which has Process ID (PID 0) of 0, run the init process (PID 1) and then mount the system in rw mode are the responsibilities of kernel.
  • The init process in the second step loads the critical daemons, checks the fstab file and loads the partitions accordingly.

5. Init Process.

  • This process checks the ‘/etc/inittab‘ file to choose the run level.
  • It reads the file to check default init level and executes it.
  • Various init levels are:
    • 0 = Halt.
    • 1 = Single user mode.
    • 2 = Multiuser mode w/o NFS.
    • 3 = Full multiuser mode.
    • 4 = Reserved (for future use).
    • 5 = X11.
    • 6 = Reboot.

6. Run level programs.

  • If you press any key when you see the GUI and system is loading up, you go into the text mode, where you can see the kernel starting and testing all the daemons. Eg: Starting DHCP server…. Ok.
  • These are run-level programs, defined in your run level directory. You can change these run-levels in
    /etc/rc.d/rc*/d‘, where * varies from 0-6.
  • These run-levels also have symbolic links in ‘/etc/’. That is ‘/etc/rc0.d‘ has symbolic link with ‘/etc/rc.d/rc0.d‘.

So that is how the Linux Operating system boots up. Have any queries? Fell free to comment and ask.

Leave a Reply