What is the boot process of a Linux system?

Why Interviewers Ask This

Senior Operating Systems engineers are expected to reason about architecture, performance, and edge cases. This question separates mid-level from senior candidates by testing deep system-level understanding.

Answer

The Linux boot process involves multiple stages from power-on to login prompt: 1. Power On / BIOS/UEFI POST: CPU starts executing from fixed address (0xFFFFFFF0). BIOS/UEFI performs Power-On Self Test (POST) — checks RAM, CPU, hardware. Identifies boot device. 2. Boot loader (GRUB2): BIOS loads the first sector (512 bytes, MBR) or UEFI loads the EFI application from the EFI partition. GRUB2 (or systemd-boot) presents the boot menu. Loads kernel image (vmlinuz-x.x.x) and initial RAM disk (initrd/initramfs) into memory. 3. Kernel initialization: CPU starts in real mode, switches to protected mode (32-bit) then long mode (64-bit). Decompresses itself. Initializes hardware: CPU, memory management (page tables), interrupt subsystem, basic device drivers. Mounts initramfs as temporary root filesystem. 4. initramfs: minimal filesystem in RAM containing: modules to access the real root device (RAID, LVM, encrypted disk drivers), scripts to mount the real root. After mounting real root, initramfs calls pivot_root or switch_root. 5. init system (systemd/PID 1): kernel executes /sbin/init (usually systemd). PID 1 is the first process — all other processes descend from it. systemd reads unit files, starts target units in dependency order. 6. Target units: sysinit.target → basic.target → multi-user.target (or graphical.target for desktop). Parallel service startup. 7. Login prompt: getty process on TTYs, display manager (GDM, LightDM) for graphical login. User authenticates → shell (bash, zsh) started. Key files: /etc/systemd/system/, /boot/grub/grub.cfg, /etc/fstab (filesystems to mount).

Pro Tip

Demonstrate both theoretical understanding and practical experience. Say what it is, then give an example of how you actually used it in a Operating Systems codebase.