How do I uninstall dkms modules if there are two of them?

I have 2 dkms modules are in same version:

$ dkms status
rtl8812AU, 4.3.14, 4.4.0-45-generic, x86_64: installed
rtl8812AU, 4.3.14, 4.4.0-47-generic, x86_64: installed

When I tried dkms uninstall -m rtl8812AU -v 4.3.14 it uninstalled the second one. How do I uninstall the first one? Thanks!


To remove the module for all kernels you can run

sudo dkms remove rtl8812AU/4.3.14 --all

You don't have two DKMS modules. You have one DKMS module built and installed for two different kernel versions.

As a rule of thumb you shouldn't manually uninstall DKMS modules for kernels that are still installed unless you have a specific reason. (There’s no need to manually uninstall modules for kernels removed through the package manager as DKMS already takes care of that via package removal hooks – assuming the kernel was packaged correctly.)


If you really want to uninstall the module for a particular kernel, you can refer to the dkms(8) manual:

-k <kernel-version>/<arch>

The kernel and arch to perform the action upon. You can specify multiple kernel version/arch pairs on the command line by repeating the -k argument with a different kernel version and arch. However, not all actions support multiple kernel versions (it will error out in this case). The arch part can be omitted, and DKMS will assume you want it to be the arch of the currently running system.

So the command to uninstall the module in question for kernel 4.4.0-45-generic is:

dkms uninstall -k 4.4.0-45-generic rtl8812AU

You can omit the module version since you can't install multiple versions of a module for the same kernel anyway.