简体   繁体   English

rmmod 失败并显示设备或资源繁忙消息

[英]rmmod fail with Device or resource busy message

I've searched the net but still haven't found the answer.我已经搜索了网络,但仍然没有找到答案。 I followed the direction on http://ubuntuforums.org/showthread.php?t=800251 .我按照http://ubuntuforums.org/showthread.php?t=800251上的指示进行操作。 It compiles ok and I can do insmod.它编译好,我可以做 insmod。 The message is displayed ok.消息显示正常。 But when I run rmmod, it fails with "Device or resource busy" message.但是当我运行 rmmod 时,它会失败并显示“设备或资源繁忙”消息。 I changed the name of the module and insmod, rmmod, the same happens.我更改了模块的名称和insmod,rmmod,同样的情况。 I don't know how to forcefully rmmod the module and I also want to know what's causing this 'resource busy' pheonomenon.我不知道如何强制 rmmod 模块,我也想知道是什么导致了这种“资源繁忙”现象。 Any idea?任何想法? I'm using ubuntu and was told the system was installed from the binary image not compiled so my guess is there's some discrepancy in the system.. Is there any problem in the program below?我正在使用 ubuntu,并被告知系统是从未编译的二进制映像安装的,所以我的猜测是系统中存在一些差异。下面的程序有什么问题吗? Thanks in advance.提前致谢。 Chan

#include <linux/module.h>

static int __init hello_world( void )
{
  printk( "hello world!\n" );
  return 0;
}

static void __exit goodbye_world( void )
{
  printk( "goodbye world!\n" );
}

module_init( hello_world );
module_exit( goodbye_world );

Maybe you should check if you are using a compatible compiler.也许您应该检查您是否使用了兼容的编译器。

The way to check kernel-used compiler version: cat /proc/version检查内核使用的编译器版本的方法: cat /proc/version

Your program seems correct to me.你的程序对我来说似乎是正确的。 In fact, it works fine on my system.事实上,它在我的系统上运行良好。 Can you give any additional information that might help, like your dmesg output when you try to rmmod.您能否提供任何可能有帮助的其他信息,例如您尝试 rmmod 时的 dmesg 输出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM