Fix Kernel Panic: VFS Unable to Mount Root Filesystem
Kernel panic with 'VFS: Unable to mount root fs' occurs when the Linux kernel cannot locate or mount the root filesystem during boot. This guide covers causes and step-by-step recovery.
Symptoms
During boot, the system displays a kernel panic with the message: VFS: Unable to mount root fs on unknown-block(0,0) or similar. The boot process halts, and the system drops to a shell or hangs indefinitely. This error is common after kernel updates, hardware changes, or filesystem corruption.
Root Causes
- Missing filesystem driver: The kernel lacks the driver (e.g., ext4, xfs, btrfs) for the root filesystem.
- Corrupt or missing initramfs/initrd: The initial RAM disk is damaged or does not contain necessary modules.
- Incorrect root= parameter: The kernel command line points to a wrong device or UUID.
- Filesystem corruption: The root partition is damaged and cannot be mounted.
- Hardware changes: Disk controller or storage device changed (e.g., from SATA to NVMe).
Step-by-Step Fix
1. Boot into Recovery Mode or Live USB
Use a live Linux USB or select a recovery kernel option from GRUB. If GRUB is accessible, press e at boot to edit kernel parameters and add single or init=/bin/bash.
2. Identify the Root Partition
Run lsblk or blkid to list available disks and their UUIDs. Note the correct root partition (e.g., /dev/sda2 or UUID=xxxx).
3. Check Filesystem Integrity
Unmount the root partition if mounted: umount /dev/sda2. Then run fsck:
fsck -fy /dev/sda2 For XFS, use xfs_repair /dev/sda2. Reboot after repair.4. Rebuild Initramfs
Chroot into the system:
mount /dev/sda2 /mnt
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot /mnt Then rebuild initramfs. For Debian/Ubuntu: update-initramfs -u -k all For RHEL/CentOS: dracut -f For Arch: mkinitcpio -p linux5. Verify Kernel Command Line
Check /boot/grub/grub.cfg or /etc/default/grub for the root= parameter. Ensure it matches the correct UUID or device. Update GRUB:
update-grub(Debian/Ubuntu) orgrub2-mkconfig -o /boot/grub2/grub.cfg(RHEL).6. Reinstall Kernel (if needed)
If the kernel itself is corrupt, reinstall it:
apt install --reinstall linux-image-$(uname -r)(Debian/Ubuntu) oryum reinstall kernel(RHEL).Alternative Fixes
- Use fallback initramfs: Boot with
initrd /boot/initrd.img-if available.-fallback - Boot with nomodeset: Add
nomodesetto kernel parameters if display driver issues cause panic. - Restore from backup: If filesystem is unrecoverable, restore root from a recent backup.
Prevention
- Always keep a known-good kernel and initramfs backup.
- Test kernel updates in a staging environment before production.
- Regularly run
fsckon root filesystem during maintenance windows. - Use LVM or filesystem snapshots for quick rollback.
- Document hardware changes and update initramfs accordingly.
This error is often recoverable with a live environment and proper diagnostics. If the problem persists, consider hardware failure of the storage device.
Was this solution helpful?