tuxedocomputers / tuxedo-keyboard

This repository will no longer get any updates as the code here is now part of tuxedo-drivers https://gitlab.com/tuxedocomputers/development/packages/tuxedo-drivers.
https://gitlab.com/tuxedocomputers/development/packages/tuxedo-drivers
GNU General Public License v3.0
300 stars 92 forks source link

Modules compiled with the code from this repo cannot be loaded: "Unknown symbol in module" #172

Closed brunoais closed 1 year ago

brunoais commented 1 year ago

Problem

When I try to load modules I compile using code from current master branch commit 131af916 from this repo, I successfully compile the code but I can't load it to the kernel. reloadModules.sh unloads and reloads modules. A copy of its source code is in my PR which adds LED control functionality and power mode press reaction. The order they load is as specified in the generated modules.order file. The code which generates modules.order file is in the master branch.

Logs

This is my console output (I anonymized the file paths):

$ clear && make clean && make && ./reloadModules.sh
make -C /lib/modules/5.19.0-38-generic/build M=/censored/path/to/tuxedo-keyboard clean
make[1]: Entering directory '/usr/src/linux-headers-5.19.0-38-generic'
  CLEAN   /censored/path/to/tuxedo-keyboard/Module.symvers
make[1]: Leaving directory '/usr/src/linux-headers-5.19.0-38-generic'
make -C /lib/modules/5.19.0-38-generic/build M=/censored/path/to/tuxedo-keyboard modules
make[1]: Entering directory '/usr/src/linux-headers-5.19.0-38-generic'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
  You are using:           gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
  CC [M]  /censored/path/to/tuxedo-keyboard/./src/tuxedo_keyboard.o
In file included from /censored/path/to/tuxedo-keyboard/./src/tuxedo_keyboard.c:23:
/censored/path/to/tuxedo-keyboard/./src/uniwill_keyboard.h:770:13: warning: ‘uw_charging_profile_write_state’ defined but not used [-Wunused-function]
  770 | static void uw_charging_profile_write_state(void)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CC [M]  /censored/path/to/tuxedo-keyboard/./src/clevo_wmi.o
  CC [M]  /censored/path/to/tuxedo-keyboard/./src/clevo_acpi.o
  CC [M]  /censored/path/to/tuxedo-keyboard/./src/tuxedo_io/tuxedo_io.o
/censored/path/to/tuxedo-keyboard/./src/tuxedo_io/tuxedo_io.c:64:13: warning: ‘dmi_string_in’ defined but not used [-Wunused-function]
   64 | static bool dmi_string_in(enum dmi_field f, const char *str)
      |             ^~~~~~~~~~~~~
  CC [M]  /censored/path/to/tuxedo-keyboard/./src/uniwill_wmi.o
  MODPOST /censored/path/to/tuxedo-keyboard/Module.symvers
  CC [M]  /censored/path/to/tuxedo-keyboard/./src/clevo_acpi.mod.o
  LD [M]  /censored/path/to/tuxedo-keyboard/./src/clevo_acpi.ko
  BTF [M] /censored/path/to/tuxedo-keyboard/./src/clevo_acpi.ko
Skipping BTF generation for /censored/path/to/tuxedo-keyboard/./src/clevo_acpi.ko due to unavailability of vmlinux
  CC [M]  /censored/path/to/tuxedo-keyboard/./src/clevo_wmi.mod.o
  LD [M]  /censored/path/to/tuxedo-keyboard/./src/clevo_wmi.ko
  BTF [M] /censored/path/to/tuxedo-keyboard/./src/clevo_wmi.ko
Skipping BTF generation for /censored/path/to/tuxedo-keyboard/./src/clevo_wmi.ko due to unavailability of vmlinux
  CC [M]  /censored/path/to/tuxedo-keyboard/./src/tuxedo_io/tuxedo_io.mod.o
  LD [M]  /censored/path/to/tuxedo-keyboard/./src/tuxedo_io/tuxedo_io.ko
  BTF [M] /censored/path/to/tuxedo-keyboard/./src/tuxedo_io/tuxedo_io.ko
