LinuxCommandLibrary

depmod

Create module dependency description files

SYNOPSIS

depmod [options...] [kernel-version]

PARAMETERS

-a, --all
    Generate dependencies for all installed kernel versions

-A
    Like -a but ignore missing module directories

-b basedir
    Use basedir as the base for module directory

-C configfile, --config configfile
    Use specific configuration file

-e, --errsyms
    Output errors for unresolved symbols to stderr

-E, --symvers symvers
    Write symbol versions to file symvers

-F filesyms, --filesyms filesyms
    Write file symbol versions to filesyms

-m
    Warn about unknown modinfo keywords

-n, --dry-run
    Do not generate files, only show what would be done

-P prefix, --prefix prefix
    Use prefix for module paths

-r, --root root
    Search for modules in root directory

-v, --verbose
    Enable verbose output

-V, --version
    Display version information

-w, --warn-dups
    Warn about duplicate symbols

DESCRIPTION

depmod is a key utility in the Linux kernel module system, part of the kmod package. It scans all available kernel modules typically found in /lib/modules/<kernel-version>/ and generates essential dependency mapping files. These files enable efficient module loading by tools like modprobe, which resolve dependencies automatically without manual intervention.

Primarily, depmod creates modules.dep (listing prerequisites), modules.symbols (symbol dependencies), modules.alias (device aliases), and several binary variants (.bin) for faster parsing. It also produces modules.builtin, modules.softdep, modules.order, and others.

The command is crucial after installing new kernel modules, DKMS modules, or kernel updates to ensure the module loader has up-to-date information. Running it without arguments processes the current kernel (uname -r); specify a version for others. Option -a handles all installed kernels. Verbose output and warnings help diagnose issues like unresolved symbols or duplicates.

Typically invoked automatically by package managers (e.g., RPM, DEB post-install scripts), but manual use is common in custom builds or troubleshooting.

CAVEATS

Requires root privileges to write to /lib/modules. Can be time-consuming on systems with many modules. Always run after module changes to avoid modprobe failures.

GENERATED FILES

modules.dep, modules.dep.bin, modules.symbols, modules.symbols.bin, modules.alias, modules.alias.bin, modules.builtin, modules.builtin.bin, modules.devname, modules.softdep, modules.order

EXAMPLES

depmod -a (all kernels)
depmod 6.1.0-1 (specific version)
depmod -n -v (dry-run verbose)

HISTORY

Originated in modutils package (pre-2.6 kernels), evolved into module-init-tools for 2.6, merged into kmod project around Linux 3.14 (2014) for unified maintenance with systemd integration.

SEE ALSO

modprobe(8), insmod(8), rmmod(8), lsmod(1), modinfo(8)

Copied to clipboard