LinuxCommandLibrary

dkms

Manage dynamically built kernel modules

TLDR

List currently installed modules

$ dkms status
copy

Rebuild all modules for the currently running kernel
$ dkms autoinstall
copy

Install version 1.2.1 of the acpi_call module for the currently running kernel
$ dkms install -m [acpi_call] -v [1.2.1]
copy

Remove version 1.2.1 of the acpi_call module from all kernels
$ dkms remove -m [acpi_call] -v [1.2.1] --all
copy

SYNOPSIS

dkms [options]

PARAMETERS

--help
    Display help message.

--version
    Display version information.

-m , --module
    Specify the module name.

-v , --version
    Specify the module version.

-k , --kernel
    Specify the kernel version. If omitted, defaults to the currently running kernel.

--config
    Specify an alternate configuration file.

--archive
    Specify an archive file for building modules.

build
    Build the module.

install
    Install the module.

uninstall
    Uninstall the module.

add
    Add the module source to the DKMS tree.

remove
    Remove the module from the DKMS tree.

status
    Show the status of the module in the DKMS tree.

autoinstall
    Automatically build and install modules for a kernel.

ltdk
    Used to check if module can be licensed under the GPL or a GPL-compatible license.

mktree
    Creates the DKMS module tree directory (/usr/src/-).

unmktree
    Remove the DKMS module tree directory (/usr/src/-).

DESCRIPTION

DKMS (Dynamic Kernel Module Support) is a program that enables you to build and install kernel modules automatically when a new kernel is installed or upgraded on your system. It allows external modules to be recompiled and installed without requiring manual intervention after kernel updates.

This is particularly useful for drivers and other kernel extensions that are not part of the mainline kernel. DKMS manages the source code of these modules and ensures they are compiled against the currently running kernel. It allows for easier management of kernel modules outside the kernel tree, automating the rebuilding process with new kernel installations. This system significantly reduces the effort needed to keep third-party kernel modules functional across kernel upgrades.

CAVEATS

DKMS requires a properly configured build environment, including kernel headers, to successfully build modules. Incorrectly configured modules or build processes can lead to kernel instability. Always test new DKMS configurations on a non-production system before deploying to production.

<B>CONFIGURATION FILES</B>

DKMS relies on a configuration file typically located in /usr/src/-/dkms.conf. This file specifies the module name, version, build command, install and uninstall commands, and other essential information required to build and install the module.

<B>MODULE BUILDING PROCESS</B>

When a new kernel is installed, DKMS checks for modules it manages. If a module is found, DKMS attempts to build the module against the new kernel's headers. If the build is successful, DKMS installs the module into the appropriate location for the new kernel. This process is automated to ensure that the module is available for the new kernel without manual intervention.

<B>SECURITY CONSIDERATIONS</B>

Building and installing kernel modules requires root privileges and can potentially introduce security vulnerabilities if the module source code is malicious or poorly written. Care should be taken to only use modules from trusted sources and to regularly review module source code for potential security issues.

HISTORY

DKMS was originally developed to simplify the management of kernel modules that are not part of the main Linux kernel. Its usage has grown significantly as more hardware vendors and open-source developers rely on it to provide drivers and other kernel extensions. The original author and initial development details are not consistently documented, but the project has been maintained and improved by a community of developers since its inception. It has become a standard tool for managing out-of-tree kernel modules on many Linux distributions.

SEE ALSO

modprobe(8), insmod(8), rmmod(8)

Copied to clipboard