> For the complete documentation index, see [llms.txt](https://docs-epc.gitbook.io/ncs-documents/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-epc.gitbook.io/ncs-documents/compute/compute-instance/how-to-fix-update-kernel-for-rhel.md).

# How to fix update kernel for RHEL

1. เข้าหน้า portal ไปที่ instance ที่ต้องการ update kernel และทำการเข้า rescue mode

<figure><img src="/files/xFL8K9ebbcgUy9eM4KKk" alt=""><figcaption></figcaption></figure>

2. กด try ubuntu และรอ boot เข้า Linux

<figure><img src="/files/BoAA5UJY8dlpGcv8suNA" alt=""><figcaption></figcaption></figure>

3. Mount partition in Linux (use 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 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 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

## \*\*\* หากดำเนินการแก้ไขแต่ยังไม่สามารถ Boot ได้ ให้ดำเนินการตามขั้นตอนดังนี้

1. เข้าหน้า portal ไปที่ instance ที่ต้องการ update kernel และทำการเข้า rescue mode

<figure><img src="/files/LusxSRvIzFaZ68MZhnvd" alt=""><figcaption></figcaption></figure>

2. กด try ubuntu และรอ boot เข้า Linux

<figure><img src="/files/RKpSrxKvRiy6CDBAcqH6" alt=""><figcaption></figcaption></figure>

3. Mount partition in Linux (use 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

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

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs-epc.gitbook.io/ncs-documents/compute/compute-instance/how-to-fix-update-kernel-for-rhel.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
