Daily Dev Tracker

A minimal and sleek daily developer productivity tracker.


Project maintained by devil-1964 Hosted on GitHub Pages — Theme by mattgraham

Linux Boot Process

Overview

The Linux boot process is a series of steps that transforms a powered-off computer into a fully functional Linux system ready for user interaction.

Complete Boot Process Flow

Power On → BIOS/UEFI → Boot Loader → Kernel → Init System → User Space
    ↓         ↓           ↓            ↓         ↓           ↓
   POST   Hardware    GRUB/LILO    vmlinuz   systemd    Desktop/Login
         Detection                            /etc/

Detailed Boot Stages

1. Power-On Self Test (POST)

┌─────────────────────────────────────┐
│              POWER ON               │
├─────────────────────────────────────┤
│              POST Phase             │
│  ┌─────────────────────────────┐    │
│  │  • CPU Check               │    │
│  │  • RAM Test                │    │
│  │  │  • Memory Size Detection │    │
│  │  │  • Memory Error Check    │    │
│  │  • Hardware Detection      │    │
│  │  │  • Storage Devices       │    │
│  │  │  • Network Cards         │    │
│  │  │  • Graphics Cards        │    │
│  │  • Peripheral Check        │    │
│  └─────────────────────────────┘    │
└─────────────────────────────────────┘

What Happens:

2. BIOS/UEFI Firmware

BIOS (Basic Input/Output System)

┌─────────────────────────────────────┐
│              BIOS Mode              │
├─────────────────────────────────────┤
│  Boot Device Priority:              │
│  1. Hard Drive (MBR)               │
│  2. CD/DVD Drive                   │
│  3. USB Drive                      │
│  4. Network Boot (PXE)             │
├─────────────────────────────────────┤
│         MBR Structure               │
│  ┌─────┬─────────┬─────────────┐    │
│  │Boot │Partition│  Boot       │    │
│  │Code │  Table  │ Signature   │    │
│  │446B │   64B   │     2B      │    │
│  └─────┴─────────┴─────────────┘    │
│     ↓                               │
│  Loads Bootloader                   │
└─────────────────────────────────────┘

UEFI (Unified Extensible Firmware Interface)

┌─────────────────────────────────────┐
│              UEFI Mode              │
├─────────────────────────────────────┤
│  EFI System Partition (ESP)        │
│  ┌─────────────────────────────┐    │
│  │  /boot/efi/                 │    │
│  │  ├── EFI/                   │    │
│  │  │   ├── BOOT/              │    │
│  │  │   │   └── bootx64.efi    │    │
│  │  │   └── ubuntu/            │    │
│  │  │       └── grubx64.efi    │    │
│  │  └── System Volume Info     │    │
│  └─────────────────────────────┘    │
├─────────────────────────────────────┤
│         Benefits over BIOS          │
│  • Faster boot times              │
│  • Support for drives > 2TB       │
│  • Secure Boot capability         │
│  • Better hardware support        │
│  • Graphical interface            │
└─────────────────────────────────────┘

3. Boot Loader Stage

GRUB (Grand Unified Bootloader)

┌─────────────────────────────────────┐
│            GRUB Menu                │
├─────────────────────────────────────┤
│  Ubuntu 22.04 LTS                  │
│  Advanced options for Ubuntu       │
│  Memory test (memtest86+)          │
│  Memory test (memtest86+, serial)  │
├─────────────────────────────────────┤
│           GRUB Stages               │
│                                     │
│  Stage 1: (MBR/GPT)                │
│  ┌─────────────────────────────┐    │
│  │  • Located in MBR           │    │
│  │  • 446 bytes of code        │    │
│  │  • Loads Stage 1.5          │    │
│  └─────────────────────────────┘    │
│                                     │
│  Stage 1.5: (Boot Sector)          │
│  ┌─────────────────────────────┐    │
│  │  • File system drivers      │    │
│  │  • Loads Stage 2            │    │
│  └─────────────────────────────┘    │
│                                     │
│  Stage 2: (/boot/grub/)             │
│  ┌─────────────────────────────┐    │
│  │  • Full GRUB functionality  │    │
│  │  • Kernel selection         │    │
│  │  • Configuration files      │    │
│  └─────────────────────────────┘    │
└─────────────────────────────────────┘

GRUB Configuration:

4. Kernel Loading and Initialization

Kernel Load Process

┌─────────────────────────────────────┐
│          Kernel Loading             │
├─────────────────────────────────────┤
│  1. Load vmlinuz                    │
│     ┌─────────────────────────┐     │
│     │  Compressed Kernel      │     │
│     │  /boot/vmlinuz-x.x.x    │     │
│     └─────────────────────────┘     │
│                ↓                    │
│  2. Load initrd/initramfs           │
│     ┌─────────────────────────┐     │
│     │  Initial RAM Disk       │     │
│     │  /boot/initrd.img       │     │
│     │  • Essential drivers    │     │
│     │  • File system modules  │     │
│     └─────────────────────────┘     │
│                ↓                    │
│  3. Kernel Decompression            │
│     ┌─────────────────────────┐     │
│     │  Self-extracting        │     │
│     │  Kernel archive         │     │
│     └─────────────────────────┘     │
└─────────────────────────────────────┘

Kernel Initialization Steps

┌─────────────────────────────────────┐
│        Kernel Initialization        │
├─────────────────────────────────────┤
│  Phase 1: Hardware Setup           │
│  ┌─────────────────────────────┐    │
│  │  • CPU initialization      │    │
│  │  • Memory management setup │    │
│  │  • Interrupt handling      │    │
│  │  • Timer initialization    │    │
│  └─────────────────────────────┘    │
│                ↓                    │
│  Phase 2: Core Subsystems          │
│  ┌─────────────────────────────┐    │
│  │  • Process management      │    │
│  │  • Virtual memory system   │    │
│  │  • File system support     │    │
│  │  • Device driver loading   │    │
│  └─────────────────────────────┘    │
│                ↓                    │
│  Phase 3: Root File System         │
│  ┌─────────────────────────────┐    │
│  │  • Mount root partition     │    │
│  │  • Switch from initramfs    │    │
│  │  • Load remaining modules   │    │
│  └─────────────────────────────┘    │
└─────────────────────────────────────┘

5. Init System (systemd)

systemd Boot Process

┌─────────────────────────────────────┐
│           systemd Boot              │
├─────────────────────────────────────┤
│  PID 1: systemd                    │
│  ┌─────────────────────────────┐    │
│  │  • First user space process │    │
│  │  • Parent of all processes  │    │
│  │  • Manages system services  │    │
│  └─────────────────────────────┘    │
│                ↓                    │
│  Boot Targets (Runlevels)          │
│  ┌─────────────────────────────┐    │
│  │  • rescue.target (1)        │    │
│  │  • multi-user.target (3)    │    │
│  │  • graphical.target (5)     │    │
│  └─────────────────────────────┘    │
│                ↓                    │
│  Service Dependencies              │
│  ┌─────────────────────────────┐    │
│  │     basic.target            │    │
│  │           ↓                 │    │
│  │     sysinit.target          │    │
│  │           ↓                 │    │
│  │     local-fs.target         │    │
│  │           ↓                 │    │
│  │     network.target          │    │
│  └─────────────────────────────┘    │
└─────────────────────────────────────┘

systemd Units

Unit Types:
┌─────────────────────────────────────┐
│  • .service  - System services     │
│  • .target   - Group of units      │
│  • .mount    - Mount points        │
│  • .device   - Hardware devices    │
│  • .socket   - Network sockets     │
│  • .timer    - Scheduled tasks     │
│  • .path     - File/directory      │
│  • .slice    - Resource management │
└─────────────────────────────────────┘

Service States:
┌─────────────────────────────────────┐
│  • inactive  - Not running         │
│  • active    - Running             │
│  • failed    - Exited with error   │
│  • activating - Starting up        │
│  • deactivating - Shutting down    │
└─────────────────────────────────────┘

6. User Space Initialization

System Services Startup

┌─────────────────────────────────────┐
│         Service Startup Order       │
├─────────────────────────────────────┤
│  1. Kernel Modules                  │
│     • Hardware drivers             │
│     • File system modules          │
│                                     │
│  2. File Systems                    │
│     • Mount /proc, /sys, /dev       │
│     • Mount user partitions        │
│                                     │
│  3. System Services                 │
│     • systemd-logind               │
│     • NetworkManager               │
│     • chronyd/ntpd                 │
│     • rsyslog                      │
│                                     │
│  4. User Services                   │
│     • SSH daemon                   │
│     • Web servers                  │
│     • Database services            │
│                                     │
│  5. Desktop Environment             │
│     • Display manager (gdm/sddm)   │
│     • Window manager               │
│     • Desktop services             │
└─────────────────────────────────────┘

Boot Process Timeline

Time    Stage           Details
0s      Power On        POST begins
2s      BIOS/UEFI      Hardware detection
3s      Boot Loader     GRUB menu (if timeout)
5s      Kernel Load     vmlinuz decompression
7s      Kernel Init     Hardware initialization
10s     initramfs       Essential drivers load
12s     Root Mount      Switch to real root FS
15s     systemd         Init system starts
18s     Services        System services start
25s     Login Ready     Desktop/TTY available

Boot Troubleshooting

Common Boot Issues

┌─────────────────────────────────────┐
│           Boot Problems             │
├─────────────────────────────────────┤
│  1. Hardware Issues                 │
│     • RAM failure                  │
│     • Hard drive failure           │
│     • Power supply problems        │
│                                     │
│  2. GRUB Issues                     │
│     • Corrupted boot loader        │
│     • Missing kernel               │
│     • Wrong root partition         │
│                                     │
│  3. Kernel Issues                   │
│     • Kernel panic                 │
│     • Missing drivers              │
│     • Corrupted initramfs          │
│                                     │
│  4. File System Issues             │
│     • Corrupted root FS            │
│     • Wrong fstab entries          │
│     • Disk full                    │
│                                     │
│  5. Service Issues                  │
│     • Failed services              │
│     • Dependency conflicts         │
│     • Configuration errors         │
└─────────────────────────────────────┘

Recovery Options

┌─────────────────────────────────────┐
│          Recovery Methods           │
├─────────────────────────────────────┤
│  1. GRUB Rescue                     │
│     • Boot from GRUB command line  │
│     • Manually specify kernel      │
│                                     │
│  2. Single User Mode                │
│     • systemctl rescue             │
│     • Minimal system boot          │
│                                     │
│  3. Live USB/CD                     │
│     • Boot from external media     │
│     • chroot into installed system │
│                                     │
│  4. Recovery Kernel                 │
│     • Previous kernel version      │
│     • Safe mode boot               │
└─────────────────────────────────────┘

Boot Configuration Files

Important Files

Kernel Parameters

Common kernel boot parameters: