Fix Error Loading Module btusb with Kernel 4.10.0-20-generic

bluetoothdriverskernel

I have the follow problem.
I need to recompile the module btusb to able the bluetooth with this patch
When I finally run the patch the module didn't loaded:

$ lsmod | grep bluetooth
bluetooth             557056  10 btrtl,btintel,bnep,btbcm

I did try to load the module manually and give me this error:

$ sudo modprobe btusb
modprobe: ERROR: could not insert 'btusb': Exec format error

The last thing I did try was compile and load the vanilla code but displayed the same error.

Can be a bug in the source code from btusb?
If the answer is yes, I will to report the bug on launchpad, but I posted here first to be sure. I gave more info here

Thanks for advanced.

Update:
more info about the module:

$ modinfo btusb | egrep 'filename|vermagic'
filename:       /lib/modules/4.10.0-20-generic/kernel/drivers/bluetooth/btusb.ko
vermagic:       4.10.8 SMP mod_unload

Best Answer

You need to go back to the drivers/bluetooth directory of your source code and then

make -C /lib/modules/$(uname -r)/build M=$(pwd) clean
cp /usr/src/linux-headers-$(uname -r)/.config ./
cp /usr/src/linux-headers-$(uname -r)/Module.symvers Module.symvers
make -C /lib/modules/$(uname -r)/build M=$(pwd) modules
sudo cp btusb.ko /lib/modules/$(uname -r)/kernel/drivers/bluetooth
sudo modprobe -r btusb
sudo modprobe -v btusb

The error occurred because the source code was compiled on the wrong kernel header. The modinfo results confirm this as the vermagic info(kernel 4.10.8) doesn't match the filename info(4.10.0-20)

Related Question