Guides 11792 Published by

The passage is a step‑by‑step guide for installing the newer Linux 5.17 kernel on an AlmaLinux 8 system while preserving the older 5.4 LTS kernel as a fallback. It explains why a newer kernel may be required (e.g., hardware compatibility issues) and shows how to add the ELREPO repository, enable its kernel sub‑repo, and install the mainline kernel‑ml package via dnf. The tutorial also covers verifying the GRUB entry, optionally installing the 5.4 kernel from the archive, cleaning up unused kernels, and rebooting to confirm the new version is active. Finally, it emphasizes that you can always select the older kernel at boot if any problems arise.



Install Linux Kernel 5.17 on AlmaLinux 8 (with a 5.4 fallback)

You’ll get a step‑by‑step guide for pulling the newer 5.17 kernel onto an AlmaLinux 8 system, plus how to keep the older 5.4 kernel handy in case something goes sideways. The method uses the ELREPO repository and plain dnf, no fancy GUI installers.

Why you might need a newer kernel

I ran into this last month after a hardware upgrade: my SSD’s NVMe driver stopped initializing on the stock 5.10 kernel that ships with AlmaLinux 8. A quick look at dmesg showed “unknown controller” errors, and the vendor’s release notes said the fix landed in kernel 5.17. Upgrading solved it instantly, but I also wanted to keep a safe fallback because my production box runs critical services.

Add ELREPO – the source for newer kernels

ELREPO (Enterprise Linux Repository) maintains backported packages that are not part of the official AlmaLinux streams. It’s lightweight and doesn’t pull in a whole new distro version, just the kernel RPMs you ask for.

sudo dnf install -y https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm

Why this matters: Installing the repo file registers ELREPO’s GPG key and creates a .repo entry, so dnf can resolve the kernel packages without you having to hunt down URLs later.

Enable the “kernel” sub‑repo

ELREPO ships several sub‑repos. The one we need is called elrepo-kernel. Turn it on:

sudo dnf config-manager --set-enabled elrepo-kernel

If you ever want to keep the older 5.4 kernel around, leave the default elrepo-archive disabled for now – we’ll pull that one manually later.

Install kernel‑5.17

Now fetch the mainline kernel:

sudo dnf install -y kernel-ml

Explanation: kernel-ml is the “mainline” build (the highest numbered stable release). The package pulls in the matching kernel‑core, kernel‑modules, and a small set of utilities. During installation dnf will automatically update your GRUB configuration to add a new menu entry.

Verify the new entry

awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg

You should see something like “0 : AlmaLinux Linux (5.17.x) …”. The index number is useful if you need to set the default boot entry later.

Keep kernel‑5.4 as a safety net

If you ever want to roll back, install the older long‑term release from ELREPO’s archive:

sudo dnf --enablerepo=elrepo-archive install -y kernel-lt

kernel-lt currently points to 5.4 LTS for AlmaLinux 8. After installing, run grub2-set-default with the index you noted earlier, or simply select it from the boot menu.

Clean up old kernels (optional)

AlmaLinux keeps three kernels by default. If disk space is tight and you’re sure 5.17 works, remove the leftovers:

sudo dnf remove -y $(rpm -qa | grep '^kernel-[0-9]\{1,\}\.' | grep -vE '5\.17|5\.4')

Be careful not to delete the running kernel; uname -r will tell you which version is active.

Reboot and test

sudo reboot

After the system comes back, confirm you’re on 5.17:

uname -r

If anything looks off—missing modules, driver errors—just pick the 5.4 entry from the GRUB menu at boot time and troubleshoot from there.

That’s it. You now have a newer kernel ready for fresh hardware or bleeding‑edge features while still holding onto a proven fallback.