How to use the command dkms (with examples)

How to use the command dkms (with examples)

The dkms command is a framework that allows for dynamic building of kernel modules. It facilitates the installation, removal, and maintenance of kernel modules, making it easier to manage and update modules within the Linux kernel. This article provides examples of different use cases of the dkms command.

Use case 1: List currently installed modules

Code:

dkms status

Motivation: This use case is helpful when you want to obtain a list of the currently installed kernel modules. It allows you to check the status of installed modules and ensure that they are up to date.

Explanation: The dkms status command lists the currently installed modules along with their version and status. It provides information about which modules are installed and whether they are properly built and installed for the current kernel.

Example output:

nvidia, 470.57.02, 5.4.0-89-generic, x86_64: installed

Use case 2: Rebuild all modules for the currently running kernel

Code:

dkms autoinstall

Motivation: Sometimes, after updating the Linux kernel, the existing kernel modules may not be compatible and require rebuilding. This use case allows you to automatically rebuild all modules for the currently running kernel, ensuring that all modules are compatible and functional.

Explanation: The dkms autoinstall command triggers the automatic rebuilding of all modules for the currently running kernel. It checks if there are any pending module build requests and compiles them for the current kernel version.

Example output:

Kernel preparation unnecessary for this kernel.  Skipping...
applying patch 0001-Makefile.patch...patching file Makefile
...
Building module:
cleaning build area...
...
DKMS: build completed.

Use case 3: Install version 1.2.1 of the acpi_call module for the currently running kernel

Code:

dkms install -m acpi_call -v 1.2.1

Motivation: In case you need to install a specific version of a kernel module, this use case allows you to install version 1.2.1 of the acpi_call module for the currently running kernel.

Explanation: The dkms install command with the -m argument specifies the module name (acpi_call in this example), and the -v argument specifies the version (1.2.1 in this example) to be installed. This command installs the specified module version for the currently running kernel.

Example output:

Kernel preparation unnecessary for this kernel.  Skipping...
applying patch 0001-Makefile.patch...patching file Makefile
...
Building module:
cleaning build area...
...
DKMS: install completed.

Use case 4: Remove version 1.2.1 of the acpi_call module from all kernels

Code:

dkms remove -m acpi_call -v 1.2.1 --all

Motivation: Sometimes, you may want to remove a specific version of a kernel module from all installed kernels. This use case allows you to remove version 1.2.1 of the acpi_call module from all kernels.

Explanation: The dkms remove command with the -m argument specifies the module name (acpi_call in this example), the -v argument specifies the version (1.2.1 in this example) to be removed, and the --all argument ensures that the removal is performed for all kernels, not just the currently running one.

Example output:

Deleting module version: 1.2.1
completely from the DKMS tree.
...
DKMS: uninstall completed.
Tags :

Related Posts

How to use the command gnomon (with examples)

How to use the command gnomon (with examples)

Gnomon is a utility tool that can be used to annotate console logging statements with timestamps and find slow processes.

Read More
How to use the command gh gist (with examples)

How to use the command gh gist (with examples)

The gh gist command allows users to work with GitHub Gists, a way to share and collaborate on code snippets, notes, and more.

Read More
How to use the command 'tye' (with examples)

How to use the command 'tye' (with examples)

The ’tye’ command is a developer tool that aims to make developing, testing, and deploying microservices and distributed applications easier.

Read More