Insmod is not working

4.3k views Asked by At

insmod/rmmod doesn't recognize the arguments. Even insmod without any argument also gets executed. It looks like only command is recognized by the system.

Through insmod command kernel module can be inserted dynamically but when I do insmod testStub.ko, nothing is happening. Neither do I see my module in lsmod result nor any printk messages that I have written in my testStub.c, in dmesg.

lsmod/modprobe -l also don't show any output.

lsmod command is supposed to show all running modules .in my system it gives no output.

This is testStub.c:

#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */

int init_module(void)
{
    printk(KERN_EMERG "Module Attached");
    return 0;
}

void cleanup_module(void)
{
    printk(KERN_INFO "Module Detached!\n");
}

This is Makefile:

obj-m += testStub.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
1

There are 1 answers

0
Vikram N On

Your source file is missing module license this taints the kernel when you try to insert the module. add below line to your source code to make it work.

MODULE_LICENSE("GPL");