modprobe

Objective: System Architecture
Here’s a little tip concerning modprobe. As you review the man page for this tool you may see the -l option. Pay attention to the verbiage: List all modules matching the given wildcard (or “*” if no wildcard is given). This option is provided for backwards compatibility.

For example, not that the command works fine for my Ubuntu 12 LTS installation:
root@runlevl43:/home/runlevl4# cat /etc/issue
Ubuntu 12.04.5 LTS \n \l

root@runlevl43:/home/runlevl4# modprobe -l
kernel/arch/x86/kernel/cpu/mcheck/mce-xeon75xx.ko
kernel/arch/x86/kernel/cpu/mcheck/mce-inject.ko
kernel/arch/x86/kernel/msr.ko
kernel/arch/x86/kernel/cpuid.ko
kernel/arch/x86/kernel/microcode.ko
kernel/arch/x86/crypto/aes-x86_64.ko
kernel/arch/x86/crypto/blowfish-x86_64.ko

It also works fine for Red Hat 6.6:
[root@runlevl42 runlevl4]# cat /etc/issue
Red Hat Enterprise Linux Server release 6.6 (Santiago)
Kernel \r on an \m
[root@runlevl42 runlevl4]# modprobe -l
kernel/arch/x86/kernel/cpu/mcheck/mce-inject.ko
kernel/arch/x86/kernel/cpu/cpufreq/powernow-k8.ko
kernel/arch/x86/kernel/cpu/cpufreq/mperf.ko
kernel/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.ko

However, it doesn’t work under Ubuntu 14:
runlevl4@runlevl41:~$ cat /etc/issue
Ubuntu 14.04.2 LTS \n \l
runlevl4@runlevl41:~$ modprobe -l
modprobe: invalid option -- 'l'

I don’t know if this is on the exam or not but it’s probably worth noting. So what do you do if you want to know which modules are available to you but your distro doesn’t support the -l or –list option? Try the find command.

find /lib/modules/`uname -r` -type f -name "*.ko"
Note uname is surround by the backquote not apostrophe.

This will instruct find to search /lib/modules (using uname -r to append the kernel release) for all module files. Of course this command can also be used even if you do have the -l or –list option. Here you can see they each found the same number of modules.

[root@runlevl42 runlevl4]# modprobe -l | wc -l
2002
[root@runlevl42 runlevl4]# find /lib/modules/`uname -r` -type f -name "*.ko" | wc -l
2002

Post to Twitter

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.