Why are my modules marked [permanent]?

Submitted by lava
on January 13, 2009 - 8:24pm

Honestly, I just have no idea. Any suggestions?
That's the code: (it's basically the hello-world-module from the Linux Device Drivers book)

1 #include &ltlinux/init.h&gt
2 #include &ltlinux/module.h&gt
3 MODULE_LICENSE("GPL");
4
5 static int hello_init(void)
6 {
7 printk(KERN_ALERT "exit: %p\n", THIS_MODULE->exit);
8 return 0;
9 }
10
11 static void hello_exit(void)
12 {
13 printk(KERN_ALERT "Goodbye, cruel world\n");
14 }
15
16 module_init(hello_init);
17 module_exit(hello_exit);

And here's what I did:

benno@benno-desktop:/media/disk/sources/kernel/modules/hello$ make
make -C /media/disk/sources/kernel/linux-2.6 M=/media/disk/sources/kernel/modules/hello modules
make[1]: Entering directory `/media/disk/sources/kernel/linux-2.6'
CC [M] /media/disk/sources/kernel/modules/hello/hello3.o
Building modules, stage 2.
MODPOST 1 modules
CC /media/disk/sources/kernel/modules/hello/hello3.mod.o
LD [M] /media/disk/sources/kernel/modules/hello/hello3.ko
make[1]: Leaving directory `/media/disk/sources/kernel/linux-2.6'
benno@benno-desktop:/media/disk/sources/kernel/modules/hello$ sudo insmod ./hello3.ko
[sudo] password for benno:
benno@benno-desktop:/media/disk/sources/kernel/modules/hello$ sudo rmmod hello3
ERROR: Removing 'hello3': Device or resource busy
benno@benno-desktop:/media/disk/sources/kernel/modules/hello$ lsmod | grep hello3
hello3 2304 0 [permanent]
benno@benno-desktop:/media/disk/sources/kernel/modules/hello$ dmesg | grep exit:
[13131.090187] exit: e0b3e000
benno@benno-desktop:/media/disk/sources/kernel/modules/hello$ uname -r
2.6.28-rc9benno-stripped
benno@benno-desktop:/media/disk/sources/kernel/modules/hello$ grep CONFIG_MODULE_UNLOAD /boot/config-2.6.28-rc9benno-stripped
CONFIG_MODULE_UNLOAD=y

So, any ideas what could be causing this? Am I missing something?

set CONFIG_MODULE_UNLOAD=y

coop (not verified)
on
January 14, 2009 - 1:12pm

Most likely you have not set
CONFIG_MODULE_UNLOAD=y in your
.config file. There's nothing wrong
with your module but you have module
unloading not configured in. look
at the kernel config file.

coop

Probably I should have this

on
January 14, 2009 - 5:37pm

Probably I should have said this explicitly, but CONFIG_MODULE_UNLOAD is set. (at least according to my config-file, see the last two lines of the original post)

Is the the config file of the running kernel?

on
January 15, 2009 - 6:23am

Hi Ho!

There is a possibility that the config file is not that of the running kernel.
It is much better if you can do `zgrep CONFIG_MODULE_UNLOAD /proc/config.gz'.

Best regards,
Eus (FSF member #4445)

In this digital era, where computing technology is pervasive,
your freedom depends on the software controlling those computing devices.

Join free software movement today!
It is free as in freedom, not as in free beer!

Join: http://www.fsf.org/jf?referrer=4445

I had to recompile my kernel

on
January 15, 2009 - 7:57pm

I had to recompile my kernel to get /proc/config.gz and now module unloading works again, so i guess CONFIG_MODULE_UNLOAD really wasn't set. (though i have no idea why a wrong config file had been generated)

Thank you all!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.