Fact-checked by Grok 2 weeks ago

Dynamic Kernel Module Support

Dynamic Kernel Module Support () is a for managing and dynamically building modules from source code located outside the main source tree, enabling their compilation and installation for specific kernel versions without requiring a full kernel rebuild. Developed primarily to address the challenges of updating individual drivers in bundled distributions, DKMS automates the process of rebuilding external modules—such as those from hardware vendors—whenever the kernel is upgraded, ensuring compatibility and reducing manual intervention. Originating from the Linux Engineering Team at , DKMS was created in the early 2000s to streamline driver distribution and maintenance for enterprise customers, evolving from efforts presented at the Ottawa Linux Symposium in 2003 and formalized in a 2004 paper by Dell engineers Matt Domsch and Gary Lerhaupt. The framework maintains a separate , typically under /usr/src/, where module sources and a configuration file (dkms.conf) are stored, allowing commands like dkms add, build, and install to handle version tracking, compilation, and deployment across multiple kernels. This approach supports backporting features from upstream kernels and facilitates integration with package managers, such as generating RPMs or DEBs for distribution-specific installations. Key features of DKMS include support for multiple module versions simultaneously, automatic rebuilding hooks during kernel updates in compatible distributions, and compatibility with Secure Boot through module signing and Machine Owner Key (MOK) enrollment. It also enables binary-only installations for scenarios without compilers or sources, using options like --force, and provides utilities for creating driver disks or tarballs for easy portability across systems. While primarily used for third-party drivers like those for storage controllers or wireless hardware, DKMS has become a standard tool in major distributions, enhancing system stability by decoupling module updates from core changes.

Overview

Definition and Purpose

Dynamic Kernel Module Support (DKMS) is a framework that enables the generation and management of modules from stored in the local filesystem, separate from the main source tree. This approach allows modules to be built dynamically for specific kernel versions without requiring integration into the core kernel distribution. The primary purpose of is to facilitate the automatic rebuilding and installation of third-party or out-of-tree modules whenever the underlying is updated, thereby preserving compatibility and reducing the need for manual recompilation. By handling these processes transparently, DKMS minimizes disruptions in system functionality, particularly for hardware-dependent modules that might otherwise break due to changes. This automation is especially valuable for maintaining stable operations in environments with frequent upgrades. DKMS originated from efforts by Dell Linux Engineering to address distribution challenges for modules supporting proprietary hardware, such as server components, ensuring these modules remain functional across upgrades without extensive customer intervention. For instance, proprietary drivers like those for graphics cards leverage to automatically recompile and reinstall upon updates, avoiding compatibility issues in dynamic setups.

Key Features

One of the primary features of Dynamic Kernel Module Support () is its automatic rebuilding capability, which integrates with update processes to detect new versions and trigger the recompilation of registered modules. This ensures that third-party modules remain compatible without manual intervention, using the kernel's build system to automate the process in dedicated subdirectories for each version. DKMS excels in version management by maintaining support for multiple versions simultaneously, storing compiled modules in version-specific such as /var/lib/[dkms](/page/DKMS)/<module>/<module-version>/ to organize , builds, and binaries efficiently. Central to this is the dkms.conf configuration file, placed in the module , which specifies essential details like the module location, build parameters (e.g., via MAKE and CLEAN directives), and package information to guide automated handling. DKMS offers cross-distribution compatibility, functioning seamlessly on major distributions including , , and through standardized installation mechanisms and distro-specific adaptations. Additionally, it includes support for module signing, generating self-signed certificates by default (stored in /var/lib/dkms) to comply with kernels enforcing module signing policies, such as those with Secure Boot enabled, and allowing custom certificates for enhanced security.

History

Origins and Development

