I built a kernel module but cannot load it: exec format error

Hey ! I just built the module and placed it in the kernel/bluetooth directory. But I have this error when I actually want to load the module : modprobe: ERROR: could not insert 'btusb': Exec format error
What should I do ? why does this error occur ?
Please reply if you know a possible fix :slight_smile:

The kernel version you’re running and the kernel version you built your module against do not match.
You need to build the module against the same kernel version you’re running.

I DID IT !! I finally figured out what was going wrong ! I was building the kernel source from git clone https://gitlab.manjaro.org/packages/core/linux514.git
BUT the linux514.git contained the source files and patches for the latest revision of 5.14 which is 5.14.17. While my system has 5.14.10. Thats why it was showing the error while starting the module. Essentially I was building the module for 5.14.17 and trying to apply it to 5.14.10. I just had to revert to the 5.14.10 commit and it worked ! Thanks for your time, this has been a great learning experience :smile:

1 Like