Overview of the boot process
Every time you push the power button, depending on your system, the login screen appears on your display after a while. You might be wondering what operations go place behind the scenes to prepare the system for users. We will talk about how Linux handles the boot process in this part. The entire procedure may be broken down into the following 6 steps: BIOS
, MBR
, GRUB
, kernel
, init
, and runlevel
. Let’s examine each phase in more detail.
- BIOS: When you press the power button, this is the first process that fires. The CPU looks into the ROM for further instructions. BIOS stands for basic input/output system. Initially, it does some system integrity check and then searches for boot loader in the floppy disk, hard drive, or CD/DVD.
- MBR: It stands for master boot record. It takes up 512 bytes of space and is found on the bootable disk’s first sector. In most cases,
/dev/hda
or/dev/sda
. Now because MBR is ignorant of the idea of a file system, it is unable to load the kernel directly. Instead, it needs a boot loader with file system drivers for all available file systems so that the boot loader can recognize and access them. - GRUB: It stands for the grand unified bootloader. If your system has many installed kernel images, you can select which one to run and GRUB is familiar with the filesystem. Additionally, it allows you to change a few kernel settings by tapping a string of keys on the keyboard. The
/boot/grub/grub.conf
configuration file for GRUB. - Kernel: Mounts the root file system as specified in the “
root=
” ingrub.conf
. The kernel initializes memory and devices as soon as it is loaded. The/sbin/init
program is run by the kernel. Init has a process id (PID) of 1 since it was the first application the Linux Kernel ran. Run the command below to check the PID.
$ ps -ef | grep init
- Init: It puts the system through its paces to enter the run level set in
/etc/inittab
. Following are the available run levels- 0: halt
- 1: Single-user mode
- 2: Multiuser, without NFS
- 3 : Full multiuser mode
- 4: Unused
- 5: X11
- 6: Reboot
You can check the current runlevel
by running the command below.
$ who -r
- Runlevel: You could observe numerous services starting up while the Linux system boots up. These are the
runlevel
programs, which are run from the run level directory that your run level has specified.