Skipping BTF generation for /censored/path/to/tuxedo-keyboard/./src/tuxedo_io/tuxedo_io.ko due to unavailability of vmlinux
  CC [M]  /censored/path/to/tuxedo-keyboard/./src/tuxedo_keyboard.mod.o
  LD [M]  /censored/path/to/tuxedo-keyboard/./src/tuxedo_keyboard.ko
  BTF [M] /censored/path/to/tuxedo-keyboard/./src/tuxedo_keyboard.ko
Skipping BTF generation for /censored/path/to/tuxedo-keyboard/./src/tuxedo_keyboard.ko due to unavailability of vmlinux
  CC [M]  /censored/path/to/tuxedo-keyboard/./src/uniwill_wmi.mod.o
  LD [M]  /censored/path/to/tuxedo-keyboard/./src/uniwill_wmi.ko
  BTF [M] /censored/path/to/tuxedo-keyboard/./src/uniwill_wmi.ko
Skipping BTF generation for /censored/path/to/tuxedo-keyboard/./src/uniwill_wmi.ko due to unavailability of vmlinux
make[1]: Leaving directory '/usr/src/linux-headers-5.19.0-38-generic'
rmmod: ERROR: Module uniwill_wmi is not currently loaded
rmmod: ERROR: Module tuxedo_io is not currently loaded
rmmod: ERROR: Module clevo_acpi is not currently loaded
rmmod: ERROR: Module clevo_wmi is not currently loaded
rmmod: ERROR: Module tuxedo_keyboard is not currently loaded
insmod: ERROR: could not insert module /censored/path/to/tuxedo-keyboard/./src/tuxedo_keyboard.ko: Unknown symbol in module
insmod: ERROR: could not insert module /censored/path/to/tuxedo-keyboard/./src/clevo_wmi.ko: Unknown symbol in module
insmod: ERROR: could not insert module /censored/path/to/tuxedo-keyboard/./src/clevo_acpi.ko: Unknown symbol in module
insmod: ERROR: could not insert module /censored/path/to/tuxedo-keyboard/./src/tuxedo_io/tuxedo_io.ko: Unknown symbol in module
insmod: ERROR: could not insert module /censored/path/to/tuxedo-keyboard/./src/uniwill_wmi.ko: Unknown symbol in module

This is the dmesg output:

kern  :warn  : [<    6,350046>] tuxedo_keyboard: Unknown symbol devm_led_classdev_multicolor_unregister (err -2)
kern  :warn  : [<    0,000083>] tuxedo_keyboard: Unknown symbol led_mc_calc_color_components (err -2)
kern  :warn  : [<    0,000019>] tuxedo_keyboard: Unknown symbol devm_led_classdev_multicolor_register_ext (err -2)
kern  :warn  : [<    0,026164>] clevo_wmi: Unknown symbol clevo_keyboard_add_interface (err -2)
kern  :warn  : [<    0,000040>] clevo_wmi: Unknown symbol clevo_keyboard_remove_interface (err -2)
kern  :warn  : [<    0,031065>] clevo_acpi: Unknown symbol clevo_keyboard_add_interface (err -2)
kern  :warn  : [<    0,000023>] clevo_acpi: Unknown symbol clevo_keyboard_remove_interface (err -2)
kern  :warn  : [<    0,032495>] tuxedo_io: Unknown symbol uniwill_read_ec_ram (err -2)
kern  :warn  : [<    0,000016>] tuxedo_io: Unknown symbol uniwill_get_device_features (err -2)
kern  :warn  : [<    0,000017>] tuxedo_io: Unknown symbol uniwill_write_ec_ram (err -2)
kern  :warn  : [<    0,000008>] tuxedo_io: Unknown symbol uniwill_write_ec_ram_with_retry (err -2)
kern  :warn  : [<    0,000013>] tuxedo_io: Unknown symbol uniwill_get_active_interface_id (err -2)
kern  :warn  : [<    0,000023>] tuxedo_io: Unknown symbol clevo_evaluate_method (err -2)
kern  :warn  : [<    0,000015>] tuxedo_io: Unknown symbol clevo_get_active_interface_id (err -2)
kern  :warn  : [<    0,019317>] uniwill_wmi: Unknown symbol uniwill_add_interface (err -2)
kern  :warn  : [<    0,000031>] uniwill_wmi: Unknown symbol uniwill_remove_interface (err -2)

Environment

Analysis

This problem appeared in version 3.2.0. The offending commit is b963225cf7eef66c6eb28224a872bc62845f4c41

