Danijel
Danijel

Reputation: 8610

User kernel module "not found in directory"?

I did a simple Linux kernel module. I can install the module temporarily via sudo insmod my_module.ko and use it.

But I tried and failed to load the module at boot time:

However, the module is not loaded: Module my_module not found in directory /lib/modules/5.4.0-1056-raspi.

But the module is there in the kernel/drivers/my_module/my_module.ko file!

lsmod does not list it.

Have in mind that this module worked perfectly before on the same machine, but the kernel at that point was 5.4.0-1047-raspi and now I see it is 5.4.0-1056-raspi, so I went on to install it again - but this time it doesn't work.

What could be done wrong?

p.s. When I tried to compile my_module.c on this newer kernel, I got the error about missing license, so I added the line MODULE_LICENSE("GPL"); to the c file - than it compiled fine. That's the only difference in the source.

Upvotes: 0

Views: 3902

Answers (1)

Danijel
Danijel

Reputation: 8610

For some reason I needed to run sudo depmod first to re-generate the module dependencies, than sudo modprobe my_module to make it all work again.

Upvotes: 1

Related Questions