How do I configure modprobe to find my module?

KernelKernel ModuleInsmod

Kernel Problem Overview


I'm trying to get a kernel module to load at boot.

If I run insmod /path/to/module.ko, it works fine. But this has to be repeated every time I reboot.

If I run modprobe /path/to/module.ko, it can't find the module. I know modprobe uses a configuration file, but I can't get it to load the module even after adding /path/to/module.ko to /etc/modules.

What is the proper configuration?

Kernel Solutions


Solution 1 - Kernel

You can make a symbolic link of your module to the standard path, so depmod will see it and you'll be able load it as any other module.

sudo ln -s /path/to/module.ko /lib/modules/`uname -r`
sudo depmod -a
sudo modprobe module

If you add the module name to /etc/modules it will be loaded any time you boot.

Anyway I think that the proper configuration is to copy the module to the standard paths.

Solution 2 - Kernel

Follow following steps:

> 1. Copy hello.ko to /lib/modules/'uname-r'/misc/ > 2. Add misc/hello.ko entry in /lib/modules/'uname-r'/modules.dep > 3. sudo depmod > 4. sudo modprobe hello

modprobe will check modules.dep file for any dependency.

Solution 3 - Kernel

I think the key is to copy the module to the standard paths.

Once that is done, modprobe only accepts the module name, so leave off the path and ".ko" extension.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionsep332View Question on Stackoverflow
Solution 1 - KernelJaime SorianoView Answer on Stackoverflow
Solution 2 - KerneltusharrnimjeView Answer on Stackoverflow
Solution 3 - KernelRay LiView Answer on Stackoverflow