Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is it possible to list down unused modules? lsmod would only list down dependency by modules, right?

share|improve this question
add comment

2 Answers 2

lsmod lists all loaded modules, and has a Used by column. If that is 0 for module A, then no other loaded module has a dependency on it.

This does not mean that removing the module is safe.

There is no way that I can think of that you could determine if a module is "in use". Device driver modules will (usually) increase their Used by count when they are actually handling a device. (This is valid also for virtual devices.) But I don't think you can count on that.

e.g. Right now I have the coretemp and lm90 modules loaded. Their Used by count is zero, but they are "in use" (temp. monitoring).

share|improve this answer
    
No other dependancy doesn't mean that it is not currently being used, right? Correct me if I'm wrong, the module might be in use, it's just that no other modules depends on it. –  amree May 19 '11 at 12:38
    
@foo: that's right. you can only remove modules with use count of 0, but that does not mean they're "idle". –  Mat May 19 '11 at 12:48
add comment

What do you mean by unused? The fact that a module is shown by lsmod means that probably there was a good reason to load it. In order to find modules that are compiled, but not used, you could compare the output of lsmod with /lib/modules for your kernel version.

share|improve this answer
    
I have constantly parport, lp and pcmcia loaded without using them. Yes, the interface is up and can be used, but it isn't. From the fact, that the modules are loaded, I can conclude, how the kernel works, but that's not obviously for me, beforehand. –  user unknown May 20 '11 at 2:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.