How to go back to correct version of rocky linux 8.9 kernel?

Hi, i built a new server and installed rocky 8.9. My problem is that i am using a wrong version of kernel.

uname -a
Linux xxx 5.4.269-1.el8.elrepo.x86_64 #1 SMP Fri Feb 23 16:05:47 EST 2024 x86_64 x86_64 x86_64 GNU/Linux

while the correct kernel of 8.9 is something like

4.18.0-513.18.1.el8_9.x86_64

i receive this server Feb 28 2024 and installed rocky 8.9. Maybe the guy help me build my machine installed this kernel. Today when i finish install nvidia gpu driver however nvidia-smi fail to communicate with the NVIDIA driver. When i try to load driver using sudo modprobe nvidia it gives modprobe: FATAL: Module nvidia not found in directory /lib/modules/5.4.269-1.el8.elrepo.x86_64. And i found i am in a wrong kernel. Could anyone help me to get back to normal rocky linux 8.9 kernel? (i have /lib/modules/4.18.0-513.5.1.el8_9.x86_64, and the driver is installed there).

What kernel packages do you have?

dnf list installed kernel\*
1 Like

hi thank you for your reply. :slight_smile:
the result is:

kernel.x86_64                                                                                       4.18.0-513.5.1.el8_9                                                                             @anaconda     
kernel.x86_64                                                                                       4.18.0-513.18.1.el8_9                                                                            @baseos       
kernel-core.x86_64                                                                                  4.18.0-513.5.1.el8_9                                                                             @anaconda     
kernel-core.x86_64                                                                                  4.18.0-513.18.1.el8_9                                                                            @baseos       
kernel-devel.x86_64                                                                                 4.18.0-513.18.1.el8_9                                                                            @baseos       
kernel-headers.x86_64                                                                               4.18.0-513.18.1.el8_9                                                                            @baseos       
kernel-lt.x86_64                                                                                    5.4.269-1.el8.elrepo                                                                             @elrepo-kernel
kernel-lt-core.x86_64                                                                               5.4.269-1.el8.elrepo                                                                             @elrepo-kernel
kernel-lt-devel.x86_64                                                                              5.4.269-1.el8.elrepo                                                                             @elrepo-kernel
kernel-lt-modules.x86_64                                                                            5.4.269-1.el8.elrepo                                                                             @elrepo-kernel
kernel-modules.x86_64                                                                               4.18.0-513.5.1.el8_9                                                                             @anaconda     
kernel-modules.x86_64                                                                               4.18.0-513.18.1.el8_9                                                                            @baseos       
kernel-tools.x86_64                                                                                 4.18.0-513.18.1.el8_9                                                                            @baseos       
kernel-tools-libs.x86_64                                                                            4.18.0-513.18.1.el8_9                                                                            @baseos       

just for your reference:

rpm -q kernel

returns:

kernel-4.18.0-513.5.1.el8_9.x86_64
kernel-4.18.0-513.18.1.el8_9.x86_64

Apparently elrepo’s kernel-lt was installed on your system and it is the running kernel. To uninstall it, you’d need to boot into the distro kernel and then run:

# dnf erase kernel-lt
1 Like

Thank you both, it has been resolved. :slight_smile: