Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 11-08-2007, 12:06 AM   #1
LQ Newbie
Registered: Nov 2007
Location: Shanghai,China
Distribution: gentoo
Posts: 19
Blog Entries: 1

Rep: Reputation: 0
module dependence

PHP Code:
root@lynn:/home/lynn# lsmod
Module                  Size  Used by
ipv6                  273892  10 
i want to know which modules dependent on ipv6 module

Old 11-08-2007, 09:47 AM   #2
Simon Bridge
LQ Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
You could remove it and see which modules vanish
Old 11-08-2007, 06:50 PM   #3
Senior Member
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
I think:
lsmod  | grep [^^]$MOD  | less -S
will give the answer you are looking for. You can omit the "less" at the risk of being confused by folded output lines. You could also/instead pipe it into a column selector that would remove the "(Used) by" modules. E.g., an awk or cut statement.

Notes on lsmod
The man page is, to say the least, sparse. IMNRHO, its brevity sucks. (With all due respect to the author, Rusty Russell, who is legendary for his work on netfilter & iptables.)

It is so bad, I originally thought there is a bug in the headers: column 3 seemed to be the # pages the module uses & col. 4 the list of other modules that use it. seems to support this idea:
Module         Pages    Used by
memory_cs          2            0
ds                 2    [memory_cs]     3
i82365             4            2
First column is Module name and second column is size of modules i..e the output format is module name, size, use count, list of referring modules.
At a given time, if a module has "0" in the lsmod "Used" column and either
nothing or (unused) or (autoclean) in the "by" column, there are reasonable
chances that it is unused.
say otherwise.

An explanation of the meaning of the columns in the man page would save countless hours of grief. Changing "by" to "" in the headers wouldn't hurt either.

Why not change
lsmod is a trivial program which nicely formats the contents of the /proc/modules, showing what kernel modules are currently loaded.
lsmod is a trivial program which nicely formats the contents of /proc/modules, showing what kernel modules are currently loaded in a 4 column format:
"Module" - the name of the module
"Size" - the amount of memory it uses
"Used" - its use count
"by" - a "tight" (no spaces) comma separated list of referring modules
Although it only appears once - for brevity in the output - "Used" is to be mentally read twice: i.e. "by" is to be understood as "Used by", that is why it is not capitalized.

I also don't like lsmod's column formatting, esp. col. #3.
lsmod  | awk '{printf "%-21s %6s  %2s %s\n",$1,$2,$3,$4}'
lsmod  \
| sed '1s,by,,'  \
| awk '{printf "%-21s %6s  %2s %s\n",$1,$2,$3,$4}'
would be a good aliases for the current lsmod.

Last edited by archtoad6; 11-08-2007 at 06:51 PM.
Old 11-08-2007, 08:44 PM   #4
LQ Newbie
Registered: Nov 2007
Location: Shanghai,China
Distribution: gentoo
Posts: 19
Blog Entries: 1

Original Poster
Rep: Reputation: 0
Originally Posted by Simon Bridge View Post
You could remove it and see which modules vanish
PHP Code:
localhost lynn # rmmod ipv6
ERRORModule ipv6 is in use 
Old 11-08-2007, 09:27 PM   #5
LQ Newbie
Registered: Aug 2007
Posts: 18

Rep: Reputation: 2
depmod is the command - which generate the modules.dep file, in /lib/modules/xxxx/ directory:

For example:

/lib/modules/2.6.23/kernel/crypto/cbc.ko: /lib/modules/2.6.23/kernel/crypto/blkcipher.ko

From above we know that cbc is depending on blkcipher.ko.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
About LQ dependence colucix LQ Suggestions & Feedback 5 02-27-2007 07:34 PM
dpkg dependence how to install them with software? badgerbox76 Linux - Newbie 1 04-16-2006 06:05 AM
Samba - machine name dependence? Jerksquad Linux - Networking 0 01-09-2004 09:50 AM
Dedicated to dropping my dependence on Microsoft Products khermans Linux - General 8 11-10-2003 12:33 PM
glic-dependence !!! tricky_linux Linux - Software 2 10-04-2003 12:28 AM

All times are GMT -5. The time now is 05:59 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration