Builtin Kernel Modules and Loadable Kernel Modules

The general problem I have is that I am trying to trying to load a new kernel module I built, but it appears there is a conflicting built in kernel module that I cannot remove.

Now, into the specifics. My balena setup is the following:

  • Device Type: Generic x86_64
  • Balena OS: v2.58.6+rev1
  • Edition: Production

Hardware wise, I have a Logitech G29 Driving Force Racing Wheel connected to a Dell XPS 8940 desktop. Some of the force feedback functionality is missing in the built in hid_logitech kernel module, so I am building another kernel module for the logitech wheel from the following repo https://github.com/berarma/new-lg4ff, based on instructions from https://github.com/balena-os/kernel-module-build. On startup of my service, I try to remove the hid-logitech kernel module and insert the custom built kernel module.

rmmod hid-logitech
insmod /var/lib/dkms/new-lg4ff/0.3.1/5.2.10-yocto-standard/x86_64/module/hid-logitech.ko

However, I get the following errors that the hid_logitech module is builtin to the linux kernel and cannot be removed. Then, the custom built kernel module fails to load because the device already has the builtin kernel module.

rmmod: ERROR: Module hid_logitech is builtin
insmod: ERROR: could not insert module /var/lib/dkms/new-lg4ff/0.3.1/5.2.10-yocto-standard/x86_64/module/hid-logitech.ko: Device or resource busy

Any advice on how I can use my custom built kernel module that seems to conflict with the builtin kernel module?

The Generic_x86 device-type exists specifically to provide as many kernel modules as built-ins. Do you need any of those built-ins for connectivity (WiFi, Ethernet, etc) that are not present on the “Intel NUC” device-type? If no, I would suggest installing your Dell desktop with the “Intel NUC” device-type and loading the module the way you’re trying to do, as I do not believe this module will be built-in on the NUC DT.

If you do need to use the Generic_x86 for some other builtin, it looks like the best way to prevent a builtin from loading is by modifying the GRUB command line:

This method is a little more dangerous, but you can set the blacklist discussed in the above StackExchange link in balenaOS under /mnt/boot/EFI/BOOT/grub_extraenv.

I would recommend the Intel NUC device-type route instead if that works for you, as it’s less likely to cause issues down the line, but let us know if either solves the issue!