In this article we are going to cover How to Fix Kernel Panic Error in RHEL 7/8.
See the details of Kernel Panic Error (Identify the reason behind it eg. New Kernel, Corrupted initramfs, New Packages after Patching, Hardware change etc.)
cd /boot
ls -lrt

uname -r
pwd
rm -rf initramfs-4.18.0-240.el8.x86_64.img

Reboot the machine

Login the system with root credentials through rescue mode.

Take necesarry action as the reason of getting this error. If it is due to new kernel, then downgrade it. If it is due to corrupted or missing initramfs, regenerate it

Login the system with root credentials through rescue mode.

Take necesarry action as the reason of getting this error. If it is due to new kernel, then downgrade it. If it is due to corrupted or missing initramfs, regenerate it
In our case it is due to corrupted/absent initramfs file. First check your kernel version.
uname -r
Now regenerate initramfs with dracut or mkinitrd command: (here your kernel version should be same as in previous command result)
To create new initramfs use:
dracut initramfs-3.10.0-1062.el7.x86_64.img 3.10.0-1062.el7.x86_64
OR
mkinitrd initramfs-4.18.0-240.el8.x86_64.img 4.18.0-240.el8.x86_64

To replace exsiting initramfs file use:
dracut -f initramfs-3.10.0-1062.el7.x86_64.img 3.10.0-1062.el7.x86_64
OR
mkinitrd --force initramfs-4.18.0-240.el8.x86_64.img 4.18.0-240.el8.x86_64

Finally reboot the machine and check
Conclusion:
In this article we have covered How to Fix Kernel Panic Error in RHEL 7/8.
Related Articles:
Reference: