rmmod出错(/lib/modules): No such file or directory

来源:互联网 发布:淘宝客速成三部曲琳落 编辑:程序博客网 时间:2024/05/17 08:50

http://www.cnblogs.com/feisky/archive/2010/05/29/1746888.html


# rmmod nls_cp936

rmmod: chdir(/lib/modules): No such file or directory

两种方法:

1

创建空目录 mkdir /lib/modules/($uname -r)

2

2.使用如下源码生成rmmod命令,就可以没有任何提示的卸载ko模块了[luther.gliethttp]

#include <stdio.h>

#include <stdlib.h>

#include <unistd.h>

#include <fcntl.h>

#include <string.h>

#include <errno.h>

int main(int argc, char *argv[])

{

const char *modname = argv[1];

int ret = -1;

int maxtry = 10;

while (maxtry-- > 0) {

ret = delete_module(modname, O_NONBLOCK | O_EXCL);//系统调用sys_delete_module

if (ret < 0 && errno == EAGAIN)

usleep(500000);

else

break;

}

if (ret != 0)

printf("Unable to unload driver module \"%s\": %s\n",

modname, strerror(errno));

}

运行./rmmod



原创粉丝点击