I'm a beginner learning about linux kernel. I tried to insert a simple module but encountered the following error.
sudo insmod simpleModule.ko
[sudo] password:
insmod: ERROR: could not insert module simpleModule.ko: Operation not permitted
Contents of my simpleModule.c file:
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
int simple_init(void) {
printk(KERN_INFO "Loading module\n");
return 0;
}
void simple_exit(void) {
printk(KERN_INFO "Removing module\n");
}
module_init(simple_init);
module_exit(simple_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Simple Module");
My Makefile:
obj-m +=simpleModule.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
I'm using Ubuntu 20.04
Please help me in understanding this error and how to resolve it.