Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"FATAL: Module not found error" using modprobe

Tags:

I have a problem with modprobe command... I compiled the hello world module and loaded it with insmod, it works fine and when I do lsmod, I can see it in the output list. But when I insert this module using modprobe I am getting a FATAL error:

root@okapi:/home/ravi# modprobe ./hello.ko  FATAL: Module ./hello.ko not found. root@okapi:/home/ravi# 

Here is the module code:

#include <linux/init.h> #include <linux/module.h>  MODULE_LICENSE("Dual BSD/GPL");  static int hello_init(void) {         printk(KERN_ALERT "Hello, world\n");         return 0; } static void hello_exit(void) {         printk(KERN_ALERT "Goodbye, cruel world\n"); }  module_init(hello_init); module_exit(hello_exit); 

and Makefile

obj-m += hello.o  all:         make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules  clean:         make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean 
like image 725
Ravi Gupta Avatar asked Jun 29 '10 12:06

Ravi Gupta


People also ask

How do I add modules to modprobe?

In order to insert a new module into the kernel, execute the modprobe command with the module name. Following example loads vmhgfs module to Linux kernel on Ubuntu. Once a module is loaded, verify it using lsmod command as shown below. The module files are with .

How do I enable modprobe?

Use the modprobe command to add or remove modules on Linux. The command works intelligently and adds any dependent modules automatically. The kernel uses modprobe to request modules. The modprobe command searches through the standard installed module directories to find the necessary drivers.

Where is modprobe located?

modprobe looks in the module directory /lib/modules/`uname -r` for all the modules and other files, except for the optional configuration files in the /etc/modprobe.

Where is modprobe in Linux?

Description. modprobe intelligently adds or removes a module from the Linux kernel: note that for convenience, there is no difference between _ and - in module names. modprobe looks in the module directory /lib/modules/'uname -r' for all the modules and other files, except for the optional /etc/modprobe.


1 Answers

The reason is that modprobe looks into /lib/modules/$(uname -r) for the modules and therefore won't work with local file path. That's one of differences between modprobe and insmod.

like image 181
che Avatar answered Sep 21 '22 14:09

che