Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I am someone trying to learn linux kernel programming. I read insmod and modprobe can be used for inserting a module in to the kernel. I created a simple kernel module and tried to insert using insmod it worked well. But when I used modprobe it showed error.
[root@station121 kernel]# modprobe module1.ko
FATAL: Module module1.ko not found.
My module is a simple kernel module which just has a init_module function and a cleanup module function. I tried to insert from the path where my program and module resides.
I am using linux kernel 2.6.18 on a Centos 5 distribution. Please help me
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 14.1
Two things, the man page says modprobe looks in /lib/modules for loadable modules. Copy your module there and give it a go. Second, in suggests the name should have '-' or '_' in the name ( without the quotes ). You could rename the module as a second thing to try.
Thanks for the reply friends. As you have said I have copied my module into /lib/modules/2.6.18-53.el5 directory. The name of my module is module1.ko . And I tried modprobe again.But it is showing the same error message. What i did wrong ?....
I think Uncle Theodore has it right with the suggestion to run "depmod -a". I believe that you have to be in /lib/modules/`uname -r`, and that your .ko file should be in the proper subdirectory under the kernel subdirectory.
Thanks .. that does work...But I still didnt under stand the part ... This time I first inserted the module using insmod...Then I run depmod -a...Then I copied the module to /lib/modules/<uname -r> directory...I then removed the module using rmmod ... Then I tried modprobe with only module name and it does work..In total this is what i did...
I think you just overlooked a step in your previous example. The steps would be:
1: put your module into /lib/modules/`uname -r`/kernel/drivers/HERE-SOMEWHERE
3: now either insmod or modprobe should work.
4: to remove the module, do "rmmod module1" or on a more modern OS, "modprobe -r module1"
FWIW, as I understand it, using modprobe does 'module dependency checking' and inserts related modules needed by the initial module, whereas 'insmod/rmmod' does not.
Also, you never need the .ko extension for modprobe.
Last edited by GrapefruiTgirl; 08-24-2009 at 01:03 AM.
Reason: EDIT: added /drivers to path --oops.