LinuxCommandLibrary

modinfo

Display information about a Linux kernel module

TLDR

List all attributes of a kernel module

$ modinfo [kernel_module]
copy

List the specified attribute only
$ modinfo [[-F|--field]] [author|description|license|parm|filename|version|...] [kernel_module]
copy

SYNOPSIS

modinfo [options] module_name | -F field_name
modinfo [options] -k kernel_version module_name
modinfo [options] /path/to/module.ko

PARAMETERS

-a, --author
    Displays the author of the module.

-d, --description
    Shows a brief description of the module's purpose.

-l, --license
    Prints the license under which the module is distributed.

-p, --parameters
    Lists all available module parameters (options) and their descriptions, types, and default values.

-n, --filename
    Outputs the absolute path to the module file.

-F field, --field=field
    Displays the value of a specific field (e.g., alias, depends, retpoline). Use modinfo -F list to see all possible fields.

-k kernel_version
    Specifies the kernel version for which to retrieve module information, useful when inspecting modules for a different kernel.

-b basedir, --basedir=basedir
    Specifies an alternative base directory for modules (e.g., /lib/modules/), overriding the default.

-V, --version
    Prints the modinfo utility version.

DESCRIPTION

modinfo is a command-line utility used to extract and display metadata embedded within a Linux kernel module (.ko file). It can reveal various attributes such as the module's filename, author, license, description, aliases, dependencies, and available parameters. This information is crucial for system administrators and developers to understand a module's purpose, its operational requirements, and how to interact with it, for example, by loading it with specific options. Unlike lsmod, which lists currently loaded modules, modinfo reads metadata directly from the module file on the filesystem, making it useful for inspecting modules even before they are loaded into the kernel. It's an indispensable tool for debugging module issues and ensuring proper system configuration.

CAVEATS

modinfo operates on module files found on the filesystem; it does not directly query a running kernel. The amount and detail of information displayed depend on the metadata embedded by the module developer. Some older or less maintained modules might provide minimal details.

MODULE FIELDS

Beyond the common parameters, modinfo can display numerous internal module fields vital for debugging and understanding module behavior. These include alias (alternative names), depends (other modules it relies on), srcversion (source code version), vermagic (kernel version magic string), firmware (required firmware files), retpoline (Spectre vulnerability mitigation status), and rhelversion (for Red Hat specific builds).

HISTORY

modinfo has been a fundamental utility in Linux for examining kernel modules since the early days of the `module-init-tools` package. It is now part of the `kmod` project, which manages kernel module utilities. Its core functionality has remained consistent, providing essential introspection capabilities for system administrators and developers.

SEE ALSO

lsmod(8), modprobe(8), rmmod(8), insmod(8), depmod(8)

Copied to clipboard