How to fix update kernel for RHEL

If you encounter a Kernel Panic error on boot and are unable to log in, follow the steps below to resolve the issue.

Initial Troubleshooting Steps

  1. From the portal, navigate to the affected instance and enter Rescue Mode.

  1. Select "Try Ubuntu" and wait for the live Linux environment to boot.

  1. Mount the partition in Linux (using the Terminal).

# sudo -i 

# lsblk  

# mount /dev/sda3  /mnt/data 

# cd /mnt/data  

# mount --bind /proc  /mnt/data/proc  

# mount --bind /dev  /mnt/data/dev  

# mount --bind /sys  /mnt/data/sys 
  1. Fix the initramfs.

# chroot /mnt/data 

# cd /boot 

# ls -l 
- Make backup All .img file in /boot 

# cp /boot/initramfs-<kernelVersion>.img /boot/initramfs-<kernelVersion>.img.bak 

<< Example >>

cp /boot/initramfs-4.18.0-240.10.1.el8_3.x86_64.img /boot/initramfs-4.18.0-240.10.1.el8_3.x86_64.img.bak

- Build Initramfs All .img file in /boot

# dracut -f /boot/initramfs-<kernelVersion>.img  <kernelVersion> 

<< Example >>

dracut -f /boot/initramfs-4.18.0-240.10.1.el8_3.x86_64.img 4.18.0-240.10.1.el8_3.x86_64

- Reboot 

# reboot 
  1. Check the installed Linux kernels.

# rpm -q kernel

<< Example >>

kernel-4.18.0-240.10.1.el8_3.x86_64 kernel-4.18.0-240.22.1.el8_3.x86_64 kernel-4.18.0-305.12.1.el8_4.x86_64

If the Issue Persists

If you have completed the steps above and are still unable to boot, proceed as follows:

  1. From the portal, navigate to the affected instance and enter Rescue Mode.

  1. Select "Try Ubuntu" and wait for the live Linux environment to boot.

  1. Mount the partition in Linux (using the Terminal).

# sudo -i 

# lsblk  

# mount /dev/sda3  /mnt/data 

# cd /mnt/data  

# mount --bind /proc  /mnt/data/proc  

# mount --bind /dev  /mnt/data/dev  

# mount --bind /sys  /mnt/data/sys 
  1. Chroot into the instance's environment.

# chroot /mnt/data
  1. Remove the newest kernel version.

- RHEL 
# dnf list --installed kernel 
# dnf list --installed kernel-modules 
# dnf list --installed kernel-core 
 
- Remove Kernel version 
# dnf remove kernel-<Kernel-version> 
# dnf remove kernel-modules-<Kernel-version> 
# dnf remove kernel-core-<Kernel-version>

<< Example >>

dnf remove kernel-4.18.0-240.10.1.el8_3.x86_64 dnf remove kernel-modules-4.18.0-240.10.1.el8_3.x86_64 dnf remove kernel-core-4.18.0-240.10.1.el8_3.x86_64

- Reboot 

#reboot 

Last updated

Was this helpful?