Debian

Understanding Debian Boot Process Step by Step

This article explains Debian Linux boot process step by step starting from the BIOS to the /sbin/init execution including the boot loader, init and init.

The first software to be executed when you turn on your PC is the BIOS, followed by the boot loader (GRUB, LILO in other systems) usually installed on the MBR (Master Boot Record), then the /init program with the initramfs image in memory as the temporary root file system and then executes the /sbin/init while switching the root file system to the disk.

Let’s start with each step, beginning with the BIOS.

The Debian Boot Process: The BIOS

The BIOS is the first software interacting with the hardware, it starts all devices,
depending on its configuration which usually we can access by pressing Del or F2.

From the BIOS configuration we can define how the boot process will continue, usually the BIOS configuration panel contains a menu dedicated to the boot process in which we can define if the next step will be to boot from the hard disk, an external drive or USB stick, an optical disk like a DVD, network book, etc.

As said before, the BIOS initializes the hardware and its configuration panel let us enable and disable certain hardware both definitively or during the boot process.

The BIOS also contains information on the hardware temperature, cooler health, RAM, storage devices, virtualization support, processor and cores among more options.

Almost always when troubleshooting a PC among the first steps there is work with the BIOS. In IT Security the BIOS plays a key role preventing local vulnerabilities exploitation, a wrong configuration may lead to security and functional failures.
In an usual Debian Boot Process the next step after the BIOS initialization is the Boot Loader which usually occupies the second step in the process.

The Debian Boot Process: The Boot Loader

Within the first 2 blocks of a storage device there is the MBR (Master Boot Record) which contains information on the partitioning, filesystem. Many users confuse the MBR with the Boot Loader, the MBR is a defined location within a block device while Boot Loader is a program of higher lever, which the user can easily manipulate. The Boot Loader is what Debian users know as GRUB, other Linux users may know it as LILO, SysLinux, Windows Boot Manager for Windows users, etc.

From the Boot Loader we can determine how next steps will be carried out, we can edit define different OS, kernels and startup parameters.

By default Debian brings GRUB as Boot Loader, GRUB configuration file can be found at /boot/grub/menu.lst and the bootloader must be updated by running the command update-grub to test and apply any change.

The Boot Loader allows us to boot in recovery mode or mount the OS with root privileges to fix issues or reset the password, like happens with the BIOS, the GRUB loader is also of interest for IT security.

Just like the BIOS defined the steps for the Boot Loader, the Boot Loader defines the the settings for the /init process which prepares the PC for the last step.

The Debian Boot Process: The /init

The /init is a shell script running within the initramfs initializing the kernel, at this stage you should know the /init initializes the kernel compressed as cpio.

The Debian Boot Process: The /sbin/init

Here is where the OS initializes. The runlevel N (boot) initializes only necessary scripts to pass to runlevel S (Single user) to end initializing the hardware and then switches to a runlevel ranging between 2 and 5 to start system services.
Below you can see a list including all runlevels and their meaning:

RunLevel Support Task
N None  
0 Shutdown Shutdown, its directory is /etc/rc0.d/
1 Single User Single user, its directory is /etc/rc1.d/
2 Multi User without network Multi User without network, at /etc/rc2.d/
3 Multiuser with networking Multi User with network, at /etc/rc3.d/
4 Multiuser with networking Multiuser with networking, at /etc/rc4.d/
5 Multiuser with graphics Multi user, X11, its directory is /etc/rc5.d/
6 Reboot Reboot

The runlevel directories link to scripts located in the /etc/init.d/, this is a directory where an administrator can locate scripts to be executed at boot.

The /sbin/init is the last step in Debian Linux and derived distributions, it will bring the OS up to the proper runlevel.

This boot process is really simple to understand, any user, even when not familiarized with Linux already knows steps like BIOS and Boot Loader.

I hope you found this article helped you to Understand the Debian Boot Process Step by Step.

About the author

Ivan Vanney

Ivan Vanney

Ivan Vanney has over 2 years as writer for LinuxHint, he is co-founder of the freelance services marketplace GIGopen.com where he works as a sysadmin.