Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there a standard way to list the parameter values of a loaded Linux module? I'm essentially probing for another answer to this Linux kernel module parameters question, because the module I'm interested in doesn't have a /sys/modules/<module_name>/parameters interface.

share|improve this question

6 Answers 6

You could use the "modinfo(8)" command to get available load time parameters for a module. For instance:

# modinfo e100 | grep parm
parm:           debug:Debug level (0=none,...,16=all) (int)
parm:           eeprom_bad_csum_allow:Allow bad eeprom checksums (int)
parm:           use_io:Force use of i/o access mode (int)

As for getting the parameters of loaded modules, try combining the modinfo command with a simple "lsmod | awk '{ print $1 }'"

share|improve this answer
7  
-1 This only shows something like a man page but does not say what the values are. –  Aleksandr Levchuk Nov 13 '10 at 0:43

Working off of katriel's work, you can get a (admittedly ugly) one-liner by combining the two of them in a bash loop:

for i in `lsmod | awk '{print $1}'`; do echo "$i: "; modinfo $i | grep parm; done
share|improve this answer
2  
using awk for just returning the first argument via print is somewhat gross - use the while read syntax instead: lsmod | while read a b; do echo $a:; modinfo $a | grep parm | sed -e 's/parm://'; done - it does not change the fact that modinfo does not return the parameter values, though... –  the-wabbit Jun 14 '11 at 15:21
3  
and I think the original question was about the used parameters, not the available ones. –  asdmin Feb 17 '12 at 12:51

Would come out ugly as a comment, but I did this check on my system..

cat /proc/modules  | cut -d " " -f1 | while read mod; do
   test -d /sys/module/$mod/parameters || echo modinfo $mod | grep parm; 
done

To check if modules without parameters in /sys show up as having parameters in modinfo but I couldnt find any.

I am no expert, but the difference here is that modinfo reads the module file itself for the parameters by looking in the .modinfo elf headers, whereas sys is reading these from its runtime variant.

It may be possible to have parameters you can modify at runtime which dont appear as a modinfo parameter value, but since the module format should be pretty fixed I dont imagine its possible for you to pass a option parameter to a module when loading without there being a .modinfo structure for it linked in.

I am curious, does your module suggest there are parameters passable with modinfo when you check it that way but there are none in /sys for it? Certainly on my system I was unable to find any examples of this using the command provided above.

share|improve this answer

You can do it by using this simple one way command, which uses the /proc/modules and /sys virtual filesystems:

cat /proc/modules | cut -f 1 -d " " | while read module; do \
 echo "Module: $module"; \
 if [ -d "/sys/module/$module/parameters" ]; then \
  ls /sys/module/$module/parameters/ | while read parameter; do \
   echo -n "Parameter: $parameter --> "; \
   cat /sys/module/$module/parameters/$parameter; \
  done; \
 fi; \
 echo; \
done

You will obtain an output like this:

...
...
Module: vboxnetadp

Module: vboxnetflt

Module: vboxdrv
Parameter: force_async_tsc --> 0

Module: binfmt_misc

Module: uinput

Module: fuse
Parameter: max_user_bgreq --> 2047
Parameter: max_user_congthresh --> 2047

Module: md_mod
Parameter: new_array --> cat: /sys/module/md_mod/parameters/new_array: Permission denied
Parameter: start_dirty_degraded --> 0
Parameter: start_ro --> 0

Module: loop
Parameter: max_loop --> 0
Parameter: max_part --> 0

Module: kvm_intel
Parameter: emulate_invalid_guest_state --> N
Parameter: ept --> Y
Parameter: fasteoi --> Y
Parameter: flexpriority --> Y
Parameter: nested --> N
Parameter: ple_gap --> 0
Parameter: ple_window --> 4096
Parameter: unrestricted_guest --> Y
Parameter: vmm_exclusive --> Y
Parameter: vpid --> Y
Parameter: yield_on_hlt --> Y

Module: kvm
Parameter: allow_unsafe_assigned_interrupts --> N
Parameter: ignore_msrs --> N
Parameter: min_timer_period_us --> 500

Module: tpm_infineon

Module: joydev

Module: snd_hda_codec_hdmi
Parameter: static_hdmi_pcm --> N
...
...

Hope this helps.

share|improve this answer
    
Thanks! That is very useful diagnosing all kind of problems with problematic hardware ! –  Oz123 Dec 10 '12 at 6:54
    
Amazing, and if you pass $module as e.g. function parameter instead of getting it from /proc/modules you easily get all params of a given module. –  igordcard May 18 at 11:14

I think the command systool -vm <Module name> also does what you are looking for.

share|improve this answer
    
The command systool is part of the package sysfsutils. And this is the answer I think, (but could have an example output) –  Volker Siegel Jun 20 at 7:22
grep '' /sys/module/ath9k*/parameters/*

/sys/module/ath9k/parameters/blink:1
/sys/module/ath9k/parameters/bt_ant_diversity:0
/sys/module/ath9k/parameters/btcoex_enable:0
/sys/module/ath9k/parameters/nohwcrypt:1
/sys/module/ath9k/parameters/ps_enable:0
share|improve this answer

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.