LinuxCommandLibrary

dkms

Manage dynamically built kernel modules

TLDR

List currently installed modules

$ dkms status
copy

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

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

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

SYNOPSIS

dkms [global-options] <command> [<module> [<version>] [<command-options>]]

PARAMETERS

add
    Register module/version source tree in DKMS

build
    Compile module/version for specified kernel

install
    Build and install module/version into kernel tree

remove
    Remove module/version from DKMS tracking

uninstall
    Remove module/version files from kernel tree

status
    Show status of all registered modules/kernels

autoinstall
    Build/install all modules marked autoinstall

mkdeb
    Generate Debian package for module

mkrpm
    Generate RPM package for module

--all
    Apply to all modules/versions/kernels

--kernel-version=VER
    Target specific kernel version

--arch=ARCH
    Build for specific architecture

--force
    Override safety checks

--verbose=N
    Set verbosity level (0-4)

--version
    Display DKMS version

--help
    Show usage help

DESCRIPTION

DKMS (Dynamic Kernel Module Support) is a Linux framework for automatically building and installing kernel modules from sources outside the kernel tree. It addresses the challenge of maintaining third-party or out-of-tree modules (e.g., NVIDIA drivers, VirtualBox guest additions, WiFi chipsets) across kernel updates.

Traditional kernel modules must be manually recompiled for each new kernel version. DKMS automates this by storing module sources in /usr/src/<module>-<version>/, parsing a dkms.conf file for build instructions, and tracking installed modules in /var/lib/dkms/. When a new kernel is installed, DKMS hooks (via initrd or package post-scripts) detect changes and rebuild/install modules seamlessly.

Core workflow: dkms add registers sources; dkms build compiles for a kernel; dkms install deploys the .ko files to /lib/modules/<kernel>/extra/ and runs depmod. Commands like status and autoinstall aid management. Widely used in distros like Ubuntu, Fedora for proprietary hardware support.

Benefits include reduced downtime, version independence, and simplified admin tasks, though it requires kernel headers and gcc.

CAVEATS

Requires root privileges; kernel-devel/headers and gcc must be installed; not for in-tree modules; potential build failures on kernel ABI changes.

DKMS.CONF

Key file in source dir defining MAKE="make KERNELDIR=%s", BUILT_MODULE_NAME, AUTOINSTALL="yes", etc.
Supports PRE_BUILD, POST_BUILD hooks.

MODULE STATUS

dkms status outputs: module/version, kernel: installed/built/src. Use --all for full view.

HISTORY

Developed by Dell in 2003 for managing proprietary drivers across kernel updates; integrated into major distros by 2005; maintained by community since 2010, with version 3.x adding mkpkg support.

SEE ALSO

dkms(8), modprobe(8), depmod(8), lsmod(1), insmod(8)

Copied to clipboard