dkms
Manage dynamically built kernel modules
TLDR
List currently installed modules
Rebuild all modules for the currently running kernel
Install version 1.2.1 of the acpi_call module for the currently running kernel
Remove version 1.2.1 of the acpi_call module from all kernels
SYNOPSIS
dkms <command> [<options>] [<module/version>]
PARAMETERS
add <module/version>
Registers a module's source tree with dkms. This requires the module's source to be located in /usr/src/<module>-<version>.
build <module/version>
Compiles the module for the currently running kernel or a specified kernel version. The module must first be registered with dkms add.
install <module/version>
Installs a previously built module into the kernel module directory. This command implicitly calls dkms build if the module hasn't been built yet.
remove <module/version> [--all]
Removes a module's source tree and all its built/installed modules from dkms management across all kernel versions, or for a specific kernel if '--all' is omitted.
uninstall <module/version>
Uninstalls a specific built module from a specified kernel version, but keeps the source tree registered with dkms.
status
Displays the current status of all modules managed by dkms, including their versions, built status, and installation status for various kernels.
autoinstall
Attempts to build and install all registered modules for the currently running kernel. Often triggered automatically during kernel package installation/upgrade.
mktarball <module/version>
Creates a tarball of the module's source, build, and installation information, which can be used to re-add the module on another system.
DESCRIPTION
The dkms (Dynamic Kernel Module Support) framework provides a method for installing out-of-tree kernel modules in a way that automatically rebuilds them against new kernel versions. This is crucial for drivers (e.g., proprietary graphics drivers, virtual machine guest additions, custom hardware drivers) that are not part of the main kernel source tree and are thus tied to a specific kernel's Application Binary Interface (ABI).
Without dkms, installing a new kernel often necessitates manually rebuilding and reinstalling such modules, which can be a tedious and error-prone process. dkms automates this by keeping track of the module source code. When a new kernel is installed, dkms attempts to compile and install these modules for the new kernel version, ensuring continued functionality without manual intervention. It offers a standardized and convenient way to manage driver source trees and their compilation for multiple kernel versions.
CAVEATS
dkms relies on the availability of the module's source code and the necessary development tools (e.g., gcc, make, kernel headers) for compilation. Compatibility issues can arise if the module source code is not compatible with the new kernel's API/ABI, potentially leading to compilation failures. It's not a magic bullet for all driver issues, but a robust automation framework.
MODULE SOURCE LOCATION
For dkms to manage a module, its source code must typically reside in /usr/src/<module_name>-<module_version>/. The dkms.conf file within this directory provides configuration instructions for dkms.
AUTOMATIC INTEGRATION
Many package managers and driver installers (e.g., for NVIDIA graphics drivers or VirtualBox Guest Additions) automatically integrate with dkms. When you install such packages, they often include dkms configuration to ensure the driver remains functional after kernel upgrades.
HISTORY
dkms was originally developed by Dell Inc. around 2002 to simplify the management of third-party drivers on their Linux-based systems. It aimed to address the common problem of proprietary drivers breaking with kernel updates, which was a significant support burden. Its utility quickly led to widespread adoption across various Linux distributions, becoming a de facto standard for managing out-of-tree kernel modules.