Understanding how Linux boots is essential for troubleshooting startup issues on your VPS. This guide walks through every stage of the boot process, from firmware initialization to the login prompt, with practical diagnostic commands at each stage.
Boot Process Overview
# The Linux boot sequence:
# 1. BIOS/UEFI → Hardware initialization
# 2. Bootloader (GRUB2) → Loads kernel
# 3. Kernel → Hardware detection, init ramdisk
# 4. initramfs → Mounts root filesystem
# 5. systemd (PID 1) → Starts services
# 6. Login prompt → System ready
Stage 1: BIOS/UEFI
The firmware (BIOS or UEFI) performs a Power-On Self-Test (POST), initializes hardware, and looks for a bootable device. On a VPS, this is virtualized by the hypervisor (KVM/QEMU) and happens in milliseconds.
Stage 2: GRUB2 Bootloader
GRUB2 (GRand Unified Bootloader) loads the Linux kernel and initial ramdisk into memory.
# View GRUB configuration
cat /boot/grub/grub.cfg
# View default boot entry
grub-editenv list
# Check installed kernels
ls /boot/vmlinuz-*
# View kernel boot parameters
cat /proc/cmdline
# Example: BOOT_IMAGE=/vmlinuz-6.8.0-45-generic root=/dev/vda1 ro quiet
Stage 3: Linux Kernel
The kernel initializes hardware drivers, sets up memory management, and mounts the initial RAM filesystem.
# View kernel boot messages
dmesg | head -50
# Check kernel version
uname -r
# View kernel ring buffer (all boot messages)
dmesg | less
# Key things to look for in dmesg:
dmesg | grep -i "error" # Any errors during boot
dmesg | grep -i "memory" # Memory detection
dmesg | grep -i "cpu" # CPU detection
dmesg | grep -i "disk|sda|vda" # Disk detection
Stage 4: initramfs
The initial RAM filesystem (initramfs) contains minimal tools needed to mount the real root filesystem. It handles tasks like loading storage drivers, unlocking encrypted volumes, and assembling RAID arrays.
# List initramfs contents
lsinitramfs /boot/initrd.img-$(uname -r) | head -20
# Rebuild initramfs (Ubuntu/Debian)
sudo update-initramfs -u
# Rebuild initramfs (RHEL/Rocky)
sudo dracut --force
Stage 5: systemd (PID 1)
Once the root filesystem is mounted, systemd takes over as the first process (PID 1) and starts all system services.
# View the boot target (equivalent of old runlevels)
systemctl get-default
# graphical.target = GUI login
# multi-user.target = text-mode login (typical for servers)
# List all services started at boot
systemctl list-unit-files --state=enabled
# View the boot process as a tree
systemd-analyze critical-chain
# View boot time breakdown
systemd-analyze
# Startup finished in 1.5s (kernel) + 3.2s (userspace) = 4.7s
# See which services took the longest
systemd-analyze blame | head -15
Stage 6: Login Prompt
# getty processes provide login prompts
systemctl status getty@tty1
# SSH daemon provides remote login
systemctl status sshd
# View login history
last -10
# View failed login attempts
lastb -10
Troubleshooting Boot Issues
System Stuck During Boot
# Use VNC console (available in Kazepute portal) to see boot output
# Look for messages like:
# "A start job is running for..." — service taking too long
# "Failed to start..." — service failed
# "Dependency failed for..." — dependency chain broken
# From rescue mode or VNC:
journalctl -b -p err # Show only errors from last boot
journalctl -b -1 # Show logs from previous boot
Kernel Panic
# If the system shows "Kernel panic - not syncing":
# 1. Use VNC console to see the full error
# 2. Boot into recovery mode via GRUB
# 3. Common causes:
# - Corrupt filesystem: run fsck
# - Bad kernel update: boot previous kernel
# - Missing initramfs: rebuild with update-initramfs
Service Failures
# Check why a service failed
systemctl status nginx
journalctl -u nginx --no-pager
# Reset a failed service
sudo systemctl reset-failed nginx
sudo systemctl start nginx
# Disable a problematic service temporarily
sudo systemctl disable problematic-service
sudo reboot
Boot Performance Optimization
# Generate a boot time SVG chart
systemd-analyze plot > /tmp/boot-chart.svg
# Disable unnecessary services
sudo systemctl disable bluetooth # No Bluetooth on a server
sudo systemctl disable cups # No printing on a server
sudo systemctl mask sleep.target # Prevent accidental sleep
# Check for slow DNS resolution at boot
systemd-analyze critical-chain | grep -i dns
Understanding the boot process helps you diagnose issues that prevent your server from starting properly. When something goes wrong, knowing which stage failed narrows down the problem significantly.