System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

insmod vs modprobe -- plz help

SOLVED
Go to solution
Maaz
Valued Contributor

insmod vs modprobe -- plz help

OS: SUSE
Although OS is not the Redhat, but.. i think this issue a General linux issue ;)

plz correct me if am wrong, and also suggest

I think modprobe, and insmod are use to load/install *.ko(modules).. right .. if then why I am getting error when
# insmod /lib/modules/2.6.16.21-0.8-smp/kernel/net/ipv4/netfilter/ip_nat_ftp.ko
1,
insmod: error inserting '/lib/modules/2.6.16.21-0.8-smp/kernel/net/ipv4/netfilter/ip_nat_ftp.ko': -1 Unknown symbol in module
2,
# modprobe /lib/modules/2.6.16.21-0.8-smp/kernel/net/ipv4/netfilter/ip_nat_ftp.ko
FATAL: Module /lib/modules/2.6.16.21_0.8_smp/kernel/net/ipv4/netfilter/ip_nat_ftp.ko not found.

3,
# insmod ip_nat_ftp
insmod: can't read 'ip_nat_ftp': No such file or directory
# insmod ip_nat_ftp.ko
insmod: can't read 'ip_nat_ftp.ko': No such file or directory

But success when
4
# modprobe ip_nat_ftp

Plz help/explain
Regards
4 REPLIES
Alexander Chuzhoy
Honored Contributor

Re: insmod vs modprobe -- plz help

First of all thise are 2 diiferent utilities - here's a quote from insmod's man:
"insmod is a trivial program to insert a module into the kernel: if the filename is a hyphen, the module is taken from standard input. Most users will want to use modprobe(8) instead, which is cleverer."

Second: Are you sure that your current kernel is 2.6.16.21_0.8_smp?
I suggest you to replace the line:
insmod /lib/modules/2.6.16.21-0.8-smp/kernel/net/ipv4/netfilter/ip_nat_ftp.ko
with
insmod /lib/modules/`uname -r`/kernel/net/ipv4/netfilter/ip_nat_ftp.ko

Best regards.
Solution

Re: insmod vs modprobe -- plz help

insmod and modprobe work differently.
- insmod takes a file name argument (either full path or relative path). That is why #3 fails.
- insmod does not deal with dependencies. This may be why #1 fails (not sure).
- modprobe takes a module name (usually this is the name of the file without the .ko extension), hence the error for #2 above.
- modprobe _does_ handle dependencies and module-specific options (see /etc/modprobe.conf).

So modprobe is really the command you want to use.
Maaz
Valued Contributor

Re: insmod vs modprobe -- plz help

Thank dear Alexander Chuzhoy, and Jerome Forissier for help.

for Alexander:
>Second: Are you sure that your current kernel is 2.6.16.21_0.8_smp?
no... and neither i said/wrote

>I suggest you to replace the line: .....
# insmod /lib/modules/`uname -r`/kernel/net/ipv4/netfilter/ip_nat_ftp.ko
insmod: error inserting '/lib/modules/2.6.16.21-0.8-smp/kernel/net/ipv4/netfilter/ip_nat_ftp.ko': -1 Unknown symbol in module

Well issue resolved ;)
thanks for help
Regards
Maaz
dirk dierickx
Honored Contributor

Re: insmod vs modprobe -- plz help

my advice to you is to (always) use modprobe. in 99% of the cases it does exactly what you expect it should do.