Module not found: modprobe
c, kernel-module, linux, linux-device-driver, linux-kernel
Solution
This is because `modprobe` inserts modules by reading a file called modules.dep under /lib/modules/$(shell uname -r)/. So after compiling and installing your module make sure you recreate this dependency file once again.
Here is how it is done
- After installation of your module, check whether it is copied to /lib/modules/
- if it is found, then go to -> /lib/modules/$(shell uname -r)/ and use depmod command to create the dependency list of your new module.
Once this is done, you will be able to locate your module name under the file /lib/modules/$(shell uname -r)/modules.dep.
After this you can use `modprobe` to insert your module.
EDIT:
Below is the `Makefile` I used to build with root permission and test.
target ?= hello_world
obj-m = $(target).o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules_install
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
Problem
I have written a simple hello world kernel module, compiled it and install in `/lib/modules/kernel_version/extra/` path. With `insmod` its getting loaded properly, but with `modprobe` i am getting an error ``` modprobe: FATAL: Module hello_world.ko not found. ``` I have installed all the per-requisite. Here is Makefile to compile and install: ``` make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules_install ``` Please tell me how to get is done. Thanks in Advance.