Rocky Linux keeps its stock kernel conservative for long-term stability, but that can leave newer hardware, regression testing, or upstream driver checks waiting on backports. You can install the ELRepo mainline kernel on Rocky Linux when you need that newer kernel behavior while keeping the stock Rocky kernel available as a GRUB fallback.
The ELRepo kernel-ml package tracks the mainline stable branch from kernel.org and installs beside the normal Rocky kernel instead of replacing it. ELRepo also publishes kernel-lt for Rocky Linux 8 and 9, but Rocky Linux 10 currently has only kernel-ml in the ELRepo kernel repository.
Use alternate kernels as targeted fixes or test kernels, not as a routine default for every server. ELRepo marks these kernels as as-is packages and notes that
kernel-mlandkernel-ltare not signed for Secure Boot, so confirm you can boot the stock kernel before relying on the ELRepo kernel.
Install Mainline Kernel on Rocky Linux
Compare Stock, kernel-ml, and kernel-lt Branches
The package name answers the main source question. kernel-ml means ELRepo’s mainline stable kernel, while kernel-lt means an ELRepo long-term support branch. The stock kernel remains the safest default unless the newer branch solves a specific hardware or testing problem.
| Kernel Branch | Source | Rocky 10 | Rocky 9 | Rocky 8 | Use When |
|---|---|---|---|---|---|
| Stock kernel | Rocky/RHEL kernel packages | 6.12.x series | 5.14.x series | 4.18.x series | Default choice for most systems. |
| kernel-ml | ELRepo mainline stable | Available | Available | Available | New hardware support, upstream regression checks, or features not yet backported. |
| kernel-lt | ELRepo long-term branch | Not available | Available | Available | A newer-than-stock kernel with a slower branch pace than mainline. |
Exact kernel builds change often. Current examples are Rocky Linux 10.1 with a stock 6.12.0-124 kernel, Rocky Linux 9.7 with 5.14.0-611, and Rocky Linux 8.10 with 4.18.0-553. ELRepo published kernel-ml 7.0.9 for all three releases, with kernel-lt 6.1.173 for Rocky 9 and 5.15.207 for Rocky 8.
Update Rocky Linux Before Adding ELRepo
Refresh the system first so the running kernel, installed packages, and repository metadata are current before the ELRepo kernel transaction.
sudo dnf upgrade --refresh
If DNF installs a stock Rocky kernel update, reboot before continuing. That keeps uname -r, installed kernel packages, and module-build packages aligned before you add a second kernel source.
sudo reboot
Add ELRepo on Rocky Linux 10
Rocky Linux 10 can reject the older ELRepo signing key if you import it directly with rpm --import. Import the ELRepo v2 key first, then install the ELRepo 10 release package through DNF so the repository package is signature-checked before it adds elrepo.repo.
sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-v2-elrepo.org
sudo dnf install https://www.elrepo.org/elrepo-release-10.el10.elrepo.noarch.rpm -y
The release package also installs /etc/pki/rpm-gpg/RPM-GPG-KEY-v2-elrepo.org, so later kernel-ml transactions use the same ELRepo v2 trust path.
Add ELRepo on Rocky Linux 9
Rocky Linux 9 can import the ELRepo release signing key before installing the release package.
sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo dnf install https://www.elrepo.org/elrepo-release-9.el9.elrepo.noarch.rpm -y
Add ELRepo on Rocky Linux 8
Rocky Linux 8 uses the ELRepo 8 release package and the same release signing key path as Rocky Linux 9.
sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo dnf install https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm -y
Verify ELRepo Kernel Packages
The ELRepo release package enables the base elrepo repository but leaves elrepo-kernel disabled. List the kernel repository directly so you know which branch packages are available for your Rocky release.
dnf list available --disablerepo='*' --enablerepo=elrepo-kernel 'kernel-ml' 'kernel-lt' 'kernel-ml-devel' 'kernel-ml-modules-extra' 'kernel-ml-tools' | grep -E '^kernel-(ml|lt)'
Rocky Linux 10 currently shows only the mainline branch:
kernel-ml.x86_64 7.0.9-1.el10.elrepo elrepo-kernel kernel-ml-devel.x86_64 7.0.9-1.el10.elrepo elrepo-kernel kernel-ml-modules-extra.x86_64 7.0.9-1.el10.elrepo elrepo-kernel kernel-ml-tools.x86_64 7.0.9-1.el10.elrepo elrepo-kernel
Rocky Linux 9 and 8 show both kernel-ml and kernel-lt. Rocky Linux 9 output looks similar to this:
kernel-lt.x86_64 6.1.173-1.el9.elrepo elrepo-kernel kernel-ml.x86_64 7.0.9-1.el9.elrepo elrepo-kernel kernel-ml-devel.x86_64 7.0.9-1.el9.elrepo elrepo-kernel kernel-ml-modules-extra.x86_64 7.0.9-1.el9.elrepo elrepo-kernel kernel-ml-tools.x86_64 7.0.9-1.el9.elrepo elrepo-kernel
Install kernel-ml Mainline Kernel
Install kernel-ml from elrepo-kernel. DNF adds the ELRepo kernel beside the stock Rocky kernel and creates a boot entry for it.
sudo dnf --enablerepo=elrepo-kernel install kernel-ml -y
The transaction installs the branch package plus the matching kernel-ml-core and kernel-ml-modules packages. Rocky Linux normally selects the newly installed kernel-ml entry as the default boot kernel, but you can confirm or change that setting after reboot.
Install kernel-ml-devel for Module Builds
Install kernel-ml-devel only when you build external modules such as DKMS drivers, VirtualBox modules, or proprietary GPU drivers. The package provides the matching build tree under /usr/src/kernels/<kernel-release>/. For the stock Rocky kernel package roles, see the related Rocky Linux kernel headers guide.
sudo dnf --enablerepo=elrepo-kernel install kernel-ml-devel -y
Do not install
kernel-ml-headersfor normal DKMS or driver build errors. ELRepo documentskernel-ml-develas the package needed when a build cannot find headers for the active ELRepo kernel. Thekernel-ml-headerspackage is only for rare userspace C library rebuild workflows.
If you need branch-specific tools or extra modules, install them separately so the optional package surface stays clear.
sudo dnf --enablerepo=elrepo-kernel install kernel-ml-modules-extra kernel-ml-tools -y
Optional: Install kernel-lt on Rocky Linux 8 or 9
Rocky Linux 8 and 9 can use kernel-lt instead of kernel-ml when you want an ELRepo long-term branch. Rocky Linux 10 does not currently publish kernel-lt.
sudo dnf --enablerepo=elrepo-kernel install kernel-lt -y
For external module builds on kernel-lt, install the matching development package instead of kernel-ml-devel.
sudo dnf --enablerepo=elrepo-kernel install kernel-lt-devel -y
Reboot and Verify the ELRepo Kernel
Kernel packages do not affect the running kernel until the next boot. Reboot after installing kernel-ml or kernel-lt.
sudo reboot
After reconnecting, check the active kernel release.
uname -r
A successful mainline boot includes elrepo in the kernel release. For example, Rocky Linux 10 with kernel-ml returned:
7.0.9-1.el10.elrepo.x86_64
If you installed kernel-ml-devel, verify the matching build tree for the running kernel.
test -d "/usr/src/kernels/$(uname -r)" && echo "kernel-ml-devel matches the running kernel"
kernel-ml-devel matches the running kernel
Set the Default Boot Kernel
Rocky Linux uses grubby to inspect and change boot entries. Start by checking the current default kernel path.
sudo grubby --default-kernel
/boot/vmlinuz-7.0.9-1.el10.elrepo.x86_64
List all bootable kernels when you need to choose between the ELRepo kernel and the stock Rocky kernel.
sudo grubby --info=ALL | grep -E '^(index|kernel|title)'
index=0 kernel="/boot/vmlinuz-7.0.9-1.el10.elrepo.x86_64" title="Rocky Linux (7.0.9-1.el10.elrepo.x86_64) 10.1 (Red Quartz)" index=1 kernel="/boot/vmlinuz-6.12.0-124.56.1.el10_1.x86_64" title="Rocky Linux (6.12.0-124.56.1.el10_1.x86_64) 10.1 (Red Quartz)"
To make the currently running kernel the default for future boots, set the default to its /boot/vmlinuz- path.
sudo grubby --set-default "/boot/vmlinuz-$(uname -r)"
You can also set a specific entry by index from the previous output.
sudo grubby --set-default-index=0
Update ELRepo Kernels
Normal Rocky Linux updates do not include elrepo-kernel because that repository is disabled by default. Temporarily enable it when you want to check for ELRepo kernel updates.
sudo dnf --enablerepo=elrepo-kernel upgrade
Reboot after any kernel update, then verify the active release with uname -r. Keep at least one known-working stock Rocky kernel installed so you can return to it from GRUB if a newer ELRepo build does not work with your hardware or modules.
Restore or Remove the ELRepo Kernel
Boot the Stock Rocky Kernel
If the ELRepo kernel causes a boot, driver, or module problem, choose the stock Rocky entry from GRUB. The stock entry does not contain elrepo in the kernel release.
uname -r
Rocky Linux stock kernels currently use the 6.12.x series on Rocky 10, 5.14.x on Rocky 9, and 4.18.x on Rocky 8.
Set the Stock Kernel as Default
After booting into the stock Rocky kernel, make the running stock kernel the default entry.
sudo grubby --set-default "/boot/vmlinuz-$(uname -r)"
Remove kernel-ml Packages
Do not remove an ELRepo kernel while you are running it. Confirm uname -r does not contain elrepo, then remove installed kernel-ml packages.
rpm -qa 'kernel-ml*' | xargs -r sudo dnf remove -y
If you installed kernel-lt instead, remove that branch with the matching package pattern.
rpm -qa 'kernel-lt*' | xargs -r sudo dnf remove -y
Disable or Remove ELRepo
If you want to keep ELRepo installed but stop using it, disable its repositories. Minimal installations may need dnf-plugins-core before config-manager is available.
sudo dnf install dnf-plugins-core -y
sudo dnf config-manager --set-disabled elrepo
sudo dnf config-manager --set-disabled elrepo-kernel
To remove the ELRepo release package and repository file completely, run:
sudo dnf remove elrepo-release
Verify that DNF no longer sees ELRepo repositories.
dnf repolist --all | grep elrepo || echo "ELRepo repositories are not configured"
ELRepo repositories are not configured
Repository package removal does not always remove imported RPM database keys. After removing ELRepo packages and repositories, list any remaining ELRepo keys:
rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE} %{SUMMARY}\n' | grep -i elrepo
gpg-pubkey-baadae52-49beffa4 elrepo.org (RPM Signing Key for elrepo.org) <secure@elrepo.org> public key gpg-pubkey-eaa31d4a-677ad425 elrepo.org (RPM Signing Key v2 for elrepo.org) <secure@elrepo.org> public key
Remove only the ELRepo key entries that exist on your system.
for key in gpg-pubkey-baadae52-49beffa4 gpg-pubkey-eaa31d4a-677ad425; do
rpm -q "$key" >/dev/null 2>&1 && sudo rpm -e "$key"
done
Troubleshoot ELRepo Kernel Installations
GPG Key Import Fails on Rocky Linux 10
Rocky Linux 10 can reject the older ELRepo key when imported directly:
sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
error: Certificate 309BC305BAADAE52: Policy rejects 309BC305BAADAE52: No binding signature error: https://www.elrepo.org/RPM-GPG-KEY-elrepo.org: key 1 import failed.
Use the ELRepo v2 key path for Rocky Linux 10 instead. The v2 key validates the current ELRepo 10 release package and avoids disabling package signature checks for the repository bootstrap.
sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-v2-elrepo.org
sudo dnf install https://www.elrepo.org/elrepo-release-10.el10.elrepo.noarch.rpm -y
ELRepo Kernel Fails to Boot
If the ELRepo kernel reaches a panic, black screen, missing-driver state, or other boot failure, reboot and choose a stock Rocky entry from GRUB. After the stock kernel is running, verify that uname -r no longer contains elrepo, then make the stock kernel the default.
uname -r
sudo grubby --set-default "/boot/vmlinuz-$(uname -r)"
System Boots the Stock Kernel Instead of kernel-ml
If the system still boots the stock kernel after installation, list the boot entries and set the ELRepo kernel as the default.
sudo grubby --info=ALL | grep -E '^(index|kernel|title)'
elrepo_kernel=$(sudo grubby --info=ALL | awk -F= '/^kernel=.*elrepo/ {gsub(/"/, "", $2); print $2; exit}')
if [ -n "$elrepo_kernel" ]; then
sudo grubby --set-default "$elrepo_kernel"
else
echo "No ELRepo kernel entry found"
fi
The variable selects the first boot entry whose kernel path contains elrepo. If the snippet reports no entry, reinstall kernel-ml or recheck the elrepo-kernel transaction before changing the boot default.
Secure Boot Blocks the ELRepo Kernel
ELRepo documents kernel-ml and kernel-lt as not signed for Secure Boot. If Secure Boot policy blocks the kernel, boot the stock Rocky kernel and use a signed stock kernel, a supported vendor module path, or a Secure Boot policy that your organization approves.
DKMS, NVIDIA, or VirtualBox Modules Fail
External modules must be built for the active kernel. Install the matching ELRepo development package first.
sudo dnf --enablerepo=elrepo-kernel install kernel-ml-devel -y
If you use DKMS, ensure DKMS is installed from a supported source such as EPEL on Rocky Linux, then rebuild installed DKMS modules.
sudo dkms autoinstall
For proprietary GPU workflows, verify that the driver source supports the ELRepo kernel branch. The NVIDIA drivers on Rocky Linux workflow covers Secure Boot, module builds, and driver verification for Rocky’s normal kernel stack.
ELRepo Kernel Repository Shows No Packages
If package listing returns no ELRepo kernels, confirm the repository package is installed and that elrepo-kernel exists. A disabled elrepo-kernel repository is normal; you enable it per transaction with --enablerepo=elrepo-kernel.
dnf repolist --all | grep elrepo
DNF config-manager Command Not Found
The No such command: config-manager error means the DNF plugin package is missing. Install it, then retry the repository enable or disable command.
sudo dnf install dnf-plugins-core -y
Conclusion
The ELRepo mainline kernel is installed beside Rocky Linux’s stock kernel, with GRUB available for fallback and DNF handling future branch updates through elrepo-kernel. Keep kernel-ml-devel aligned when building modules, and consider optimizing DNF on Rocky Linux if repeated kernel package downloads are slow.


Nice. A few issues:
1) using `–repo=elrepo-kernel` can be used as a shortcut for `–enablerepo=elrepo-kernel --disablerepo=”*”`
2) The steps leave elrepo-kernel disabled as it is never explicitly enabled. So subsequent `dnf upgrade` comands will reinstall the 5.14 kernel again. You probably want to add the step `dnf config-manager --set-enabled=elrepo-kernel` to leave it enabled.
3) The command to disable the kernel repo again uses “elrepo” and not “elrepo-kernel” as the reponame.
Thanks for the tips, will improve article to reflect your comments.