Dynamic Kernel Module Support (DKMS) originated in the early as a solution developed by engineers in Dell's Engineering Team to address challenges in managing modules for -based servers in environments. The primary motivation was to enable the distribution and automatic rebuilding of modules—particularly drivers—independently of updates, preventing breakage when users upgraded their operating system without rebuilding the entire source tree. This was crucial for Dell's , as frequent updates often rendered vendor-specific modules incompatible, complicating maintenance for system administrators and vendors. The project was led by Gary Lerhaupt and Matt Domsch, software engineers at , who initiated development around 2003 to streamline driver fixes and backporting from upstream kernel sources to stable releases. Lerhaupt, with a background in , collaborated on the framework to reduce the complexity of module installation and testing, benefiting both Dell's internal tools and the broader community. Early iterations focused on creating a duplicate module tree outside the kernel source, allowing modules to be rebuilt dynamically upon kernel changes. DKMS saw its first public release in 2003, with initial deployment within Dell's support ecosystem before wider availability through open-source channels. It was integrated into Dell's driver distribution packages, such as those for and , to facilitate controlled updates without disrupting certified configurations. The framework's inception was further highlighted at the Linux Symposium in 2004, where Domsch and Lerhaupt presented on its practical implementation, drawing from post-2003 user feedback to refine features like precompiled module support. Early contributions from the open-source community began emerging around this time, enhancing its utility beyond Dell's proprietary needs.

Evolution and Adoption

Dynamic Kernel Module Support (DKMS) achieved its first major milestone with inclusion in the repositories in the mid-2000s, enabling users of this popular distribution to automatically rebuild out-of-tree kernel modules during kernel upgrades. This early adoption facilitated broader integration into ecosystems, addressing the challenges of maintaining third-party modules amid frequent kernel updates. By the late 2000s, DKMS expanded to other key distributions: it was discussed for incorporation into around 2007, becoming a tool for managing out-of-tree modules, while followed suit after community discussions in 2008, packaging it for dynamic module building across kernels. Version 2.0 was released around , introducing enhanced configuration capabilities and improved error handling to streamline module management and reduce build failures. Maintained under the GNU General Public License version 2 (GPL-2.0), the project has benefited from ongoing community contributions, including patches for compatibility with evolving kernel architectures; these efforts ensured support for series 5.x and beyond starting in the 2020s, allowing seamless operation on contemporary systems. DKMS's adoption extends to hardware vendors, who leverage it for reliable driver distribution. utilizes DKMS in its Linux driver packages to automate recompilation for new kernels, ensuring consistent graphics performance across updates, while employs it for the wl kernel modules in distributions like , where the broadcom-sta-dkms package handles wireless driver builds. In , DKMS is a standard component in the official repositories and powers numerous packages in the Arch User Repository (AUR), such as zfs-dkms and various wireless drivers, making it a go-to framework for custom module integration. As of 2025, continues to be actively maintained by the community, with recent releases like version 3.2.2 (September 2025) incorporating features for Secure Boot compatibility, including automated module signing via Machine Owner Keys () to allow loading on systems without compromising security. This evolution underscores 's enduring role in simplifying kernel module lifecycle management amid advancing security standards.

Architecture

Core Components

