• JonTechTips

    Jonny Hu

    Recovering a Linux VM That Won’t Boot After a Kernel Update

    7
    2025-10-16

    The maintenance window looks finished until the first reboot. A RHEL 9 virtual machine lands in a dracut emergency shell and complains that it cannot find the root device. The platform console still works. Before changing storage or reinstalling GRUB, try the previous kernel from the boot menu. In this example, that entry starts normally and the application comes back. The VM now has a known-good route to recovery while you investigate the new entry.

    Use the previous boot as a control

    The emergency shell is already running a kernel and initramfs. It tells you the failure happened after GRUB handed control over, even though it does not explain why the root device is missing. The previous kernel mounting the same root filesystem makes a VM-wide storage outage less likely. Capture what works before touching the failed entry.

    uname -r
    findmnt /
    df -h /boot
    sudo grubby --info=ALL

    For this lab, assume the filesystem holding /boot is almost full and the new initramfs is much smaller than the working image. Size is only a clue. An image built on a different configuration can legitimately be smaller. Read the package transaction and inspect the image contents before selecting a repair.

    sudo dnf history
    sudo dnf history info last
    sudo lsinitrd /boot/initramfs-<new-release>.img
    sudo lsinitrd /boot/initramfs-<working-release>.img

    Replace the bracketed release names before running the commands. If the last transaction is unrelated, use the kernel update’s transaction ID from the history. In this case, the relevant transaction shows a write failure under /boot, and lsinitrd cannot read the archive for the new release. That points to an incomplete initramfs rather than a bad GRUB installation. If both archives are readable, compare the storage and LVM support they contain and check the failing entry’s root arguments. A readable archive can still lack what the VM needs to discover its root device.

    Repair the new image in place

    Free space through the distribution’s package management procedure as appropriate. Keep the running kernel and its entry available. Check that the new kernel image and matching module directory exist. If either is missing, repair or reinstall the kernel package before rebuilding the initramfs. Archive the failed image off /boot if you need it for diagnosis.

    # Substitute the exact installed release, including architecture.
    release='replace-with-installed-release'
    ls -ld "/lib/modules/$release" "/boot/vmlinuz-$release"
    sudo dracut --force "/boot/initramfs-$release.img" "$release"
    sudo lsinitrd "/boot/initramfs-$release.img"
    sudo grubby --info="/boot/vmlinuz-$release"

    The explicit release matters because the running kernel is the previous one. Check that the boot entry points to the rebuilt file and carries the intended root and LVM parameters. If the archive still omits the driver needed by this VM, resolve the driver or dracut configuration issue before rebooting.

    If there is no working local entry

    Boot compatible rescue media, identify the installed root by UUID or LVM identity, and confirm the mount tree under /mnt/sysroot or the path reported by the rescue environment. Verify that a separate boot filesystem is mounted inside that tree. Otherwise, dracut may write into a directory on root that GRUB never reads. Enter the chroot with chroot /mnt/sysroot after confirming the mounts. Use the installed release again. uname -r still reports the kernel started from rescue media.

    For the first test, choose the repaired entry manually from the VM console. After boot, verify uname -r, the root mount, and the application’s health. Keep the previously working entry until the repaired kernel has passed a controlled reboot. If GRUB reports a missing kernel file before the kernel starts, go back to the boot entry and filesystem. Bootloader repair is a different job from rebuilding initramfs.

    References