2

I am trying to insert a module in Ubuntu 14.04, but both

sudo insmod xpcie.ko

and

sudo modprobe xpcie

return the error

could not insert xpcie.ko: Operation not permitted

I have placed a copy of xpcie.ko in /lib/modules/uname -r/kernel/drivers and have run

depmod -a xpcie.ko

This module comes from Xilinx's XAPP1022. It was originally designed for Fedora 9. Could that be the cause of this error, and if so, what would I need to change in the module? If not, what else would cause this?

Thanks.

EDIT:

uname -r

Returns 3.10.40-gb271e8f

4
  • 2
    which kernel do you have? Ubuntu kernels newer than 4.3 will not allow unsigned kernel modules if secure boot is enabled.
    – ravery
    Dec 15, 2017 at 18:10
  • Hi @ravery, I added the output from uname -r above. Looks like 3.10.40 is the kernel.
    – enivium
    Dec 15, 2017 at 18:16
  • 1
    the only other thing I can think of, is did you download source or a binary? kernel modules have to be built for the kernel they are run on.
    – ravery
    Dec 15, 2017 at 18:31
  • 1
    Kernel v3.10? The oldest supported Ubuntu release comes with v3.13. I'm voting to close this question as off topic because it's either about an unsupported Ubuntu release or something that isn't Ubuntu at all (even if it may bear its name). Dec 16, 2017 at 20:37

1 Answer 1

1

It turns out that if a module tries to initialize a device using a major number that is already taken, insmod and modprobe will fail with the error message

operation not permitted

For XAPP 1022 in particular, the driver tries to register a char device, to which it assigns the major number 240. There was already another device registered with that major number on my machine, which caused the driver to fail its init function.

The solution is to change

int gDrvrMajor = 240;

to

int gDrvrMajor = {some major number that isn't taken}

inside xpcie.c. It is then also necessary to change

mknod /dev/xpcie c 240 1

to

mknod /dev/xpcie c {same other major number as above} 1

inside make_device.

Not the answer you're looking for? Browse other questions tagged .