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

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



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值