# How to fix update kernel for RHEL

## **Initial Troubleshooting Steps**

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

<figure><img src="https://content.gitbook.com/content/4csDFrNQz0Q4tDnx3xyT/blobs/sr3dlmDDaNkmA4XkBLlm/image.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://content.gitbook.com/content/4csDFrNQz0Q4tDnx3xyT/blobs/Z1DbWNPnToIu3i7H13Xt/image.png" alt=""><figcaption></figcaption></figure>

3. 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 
```

4. 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 >>&#x20;

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 >>&#x20;

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&#x20;

<pre><code><strong>- Reboot 
</strong>
# reboot 
</code></pre>

5. Check the installed Linux kernels.

```
# rpm -q kernel
```

<< Example >>&#x20;

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**.

<figure><img src="https://content.gitbook.com/content/4csDFrNQz0Q4tDnx3xyT/blobs/2aDgu0w7Eq04n66gqRs7/image.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://content.gitbook.com/content/4csDFrNQz0Q4tDnx3xyT/blobs/E91VWvoIt7B0qYdwgfOe/image.png" alt=""><figcaption></figcaption></figure>

3. 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 
```

4. Chroot into the instance's environment.

```
# chroot /mnt/data
```

5. 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 
```
