Tag Archives: Linux Virtual Machine

RHEL Linux 7.6, Kernel Panic, initramfs image not found

Issue: After rebooting the server, it stuck at kernel panic and failed to boot. There could be several reasons behind this. The error clearly showing that initramfs image could not be found. Which indicate that initramfs image file is either missing or corrupt and need to be rebuild. Initramfs is used to mount initial root file system during boot process, which in turn assist kernel to load the actual root file system on the harddisk.

screenshot-1.png

Plan of Action:

Now, with the motive to rebuild the initramfs, the quickest way to boot the server using old kernel installed on the server. But if there is no old version of kernel installed then we left with an option to boot the server using dvd/iso into the rescue mode.

The trick to resolve:

1. Boot the server with old kernel installed.

2. Take a backup of the initramfs file:

#cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).bak.$(date +%m-%d-%H%M%S).img

3. However, the basic command to Rebuild the initramfs for the current version is

#dracut -f -v

But in our case, as we have booted the server using the old kernel, we need to specify the kernel version including architecture.

#dracut -f /boot/initramfs-<kernel-verison>.img <kernel-version>

eg, dracut
-f
/boot/initramfs-3.10.0-957.21.3.el7.x86_64.img
3.10.0-957.21.3.el7.x86_64

4. Reboot the server with the latest kernel version and it should ideally bring the server back online.

Note: In case, there is no older version of kernel installed, we need to mount the iso/dvd and boot the server into rescue mode to rebuild the initramfs.