While bisecting backwards through generalize_keyboard_backlight_brightness branch to when the problem started, I reached commit: f50eeaac07128013758bb3a8ef3aa83115b2c192. So, commit f50eeaac07128013758bb3a8ef3aa83115b2c192 loads just fine. However, commit affc59e3e2784a3a838c4495fb8365e1759fcd67 doesn't load at all.

The issue reported is the exact same both in the past and in the current commit:

kern  :warn  : [<   28,165551>] tuxedo_keyboard: Unknown symbol devm_led_classdev_multicolor_register_ext (err -2)
kern  :warn  : [<    0,038576>] clevo_wmi: Unknown symbol clevo_keyboard_add_interface (err -2)
kern  :warn  : [<    0,000073>] clevo_wmi: Unknown symbol clevo_keyboard_remove_interface (err -2)
kern  :warn  : [<    0,035635>] clevo_acpi: Unknown symbol clevo_keyboard_add_interface (err -2)
kern  :warn  : [<    0,000021>] clevo_acpi: Unknown symbol clevo_keyboard_remove_interface (err -2)
kern  :warn  : [<    0,032551>] tuxedo_io: Unknown symbol uniwill_read_ec_ram (err -2)
kern  :warn  : [<    0,000020>] tuxedo_io: Unknown symbol uniwill_write_ec_ram (err -2)
kern  :warn  : [<    0,000012>] tuxedo_io: Unknown symbol uniwill_get_active_interface_id (err -2)
kern  :warn  : [<    0,000017>] tuxedo_io: Unknown symbol clevo_evaluate_method (err -2)
kern  :warn  : [<    0,000012>] tuxedo_io: Unknown symbol clevo_get_active_interface_id (err -2)
kern  :warn  : [<    0,027481>] uniwill_wmi: Unknown symbol uniwill_add_interface (err -2)
kern  :warn  : [<    0,000031>] uniwill_wmi: Unknown symbol uniwill_remove_interface (err -2)

I tried many of the intermediate commits between affc59e3e2784a3a838c4495fb8365e1759fcd67 and 131af916 and I checked the errors reported and they are the same.

Help please!

What is wrong here? Why the errors? What happened in that commit that works well enough to exist in the repo but is broken in my system?

tuxedoxt commented 1 year ago

Hello,

this looks weird. Only notable thing with https://github.com/tuxedocomputers/tuxedo-keyboard/commit/affc59e3e2784a3a838c4495fb8365e1759fcd67 to me is the inclusion of the multicolor interface. .h plus use of register/unregister.

Otherwise regarding system. For this interface to work CONFIG_LEDS_CLASS_MULTICOLOR needs to be enabled in the kernel but should just not work if not. Not prevent insertion. However, it looks like you have the standard ubuntu 22.04 kernel, right?

brunoais commented 1 year ago

However, it looks like you have the standard ubuntu 22.04 kernel, right?

That was correct until yesterday evening. Now I changed to linux-oem-22.04c due to amdgpu no-retry page fault under 5.19 leading to amdgpu no-retry page fault

linux-oem-22.04c currently installs 6.1.0-1008-oem and it still doesn't work with the same errors, no difference.

brunoais commented 1 year ago

@tuxedoxt Any news?

tuxedoxt commented 1 year ago

It still seems to be specific to the multicolor symbols and manually inserted modules. If the kernel was configured to build the module you can also try loading the module manually (insmod will not load dependencies on its own)

modprobe led-class-multicolor

before inserting the modules that depend on it.

brunoais commented 1 year ago

I've tried this and sth is wrong. MY PC becomes completely unusable with everything locking up and become progressively unresponsive. I don't have time to diagnose why today, so I'll try again on the weekend.


Update: I will need more time. The issue is not trivial. I'll need to schedule some day when I can do as many reboots as I need without disturbing the rest of my stuff every time the module locks up and won't unload. This doesn't mean the module you provide is faulty. It probably just means I'm doing something wrong but then I need to reboot to rectify


Update: I'm still trying to figure things out. I'm now sure now if it's my problem or not. I'll need some dedicated days to look at this

brunoais commented 1 year ago

Update: I confirm commit e236eec fixes the issue and I can now load the modules with no issues (took me a while to make sure of this. Sorry for the delay).