lsmod shows -2 in the “Used by” column
In your kernel configuration (make config
, make menuconfig
etc.) you need to enable CONFIG_MODULE_UNLOAD
:
When
CONFIG_MODULE_UNLOAD
is set, the kernel counts references, as you may only unload a module if there are no references to it.When
CONFIG_MODULE_UNLOAD
is not set, then the kernel has no need to count how many references there are to a module, and it always returns-2
as a marker value.
This answer originally came from Gentoo Forums.