I'm trying to remove a module I have created, but it doesn't work for me.

Assuming my module name is xyz :

  1. When I try to run rmmod xyz I get the following error: rmmod: ERROR: Module xyz is in use
  2. When I try to use modprobe -r xyz I get the following error: modprobe: FATAL: Module xyz not found.
  3. However, when I run lsmod I can see the following line:

    Module        Size  Used by
    xyz          16384  -1

I have tried to do the proposed suggestion in: How to remove kernel module if it's still in use? But it didn't help.

I have changes made to the code of the module, I compiled it and want to load it from scratch.

Any suggestions?

I'm using lubuntu 17.10.1


  • There are answers on Stack Overflow involving writing custom code to programmatically find what is using the module. This apparently happens all the time and should be addressed through the kernel bug reports to hammer the idea that module accounting, loading and unloading deserves more attention from the kernel dev team than it receives now. – ajeh May 11 '18 at 14:45
  • @ajeh can you link to an answer that has a working code that actually shows you what exactly is preventing a module from unloading? – Costin Gușă Apr 24 '19 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.