LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices



Reply
 
Search this Thread
Old 11-08-2007, 01:06 AM   #1
linuxgentoo
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


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

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

Rep: Reputation: 231Reputation: 231Reputation: 231
I think:
Code:
MOD='ipv6'
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. http://www.faqs.org/faqs/linux/faq/part4/ seems to support this idea:
Code:
Module         Pages    Used by
memory_cs          2            0
ds                 2    [memory_cs]     3
i82365             4            2
However, http://www.cyberciti.biz/faq/howto-d...kernel/print/:
Quote:
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.
and http://osdir.com/ml/linux.evms.devel...msg00045.html:
Quote:
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 "...by" in the headers wouldn't hurt either.

Why not change
Quote:
lsmod is a trivial program which nicely formats the contents of the /proc/modules, showing what kernel modules are currently loaded.
to
Quote:
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.
Code:
lsmod  | awk '{printf "%-21s %6s  %2s %s\n",$1,$2,$3,$4}'
or
Code:
lsmod  \
| sed '1s,by,...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 07:51 PM.
 
Old 11-08-2007, 09:44 PM   #4
linuxgentoo
LQ Newbie
 
Registered: Nov 2007
Location: Shanghai,China
Distribution: gentoo
Posts: 19
Blog Entries: 1

Original Poster
Rep: Reputation: 0
Quote:
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, 10:27 PM   #5
tthtlc
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.
 
  


Reply

Tags
lsmod


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 08:34 PM
dpkg dependence how to install them with software? badgerbox76 Linux - Newbie 1 04-16-2006 07:05 AM
Samba - machine name dependence? Jerksquad Linux - Networking 0 01-09-2004 10:50 AM
Dedicated to dropping my dependence on Microsoft Products khermans Linux - General 8 11-10-2003 01:33 PM
glic-dependence !!! tricky_linux Linux - Software 2 10-04-2003 01:28 AM


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

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