Sample Header Ad - 728x90

Load new version of non-removable running kernel module

1 vote
0 answers
38 views
I have an embedded Linux device (Ubiquiti EdgeRouter-X, see [this thread](https://community.ui.com/questions/SCTP-support-for-EdgeOSv2/7b50504f-8966-45f2-a1dd-f5571d3a7873#answer/cf43a3bd-d7e5-4eda-a31f-73be9f434e9f) for more detail) for which I cross-compiled the kernel module nf_conntrack.ko (part of netfilter) to support a protocol that was not built into the inbox module. This module is loaded and being used as soon as the device becomes accessible over SSH. The OS is debian-based, FWIW. I want to try out this version of the module, but it could be faulty and crash the kernel (happened in another module I compiled at the same time). If I could reload at runtime, then a crash would merely result in a reboot, which is fine. But I can't find a way to load a different version side-by-side with the running module. Or else, I'd have to unload the running module, and load the new one, but I'm just unable to do that with rmmod or modprobe -r or even rmmod -f. I've checked multiple questions like [this](https://unix.stackexchange.com/questions/645427/remove-kernel-module-in-use) and none of the subtle variants helped. But if I modify the boot configuration to load this module and reboot to test it, I'm scared that it might be stuck in a bootloop. The device does not have a physical console port so it really does need to boot up fully to be accessible. Is there a way to set the OS to load a module only once, and skip if it doesn't work, or else load the known-working version? Any way I can avoid saving a risky boot configuration to disk but still find out if the module can be loaded?
Asked by Milind R (111 rep)
Apr 23, 2025, 05:57 PM
Last activity: May 7, 2025, 11:58 AM