Error: 'Operation not permitted' from both insmod and modprobe

14,725

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.

Share:
14,725

Related videos on Youtube

enivium
Author by

enivium

Updated on September 18, 2022

Comments

  • enivium
    enivium over 1 year

    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

    • ravery
      ravery over 6 years
      which kernel do you have? Ubuntu kernels newer than 4.3 will not allow unsigned kernel modules if secure boot is enabled.
    • enivium
      enivium over 6 years
      Hi @ravery, I added the output from uname -r above. Looks like 3.10.40 is the kernel.
    • ravery
      ravery over 6 years
      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.
    • David Foerster
      David Foerster over 6 years
      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).