Course contentsShow
← Linux
Lesson 1768 of 1,81915. Kernel Concepts for Systems AdministratorsFree lesson

Initial Ramdisk and early init

You will troubleshoot issues related to initrd and early hardware drivers.

In this lesson, you will learn how to troubleshoot the critical "hand-off" phase where the Linux kernel mounts the root filesystem by identifying missing early hardware drivers in the initrd.

The Chicken-and-Egg Problem

When your system boots, the kernel resides on the disk, but it often lacks the drivers required to talk to the disk controller or the filesystem containing your OS (e.g., NVMe drivers or LVM/RAID support). The initrd (Initial Ramdisk) solves this by providing a small, temporary filesystem loaded into memory that contains the essential modules needed to "find" the real root partition.

If you encounter a kernel panic or a mount: mounting /dev/sda1 on /sysroot failed: No such device error, you are likely missing a driver in the initrd.

Troubleshooting the Initrd

The most common cause of early boot failure is an improperly regenerated initrd after a kernel update or a storage controller swap. To inspect what is actually inside your current initrd, you can unpack it:

mkdir /tmp/initrd_inspect
cd /tmp/initrd_inspect
zcat /boot/initrd.img-$(uname -r) | cpio -idmv

Once unpacked, look into the lib/modules/$(uname -r)/ directory. If the kernel module for your disk controller (e.g., nvme.ko or ahci.ko) is missing, the kernel will panic because it cannot switch from the RAM-based root to the physical disk.

Debugging with 'break'

If your system fails to boot, you can often add the break=mount parameter to your kernel command line in the GRUB menu. This drops you into an early initramfs shell before the root filesystem is mounted. From here, you can manually load modules to test your hardware:

# Check if the kernel detects your disk
lsmod | grep nvme
modprobe nvme
# If this succeeds, your missing driver is identified

If modprobe works but the device still isn't visible, you may be missing udev rules or firmware files in your initrd image. You can resolve this by regenerating the image with dracut or mkinitcpio, ensuring you include the necessary host-only modules.

Key Takeaway: The initrd is a functional bridge; if your boot fails, verify the presence of storage drivers and filesystem modules within the image to ensure the kernel can transition from memory to your persistent root drive.