The core components of Dynamic Kernel Module Support (DKMS) form a structured framework for managing sources and builds outside the main . Central to this is the directory layout, which separates from compiled artifacts. sources are stored in /usr/src/<module>-<version>/, where <module> is the package name and <version> is the module version, containing the dkms.conf file and source files. Compiled objects, configurations, and build logs reside in /var/lib/dkms/<module>/<version>/<kernel-version>/, enabling per-kernel versioning of binaries while preserving originals in subdirectories like original_module for . As of DKMS 3.0 (2023 onward), certain legacy features like CLEAN and mkdeb have been deprecated or removed. The dkms.conf configuration file, placed in the source directory root, defines build parameters using shell-like variable assignments in all uppercase. Required fields include PACKAGE_NAME (e.g., PACKAGE_NAME="megaraid2") and PACKAGE_VERSION (e.g., PACKAGE_VERSION="2.10.3"), which identify the . Build instructions are specified via MAKE[#] arrays for commands like MAKE[0]="make -C ${kernel_source_dir} SUBDIRS=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build modules", while the CLEAN directive is deprecated; for compatibility, it can be set to "true" to suppress warnings. Optional hooks such as POST_BUILD execute scripts after (e.g., POST_BUILD="post-build-script.sh"), and BUILT_MODULE_NAME[#] and DEST_MODULE_LOCATION[#] arrays map output modules to installation paths like /kernel/drivers/[scsi](/page/SCSI). For autoloading, MODULES_CONF[#] generates snippets for /etc/modprobe.d/ or legacy /etc/modprobe.conf, such as MODULES_CONF[0]="alias char-major-116 snd" to associate devices with modules. DKMS relies on kernel headers installed in /lib/modules/$kernel_version/build for compilation, along with standard tools including make for building and gcc for cross-compilation if needed. These dependencies ensure modules are compiled against the target kernel's ABI without modifying the kernel source. Integration with package managers occurs through hooks that automate module handling during kernel updates. In Debian-based systems, the dh_dkms debhelper tool embeds DKMS commands into package postinst and postrm scripts, triggering builds and installations when kernel packages are added or removed. This setup ensures seamless rebuilding for new kernels without manual intervention.

Build and Management Process

The build process for Dynamic Support (DKMS) begins with registering the source using the dkms add command, which places the source code in the standard directory /usr/src/<[module](/page/Module)>-<version>/ and requires a dkms.conf configuration file to define build parameters such as the make command and clean steps. Once added, the dkms build command compiles the for a specific version and , typically the running if unspecified, generating object files in /var/lib/dkms/<[module](/page/Module)>/<version>/<kernel-version>/build/. The process concludes with dkms install, which loads the compiled into the 's directory (e.g., /lib/[modules](/page/Module)/<kernel-version>/) and updates the dependencies via depmod. Management of DKMS modules involves several commands to monitor and maintain their state across versions. The dkms status command lists all registered modules, indicating whether they are added, built, or installed for each version. For removal, dkms remove uninstalls the module from a specific version and optionally cleans the build artifacts, with the --all flag targeting all instances of a module-version pair. DKMS addresses kernel Application Binary Interface (ABI) changes by rebuilding modules only when compatibility issues arise, leveraging kernel version tags to track and associate builds with specific kernel releases, thus avoiding unnecessary recompilations for unchanged ABIs. This selective rebuilding ensures modules remain functional without manual intervention in most cases. The full lifecycle of a DKMS module starts with source addition via dkms add and proceeds through building and installation, after which the system monitors kernel updates. Automatic triggers during kernel upgrades are handled by distro-specific mechanisms, such as the dkms.service in systemd-based systems, when AUTOINSTALL="yes" is set in dkms.conf, which detect new kernel installations and invoke dkms install to rebuild and load affected modules. For instance, when updating from Linux kernel 6.1 to 6.5, DKMS would automatically rebuild a VirtualBox guest module if its ABI compatibility is broken, ensuring seamless operation post-upgrade without user action.

Usage

Installation

Dynamic Kernel Module Support (DKMS) is typically installed via the package manager of the target Linux distribution, ensuring compatibility with the system's kernel and build environment. On Debian-based systems such as Ubuntu, users can install it using sudo apt install dkms, which pulls in necessary dependencies including kernel headers and build tools. For Fedora, the command is sudo dnf install dkms. For Red Hat Enterprise Linux and its derivatives, the command is sudo dnf install dkms (or sudo yum install dkms on older versions), which requires enabling the EPEL repository. On Arch Linux, installation is achieved with sudo pacman -S dkms, alongside the corresponding kernel headers package like linux-headers. Before installation, ensure prerequisites are met to avoid build failures: kernel headers matching the running (e.g., linux-headers-$(uname -r) on / or kernel-devel-$(uname -r) on ) and build essentials such as and Make, which are usually installed automatically but may require explicit addition via sudo apt install build-essential on -based systems. The binary is commonly located at /usr/sbin/dkms post-installation. After installation, verify the setup by running dkms --version, which should display the installed version, confirming operational status. For initial configuration to enable automatic module rebuilds upon kernel updates, edit /etc/dkms/framework.conf to adjust settings like MAKE="make" or enable hooks if not already distro-configured; most distributions integrate hooks into their update processes for seamless operation. A common issue during or after installation is errors related to missing kernel headers, often manifesting as "No kernel headers found for this kernel" when attempting to build modules. To resolve this, install the appropriate headers package for the current version, such as sudo apt install linux-headers-$(uname -r) on , then retry the operation. This ensures can compile modules against the system's kernel without interruption.

Module Operations

To add a module to the framework, users execute the dkms add command, which registers the 's source directory—containing a required dkms.conf —with the DKMS tree. The source code must reside in /usr/src/<module>-<version>/, and the command syntax is dkms add <module>/<version> or equivalently dkms add -m <module> -v <version>. This step prepares the module for automated handling across updates without modifying the core source. Building the module involves the dkms build command, which compiles the source code for a specific and . The syntax is dkms build <module>/<version> -k <kernel-version>, where the -k option specifies the target (defaulting to the running if omitted); the build occurs in /var/lib/dkms/<module>/<version>/build/. Following a successful build, installation is performed via dkms install <module>/<version> -k <kernel-version>, which places the compiled module files into the appropriate module directory, such as /lib/modules/<kernel-version>/. If the module is not yet added or built, the install command will attempt those steps automatically. DKMS also supports tarball sources for streamlined vendor distributions, allowing modules to be packaged as compressed archives containing the source, dkms.conf, and optionally pre-built binaries. Tarballs are loaded using dkms ldtarball /path/to/tarball.tar [--force], which extracts and adds the contents to the DKMS tree while preserving any built state; subsequent installation with dkms install completes the process. Three tarball types are supported: source-only with dkms.conf (type 1), source plus binaries (type 2), and binaries-only (type 3, useful on systems lacking compilers). For maintenance, the dkms status command provides an overview of all managed modules, displaying their versions, build status, and installation state across kernels (e.g., "added," "built," or "installed"). To remove a module, dkms remove <module>/<version> --all uninstalls it from all kernels and cleans up associated files, optionally targeting specific kernels with -k <kernel-version>. DKMS inherently manages multiple kernels by tracking and rebuilding modules per kernel version during updates, ensuring compatibility without manual intervention for each one. A representative example is NDISwrapper, a module that enables to use Windows NDIS network drivers. To integrate it with , first add the source: dkms add ndiswrapper/<version>. Then build: dkms build ndiswrapper/<version> -k <kernel-version>, followed by installation: dkms install ndiswrapper/<version> -k <kernel-version>. This setup automatically recompiles NDISwrapper for new kernels, maintaining wireless driver functionality.

Benefits and Challenges

Advantages

Dynamic Kernel Module Support (DKMS) simplifies the maintenance of external modules by automating their recompilation whenever a new version is installed, thereby minimizing administrative overhead and reducing system downtime associated with manual rebuilds. This automation ensures that modules remain compatible with updates without requiring users to track and manually intervene in the process, which is particularly beneficial in environments with frequent upgrades. DKMS promotes vendor independence by enabling the distribution of modules in source form, independent of specific releases or modifications to the core source tree. This approach allows hardware vendors and third-party developers to provide updates and fixes without being constrained by the kernel development cycle, facilitating broader compatibility across diverse distributions. In enterprise setups, DKMS enhances reliability by streamlining the delivery of hardware drivers for servers, as originally developed by to support their Linux customers without necessitating full kernel replacements. For instance, utilized DKMS to distribute updated drivers for server hardware on distributions like and , ensuring seamless integration and reducing support issues during kernel updates. DKMS offers flexibility through support for custom build scripts defined in its configuration files, allowing developers to incorporate specialized compilation steps tailored to particular modules. Additionally, it integrates seamlessly with packaging systems such as RPM and DEB, enabling the creation of distributable packages that handle module installation and rebuilding automatically during system updates. A practical example of DKMS's benefits is its application to proprietary Wi-Fi drivers, such as those from or , which often break after kernel updates; DKMS automatically rebuilds these modules using the latest kernel headers, restoring functionality without manual reconfiguration. A recent example illustrating these benefits is the filesystem, which transitioned to DKMS in 2025 after its removal from the mainline in version 6.18, allowing support for kernels 6.16 and later with faster independent updates.

Limitations

Dynamic Kernel Module Support (DKMS) introduces overhead in terms of compilation time and disk space usage, as it requires rebuilding modules from for each new kernel version installed on the system. This process involves tools such as a (e.g., ), a linker, and kernel headers, which can extend build durations significantly compared to precompiled modules, particularly on resource-constrained systems. Additionally, DKMS maintains a separate tree for module sources and binaries outside the kernel source tree, leading to increased disk space consumption for storing multiple versions across kernel updates. A key dependency of DKMS is the availability of matching kernel headers, which must correspond precisely to the running version; mismatches can result in build failures during module compilation. For instance, if the installed kernel headers package does not align with the active —common after upgrades or in custom setups—DKMS attempts to build s will fail, requiring manual intervention to install or update the correct headers. Compatibility challenges arise with very old kernels or non-standard builds, where DKMS may encounter ABI changes or unsupported configurations that prevent successful module rebuilding. Furthermore, potential conflicts occur with signed modules in environments enforcing Secure Boot or kernel lockdown, as DKMS-built modules often fail to load without proper signing, such as using Machine Owner Keys (MOK). Maintenance of DKMS imposes a burden on users, who must regularly update the dkms.conf configuration file to accommodate changes in module sources or kernel interfaces, ensuring proper build parameters and dependencies are specified. Failure to maintain this file can lead to incomplete or erroneous module installations across kernel versions. In containerized environments like , DKMS faces significant challenges due to limited access to the host and build tools, often resulting in failed module builds when attempting to compile within isolated containers.

References

  1. [1]
    [PDF] Dynamic Kernel Module Support: From Theory to Practice
    DKMS is a framework which allows individual kernel modules to be upgraded without chang- ing your whole kernel. Its primary audience.
  2. [2]
    dkms(8): Dynamic Kernel Module Support - Linux man page - Die.net
    dkms is a framework which allows kernel modules to be dynamically built for each kernel on your system in a simplified and organized fashion.
  3. [3]
    Exploring Dynamic Kernel Module Support (DKMS) - Linux Journal
    Sep 1, 2003 · The DKMS framework is basically a duplicate tree outside of the kernel tree that holds module source and compiled module binaries.
  4. [4]
    Understanding the Functionality of DKMS and Its Practical Usage
    May 4, 2024 · Learn how the Dynamic Kernel Module Support (DKMS) system works and check out a few examples of its features.
  5. [5]
    dkms-project/dkms: Dynamic Kernel Module System - GitHub
    This intention of this README is to explain how DKMS can be used in conjunction with tarballs which contain a dkms.conf file within them.
  6. [6]
    None
    ### Summary of DKMS
  7. [7]
    Pros and Cons of Using DKMS - Apriorit
    Jan 31, 2019 · Dynamic Kernel Module Support (DKMS) is a framework developed by Dell to automatically distribute kernel module updates to its customers. It ...
  8. [8]
    Chapter 4. Installing the NVIDIA Driver
    On most systems with DKMS, DKMS will take care of automatically rebuilding registered kernel modules when installing a different Linux kernel. If nvidia- ...
  9. [9]
    DKMS - Community Help Wiki
    Mar 18, 2012 · This DKMS (Dynamic Kernel Module Support) package (http://linux.dell.com/dkms/) provides support for installing supplementary versions of kernel modules.Missing: definition | Show results with:definition<|control11|><|separator|>
  10. [10]
    Re: RFC: DKMS - Dynamic Kernel Module Support
    Sep 11, 2008 · Re: RFC: DKMS - Dynamic Kernel Module Support. From: Mario Limonciello <mario_limonciello@dell.com>. Re: RFC: DKMS - Dynamic Kernel Module ...Missing: origin | Show results with:origin
  11. [11]
    Kernel/DkmsDriverPackage - Community Help Wiki
    Aug 13, 2008 · This guide is intended to help developers and packagers understand how DKMS can help them quickly and easily prepare source packages.Missing: key features
  12. [12]
    Debian -- Details of package broadcom-sta-dkms in sid
    This package provides the source code for the wl kernel modules and makes use of the DKMS build utility to install them for the running kernel.
  13. [13]
    dkms 3.2.2-1 (any) - Arch Linux
    Arch Linux · Home · Packages · Forums · Wiki · GitLab · Security · AUR · Download. dkms 3.2.2-1. Package Actions. Source Files / View Changes · Bug Reports / ...
  14. [14]
    SecureBoot - Debian Wiki
    Sep 7, 2025 · Debian packages that provide kernel modules will typically sign the modules automatically using DKMS, but if you want to sign a kernel module ...
  15. [15]
    dkms(8) — dkms — Debian unstable - Debian Manpages
    Sep 16, 2025 · dkms is a framework which allows kernel modules to be dynamically built for each kernel on your system in a simplified and organized fashion.Missing: inclusion | Show results with:inclusion
  16. [16]
    dh_dkms(1) — dh-dkms — Debian unstable — Debian Manpages
    ### Summary of dh_dkms Integration with Debian Package Managers
  17. [17]
  18. [18]
    Dynamic Kernel Module Support - ArchWiki
    Oct 18, 2025 · From Wikipedia: Dynamic Kernel Module Support (DKMS) is a program/framework that enables generating Linux kernel modules whose sources ...
  19. [19]
    DKMS - Gentoo Wiki
    DKMS (Dynamic Kernel Module System) is a distribution agnostic framework for managing out-of-tree kernel modules.Missing: milestones adoption<|control11|><|separator|>
  20. [20]
    NDISWrapper
    Nov 21, 2010 · This project implements Windows kernel API and NDIS (Network Driver Interface Specification) API within Linux kernel.
  21. [21]
    DKMS: Dell Improves Driver Installation » Linux Magazine
    ### Summary of Dell's Use of DKMS for Server Hardware Drivers and Reliability in Enterprise Setups
  22. [22]
    dkms(8) - Debian Manpages
    Provides a location to place modules when a dkms install command is issued. Includes a legacy postinstall script so that a DEB or RPM built by DKMS can be used ...Missing: advantages integration
  23. [23]
    Can't build Virtualbox-dkms - mismatched kernel and headers
    Feb 25, 2015 · Install the virtualbox-dkms package and the appropriate headers, most likely linux-headers-generic. You will not be able to start VMs until this problem is ...Unable to build dkms module after Jammy 22.04 upgradeHow to point DKMS to kernel headers? - Ask UbuntuMore results from askubuntu.comMissing: limitations | Show results with:limitations
  24. [24]
    DKMS kernel headers not found - Fedora Discussion
    Apr 30, 2021 · Try uninstalling and re-installing DKMS linux and linux headers. I have had the header file corrupt with kernel updates or improper shutdowns.Missing: limitations mismatch
  25. [25]
    Kernel/Dev/DKMSPackaging - Ubuntu Wiki
    Dec 30, 2016 · dkms is a framework which allows kernel modules to be dynamically built for each kernel on your system in a simplified and organized fashion.Dkms. Conf · Dkms Commands · Generate Dkms DebMissing: inclusion date
  26. [26]
    When installing the driver from a container the dkms build fails #1183
    May 4, 2020 · Describe the bug. falco-driver-loader is able to install the driver from the host but the dkms build fails when it runs within a container.Missing: challenges | Show results with:challenges