由于程序的异常退出, 内核的引用计数没有被清除(我猜的). 所以驱动不能被卸载掉, 强制也不行.
如下:
[root@localhost ~]# insmod /opt/scorpion/KingKong/kmod/igb_uio.ko insmod: error inserting '/opt/scorpion/KingKong/kmod/igb_uio.ko': -1 File exists You have new mail in /var/spool/mail/root [root@localhost ~]# rmmod /opt/scorpion/KingKong/kmod/igb_uio.ko [root@localhost ~]# insmod /opt/scorpion/KingKong/kmod/igb_uio.ko ERROR: Module igb_uio is in use [root@localhost ~]# rmmod -f /opt/scorpion/KingKong/kmod/igb_uio.ko ERROR: Removing 'igb_uio': Resource temporarily unavailable insmod: error inserting '/opt/scorpion/KingKong/kmod/igb_uio.ko': -1 File exists You have new mail in /var/spool/mail/root [root@localhost ~]# rmmod /opt/scorpion/KingKong/kmod/igb_uio.ko ERROR: Module igb_uio is in use [root@localhost ~]# rmmod -f /opt/scorpion/KingKong/kmod/igb_uio.ko ERROR: Removing 'igb_uio': Resource temporarily unavailable
因为 -f 参数实际上是没有起作用的. 可以修改内存参数使其其作用, 这样就能强制卸载了.
这个参数的名字是:
CONFIG_MODULE_FORCE_UNLOAD
[root@T185 ~]# cat /boot/config-3.4.68-1.el6.x86_64 |grep FORCE_UNLOAD # CONFIG_MODULE_FORCE_UNLOAD is not set [root@T185 ~]#
不过需要重新编译内核才行.