Mastering akmods on Fedora: Say Goodbye to Driver Breakage After Kernel Updates

Fedora tutorial - IT technology blog
Fedora tutorial - IT technology blog

Broken Drivers After Kernel Updates: A Universal Headache

I’ve been using Fedora as my primary workstation for over two years. Everything works great until I run sudo dnf update. After a reboot, my Nvidia card suddenly “goes on strike,” the screen gets stuck at 800×600 resolution, or VirtualBox reports a critical missing module error.

The issue lies in Fedora’s update frequency. This distro pushes new kernels very quickly, often just days after a stable release. When the kernel changes, out-of-tree drivers like Nvidia, Broadcom Wi-Fi, or VirtualBox—which were built for the older version—become incompatible. If they aren’t recompiled, they stop working immediately.

To handle this nuisance, we have two options: DKMS and akmods. In this article, I’ll guide you through using akmods—the solution considered the “permanent engineer” of the Fedora ecosystem.

Why Do Drivers Break After an Update?

The Linux kernel manages communication between hardware and software. Drivers that aren’t part of the kernel’s source code are compiled into .ko (Kernel Object) files.

These files are tied to a specific kernel version via the Kernel ABI (Application Binary Interface). For example, when you upgrade from Kernel 6.7 to 6.8, the ABI structure changes. Kernel 6.8 will refuse to load old .ko files to prevent system crashes. This is the moment your driver officially breaks.

AKMODS vs DKMS: What’s the Difference?

Both tools automatically recompile modules, but their operating philosophies are quite different.

1. DKMS (Dynamic Kernel Module Support)

Popular on Ubuntu/Debian, DKMS compiles driver source code directly and pushes the .ko file into system directories. However, because it doesn’t go through the DNF package manager, it sometimes leaves behind junk files or causes conflicts when you want to uninstall it completely.

2. AKMODS (Akmod Management System)

This is a specialty of Fedora and RPM Fusion. Instead of just copying files, akmods follows a more formal process: it takes the source code, packages it into a complete RPM file, and then installs it via DNF. This approach ensures drivers are managed like official software, making them clean and easy to roll back.

How to Install and Configure akmods

For akmods to work, your system needs the compilation toolset and kernel header files. This process is relatively fast and rarely encounters errors.

Step 1: Install Base Tools

Open your terminal and paste the following command to install akmods along with its dependencies:

sudo dnf install akmods kernel-devel kernel-headers gcc make elfutils-libelf-devel

Pro tip: The kernel-devel package must exactly match the kernel version you are currently running. If you just updated but haven’t rebooted yet, restart your computer before running this command.

Step 2: Enable the Service

Ensure the akmods service is always ready with this command:

sudo systemctl enable --now akmods

Hands-on: Installing Nvidia Drivers with akmod

Instead of downloading .run files from the Nvidia website (which often breaks the system during updates), you should use akmod from the RPM Fusion repository. After enabling the Non-free repo, run:

sudo dnf install akmod-nvidia

At this point, akmods will silently compile the kmod-nvidia package in the background. On a mid-range CPU like a Ryzen 5, this takes about 2-4 minutes. You’ll see CPU load spike briefly, which is a good sign that the driver is being prepared.

Troubleshooting: When akmods Fails to Run Automatically

If your power goes out mid-process or your disk becomes full, akmods might not finish building the module. Don’t worry, you can force the system to do it manually.

Force Recompile All Modules

This command scans all akmod packages and rebuilds any missing ones for the current kernel:

sudo akmods --force

Check Error Logs

If the above command fails, look for the cause in the log directory:

ls /var/cache/akmods/

Each build attempt has its own .log file. Usually, the most common errors are due to missing libraries or an outdated driver version that doesn’t yet support a brand-new kernel.

3 “Golden” Rules for a Stable System

My personal tips to avoid having to fix drivers on a Monday morning:

  1. Clean up disk space: The build process needs about 1GB of free space in /var. If your disk is nearly full, akmods will definitely fail.
  2. Be patient after updates: Don’t rush to click Restart as soon as DNF finishes. Wait about a minute to allow akmods to start the RPM packaging process in the background.
  3. Utilize the GRUB menu: Fedora always keeps the last 3 kernel versions. If the newest one fails, stay calm and select an older version to get back to work, then wait a few days for the community to update the driver code.

Conclusion

Akmods is more than just a tool; it’s a professional approach to Linux management. If you’re using Nvidia or VirtualBox on Fedora, switch to akmod today. It allows you to enjoy the latest kernel technologies without worrying about your drivers breaking unexpectedly.

Share: