How to unload a kernel module which is in use and has a recursive module dependency?
Sophia Terry
I habe a driver for my ELM 327 an it uses the pl2303 module which depends on the usbserial and this again depends on the pl2303 module.
What I tried:
sudo modprobe -r usbserial pl2303
sudo modprobe -r pl2303 usbserial
sudo modprobe -rf usbserial
sudo modprobe -rf pl2303
sudo rmmod --force pl2303
sudo rmmod --force usbserialresult of rmmod:
rmmod: ERROR: ../libkmod/libkmod-module.c:799 kmod_module_remove_module() could not remove 'usbserial': Resource temporarily unavailable
rmmod: ERROR: could not remove module usbserial: Resource temporarily unavailableresult of modprobe:
modprobe: FATAL: Module usbserial is in use.Also I tried it with the drivers loaded and unloaded.
OS: Ubuntu 20.04
23 Answers
It's possible to blacklist kernel modules.
Checkout this post about How to blacklist kernel modules?
1When you look into dmesg do you see a line where the device was detected when it was plugged in? Ubuntu should have FTDI support out of the box. Normally you would just access it by typing screen /dev/ttyUSB# 38400.
2As OP mentioned rather than unloading module it is easier to not load it in the first place. This is accomplished by blacklisting the module:
To summarize answers in link:
Just open your /etc/modprobe.d/blacklist.conf file and add drivername using following syntax:
blacklist pl2303Save the file and Reboot. The offending module will no longer be loaded at startup.