Linux – Can’t load module in Ubuntu – Operation not permited

linuxUbuntu

If I do:

sudo insmod module.ko

I get:

insmod: error inserting 'module.ko': -1 Operation not permitted

modinfo gives me:

filename:       module.ko
license:        XXX Proprietary
version:        210
author:         XXX
description:    XXX Driver
srcversion:     XXX
depends:        
vermagic:       2.6.32-33-generic-pae SMP mod_unload modversions 586TSC

and uname -a gives:

2.6.32-35-generic-pae #78-Ubuntu SMP Tue Oct 11 17:01:12 UTC 2011 i686 GNU/Linux

so I suspect that I need to install this specific kernel version:

2.6.32-33-generic-pae

My question is how to manage to insert this module and if kernel version is the problem – how to install it on Ubuntu 10.04?

Just to mention, I had 2.6.32.33-generic kernel when I installed Ubuntu, but insmod failed.
Then I did:

sudo aptitude install linux-generic-pae linux-headers-generic-pae

and I selected new kernel on boot, but insmod failed again. What I noticed is that it was (I think 2.6.32.36-generic-pae and not 2.6.32.33-generic-pae, but I don't know how to install this specific version)

Best Answer

From The Linux Kernel Module Programming Guide, section 1.2.1.1:

A module compiled for one kernel won't load if you boot a different kernel unless you enable CONFIG_MODVERSIONS in the kernel.

So, building a kernel with CONFIG_MODVERSIONS enabled, probably will resolve your problem. Another solution would be to build and install Linux 2.6.32-33 with PAE support.