depmod
Create module dependency description files
SYNOPSIS
depmod [options] [kernel_version]
PARAMETERS
-a, --all
Scan all modules in the configured module search path.
-b, --base-dir
Specify an alternative base directory (e.g., /lib/modules) for modules.
-n, --dry-run
Perform all actions but do not write any files to disk; useful for testing.
-v, --verbose
Print verbose information about what depmod is doing.
-q, --quiet
Suppress all error messages and warnings.
-F, --file
Read the list of module files to process from the specified filename instead of scanning directories.
-e, --err-if-broken
Exit with an error status if any broken symlinks are found among module files.
DESCRIPTION
depmod is a utility program responsible for creating a set of files that describe kernel module dependencies, aliases, and other metadata.
The most crucial file it generates is modules.dep, which lists the dependencies of every kernel module. This file is vital for the modprobe command, enabling it to intelligently load a module along with all its prerequisites. depmod scans the module directories (typically /lib/modules/<kernel_version>), extracts dependency information from module metadata (like the Depends: field), and builds a comprehensive dependency graph.
Beyond modules.dep, depmod also generates modules.alias (used for aliasing hardware device IDs to module names), modules.symbols (for tracking exported symbols), and modules.builtin (listing modules compiled directly into the kernel). These files collectively form the backbone of the kernel module management system, ensuring efficient and conflict-free loading and unloading of modules. It is typically run automatically after kernel updates or when new modules are installed or removed.
CAVEATS
depmod generally requires root privileges to write the dependency files to the standard system directories (e.g., /lib/modules).
Failure to run depmod after installing new modules or updating the kernel can lead to modprobe being unable to find or load necessary modules, potentially causing system issues.
DEPENDENCY FILES LOCATION
The crucial dependency files generated by depmod, such as modules.dep, modules.alias, and modules.symbols, are typically located in the /lib/modules/<kernel_version>/ directory on a standard Linux system.
AUTOMATIC EXECUTION
In most modern Linux distributions, depmod is automatically executed by package managers (like apt, dnf, or yum) whenever a new kernel package is installed or updated, or when third-party kernel modules are added to the system.
HISTORY
depmod has been an integral part of Linux kernel module management since its early days, evolving with the kernel's module loader infrastructure. Initially part of the module-init-tools package, it is now maintained as part of the kmod project. Its core function of preparing dependency and alias information for modprobe has remained consistent, adapting to new module features like signing and more complex dependency chains over time.