{"id":268560,"date":"2023-03-30T04:04:22","date_gmt":"2023-03-29T20:04:22","guid":{"rendered":"https:\/\/lrxjmw.cn\/qsxzlnhmksyf.html"},"modified":"2023-03-30T04:04:22","modified_gmt":"2023-03-29T20:04:22","slug":"qsxzlnhmksyf","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/qsxzlnhmksyf.html","title":{"rendered":"\u8f7b\u677e\u5378\u8f7dLinux\u5185\u6838\u6a21\u5757\uff0c\u5b9e\u7528\u65b9\u6cd5\u52a9\u4f60\u9ad8\u6548\u5b8c\u6210"},"content":{"rendered":"

\u60f3\u8981\u5728Linux<\/a>\u7cfb\u7edf<\/a>\u4e2d\u5378\u8f7d\u5185\u6838\u6a21\u5757\u5417\uff1f\u8fd9\u91cc\u63d0\u4f9b\u4e86\u4e00\u4e9b\u9ad8\u6548\u5b9e\u7528\u7684\u65b9\u6cd5\uff0c\u8ba9\u4f60\u8f7b\u677e\u5b8c\u6210\u5378\u8f7d\u8fc7\u7a0b\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528rmmod\u547d\u4ee4<\/a>\u3001modprobe\u547d\u4ee4\u3001\/etc\/modprobe.d\u76ee\u5f55\u3001\/etc\/modules\u6587\u4ef6\u3001\/etc\/rc.local\u6587\u4ef6\u3001blacklist.conf\u6587\u4ef6\u3001make uninstall\u547d\u4ee4\u7b49\u591a\u79cd\u65b9\u6cd5\u6765\u5378\u8f7d\u5185\u6838\u6a21\u5757\u3002\u6b64\u5916\uff0c\u6211\u4eec\u8fd8\u5c06\u4ecb\u7ecd\u5982\u4f55\u5224\u65ad\u662f\u5426\u6210\u529f\u5378\u8f7d\u5185\u6838\u6a21\u5757\uff0c\u4ee5\u53ca\u5982\u4f55\u907f\u514d\u4e00\u4e9b\u5e38\u89c1\u7684\u9519\u8bef\u3002\u5feb\u6765\u770b\u770b\u5427\uff01<\/p>\n

1.\u4f7f\u7528rmmod\u547d\u4ee4\u5378\u8f7d\u5185\u6838\u6a21\u5757<\/p>\n

2.\u4f7f\u7528modprobe\u547d\u4ee4\u5378\u8f7d\u5185\u6838\u6a21\u5757<\/p>\n

3.\u5728\/etc\/modprobe.d\u76ee\u5f55\u4e2d\u6dfb\u52a0\u914d\u7f6e\u6587\u4ef6<\/p>\n

4.\u5728\/etc\/modules\u6587\u4ef6\u4e2d\u6dfb\u52a0\u9700\u8981\u5c4f\u853d\u7684\u5185\u6838\u6a21\u5757<\/p>\n

5.\u5728\/etc\/rc.local\u6587\u4ef6\u4e2d\u6dfb\u52a0\u547d\u4ee4<\/p>\n

6.\u5728blacklist.conf\u6587\u4ef6\u4e2d\u6dfb\u52a0\u9700\u8981\u5c4f\u853d\u7684\u5185\u6838\u6a21\u5757<\/p>\n

7.\u4f7f\u7528make uninstall\u547d\u4ee4\u5378\u8f7d\u5185\u6838\u6a21\u5757<\/p>\n

8.\u5982\u4f55\u5224\u65ad\u662f\u5426\u6210\u529f\u5378\u8f7d\u5185\u6838\u6a21\u5757<\/p>\n

9.\u907f\u514d\u5e38\u89c1\u9519\u8bef\uff1a\u6ca1\u6709\u6743\u9650\u6216\u8005\u5176\u4ed6\u7a0b\u5e8f\u6b63\u5728\u4f7f\u7528\u8be5\u5185\u6838\u6a21\u5757<\/p>\n

10.\u603b\u7ed3<\/p>\n

1.\u4f7f\u7528rmmod\u547d\u4ee4\u5378\u8f7d\u5185\u6838\u6a21\u5757<\/p>\n

rmmod\u547d\u4ee4\u662f\u6700\u7b80\u5355\u76f4\u63a5\u7684\u65b9\u6cd5\u4e4b\u4e00\uff0c\u5b83\u53ef\u4ee5\u5feb\u901f\u5378\u8f7d\u5185\u6838\u6a21\u5757\u3002\u53ea\u9700\u8981\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165rmmod\u547d\u4ee4\u548c\u6a21\u5757\u540d\uff0c\u5c31\u53ef\u4ee5\u5b8c\u6210\u5378\u8f7d\u8fc7\u7a0b\u3002\u4f8b\u5982\uff0c\u8981\u5378\u8f7d\u540d\u4e3ahello.ko\u7684\u5185\u6838\u6a21\u5757\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

\n

\n$ sudo rmmod hello\n<\/pre>\n<\/p>\n

2.\u4f7f\u7528modprobe\u547d\u4ee4\u5378\u8f7d\u5185\u6838\u6a21\u5757<\/p>\n

modprobe\u547d\u4ee4\u4e5f\u53ef\u4ee5\u7528\u6765\u5378\u8f7d\u5185\u6838\u6a21\u5757\u3002\u4e0ermmod\u547d\u4ee4\u4e0d\u540c\u7684\u662f\uff0c\u5b83\u4f1a\u81ea\u52a8\u89e3\u51b3\u4f9d\u8d56\u5173\u7cfb\uff0c\u56e0\u6b64\u53ef\u4ee5\u540c\u65f6\u5378\u8f7d\u591a\u4e2a\u76f8\u5173\u8054\u7684\u5185\u6838\u6a21\u5757\u3002\u8981\u5378\u8f7d\u540d\u4e3ahello.ko\u7684\u5185\u6838\u6a21\u5757\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

\n

\n$ sudo modprobe -r hello\n<\/pre>\n<\/p>\n

3.\u5728\/etc\/modprobe.d\u76ee\u5f55\u4e2d\u6dfb\u52a0\u914d\u7f6e\u6587\u4ef6<\/p>\n

\u5982\u679c\u4f60\u60f3\u7981\u7528\u67d0\u4e2a\u5185\u6838\u6a21\u5757\u5e76\u9632\u6b62\u5176\u91cd\u65b0\u52a0\u8f7d\uff0c\u53ef\u4ee5\u5728\/etc\/modprobe.d\u76ee\u5f55\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u914d\u7f6e\u6587\u4ef6\u3002\u8fd9\u4e2a\u6587\u4ef6\u5e94\u8be5\u4ee5.conf\u7ed3\u5c3e\uff0c\u5e76\u5305\u542b\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n

\n

\nblacklist module_name\n<\/pre>\n<\/p>\n

\u5176\u4e2dmodule_name\u662f\u4f60\u60f3\u5c4f\u853d\u7684\u5185\u6838\u6a21\u5757\u540d\u3002\u4f8b\u5982\uff0c\u8981\u5c4f\u853d\u540d\u4e3ahello.ko\u7684\u5185\u6838\u6a21\u5757linux \u5378\u8f7d\u5185\u6838\u6a21\u5757<\/strong>linux \u5378\u8f7d\u5185\u6838\u6a21\u5757<\/strong>\uff0c\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\/etc\/modprobe.d\/blacklist.conf\u6587\u4ef6\u7ea2\u65d7linux\u7cfb\u7edf\uff0c\u5e76\u5728\u5176\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n

\n

\nblacklist hello\n<\/pre>\n<\/p>\n

4.\u5728\/etc\/modules\u6587\u4ef6\u4e2d\u6dfb\u52a0\u9700\u8981\u5c4f\u853d\u7684\u5185\u6838\u6a21\u5757<\/p>\n

\u5982\u679c\u4f60\u60f3\u5728\u542f\u52a8\u65f6\u81ea\u52a8\u5c4f\u853d\u67d0\u4e2a\u5185\u6838\u6a21\u5757\uff0c\u53ef\u4ee5\u5c06\u5176\u6dfb\u52a0\u5230\/etc\/modules\u6587\u4ef6\u4e2d\u3002\u53ea\u9700\u8981\u5728\u6587\u4ef6\u4e2d\u6dfb\u52a0\u9700\u8981\u5c4f\u853d\u7684\u5185\u6838\u6a21\u5757\u540d\u5373\u53ef\u3002\u4f8b\u5982\uff0c\u8981\u5c4f\u853d\u540d\u4e3ahello.ko\u7684\u5185\u6838\u6a21\u5757\uff0c\u53ef\u4ee5\u5728\/etc\/modules\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n

\n

\n#\/etc\/modules: kernel modules to load at boot time.\n#\n# This file contains the names of kernel modules that should be loaded\n# at boot time, one per line. Lines beginning with "#" are ignored.\nhello\n<\/pre>\n<\/p>\n

5.\u5728\/etc\/rc.local\u6587\u4ef6\u4e2d\u6dfb\u52a0\u547d\u4ee4<\/p>\n

\u5982\u679c\u4f60\u60f3\u5728\u542f\u52a8\u65f6\u6267\u884c\u67d0\u4e2a\u547d\u4ee4\uff0c\u53ef\u4ee5\u5c06\u5176\u6dfb\u52a0\u5230\/etc\/rc.local\u6587\u4ef6\u4e2d\u3002\u53ea\u9700\u8981\u5728\u6587\u4ef6\u4e2d\u6dfb\u52a0\u9700\u8981\u6267\u884c\u7684\u547d\u4ee4\u5373\u53ef\u3002\u4f8b\u5982\uff0c\u8981\u5378\u8f7d\u540d\u4e3ahello.ko\u7684\u5185\u6838\u6a21\u5757\uff0c\u53ef\u4ee5\u5728\/etc\/rc.local\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n

\n

\nrmmod hello\n<\/pre>\n<\/p>\n

6.\u5728blacklist.conf\u6587\u4ef6\u4e2d\u6dfb\u52a0\u9700\u8981\u5c4f\u853d\u7684\u5185\u6838\u6a21\u5757<\/p>\n

\u9664\u4e86\u5728\/etc\/modprobe.d\u76ee\u5f55\u4e2d\u521b\u5efa\u914d\u7f6e\u6587\u4ef6\u5916\uff0c\u8fd8\u53ef\u4ee5\u5c06\u9700\u8981\u5c4f\u853d\u7684\u5185\u6838\u6a21\u5757\u540d\u6dfb\u52a0\u5230blacklist.conf\u6587\u4ef6\u4e2d\u3002\u8fd9\u4e2a\u6587\u4ef6\u901a\u5e38\u4f4d\u4e8e\/lib\/modprobe.d\/\u76ee\u5f55\u4e0b\uff0c\u5e76\u5305\u542b\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n

\n

\n# This file lists those modules which we don't want to be loaded by\n# alias expansion, usually so some other driver will be loaded for the\n# device instead.\nblacklist module_name\n<\/pre>\n<\/p>\n

\u5176\u4e2dmodule_name\u662f\u4f60\u60f3\u5c4f\u853d\u7684\u5185\u6838\u6a21\u5757\u540d\u3002\u4f8b\u5982\uff0c\u8981\u5c4f\u853d\u540d\u4e3ahello.ko\u7684\u5185\u6838\u6a21\u5757\uff0c\u53ef\u4ee5\u5728\/lib\/modprobe.d\/blacklist.conf\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n

\n

\nblacklist hello\n<\/pre>\n<\/p>\n

7.\u4f7f\u7528make uninstall\u547d\u4ee4\u5378\u8f7d\u5185\u6838\u6a21\u5757<\/p>\n

\u5982\u679c\u4f60\u662f\u901a\u8fc7\u6e90\u7801\u7f16\u8bd1\u5b89\u88c5\u7684\u5185\u6838\u6a21\u5757\uff0c\u53ef\u4ee5\u4f7f\u7528make uninstall\u547d\u4ee4\u6765\u5378\u8f7d\u5b83\u3002\u53ea\u9700\u8981\u8fdb\u5165\u5185\u6838\u6e90\u7801\u76ee\u5f55\uff0c\u7136\u540e\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5373\u53ef\uff1a<\/p>\n

\n

\n$ sudo make uninstall\n<\/pre>\n<\/p>\n

8.\u5982\u4f55\u5224\u65ad\u662f\u5426\u6210\u529f\u5378\u8f7d\u5185\u6838\u6a21\u5757<\/p>\n

\u8981\u5224\u65ad\u662f\u5426\u6210\u529f\u5378\u8f7d\u5185\u6838\u6a21\u5757\uff0c\u53ef\u4ee5\u4f7f\u7528lsmod\u547d\u4ee4\u67e5\u770b\u5f53\u524d\u52a0\u8f7d\u7684\u5185\u6838\u6a21\u5757\u3002\u5982\u679c\u8981\u67e5\u770b\u67d0\u4e2a\u5177\u4f53\u7684\u5185\u6838\u6a21\u5757\u662f\u5426\u5df2\u7ecf\u88ab\u5378\u8f7d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

\n

\n$ lsmod | grep module_name\n<\/pre>\n<\/p>\n

\u5176\u4e2dmodule_name\u662f\u4f60\u60f3\u67e5\u770b\u7684\u5185\u6838\u6a21\u5757\u540d\u3002\u5982\u679c\u6ca1\u6709\u8f93\u51fa\u7ed3\u679c\uff0c\u5219\u8bf4\u660e\u8be5\u5185\u6838\u6a21\u5757\u5df2\u7ecf\u88ab\u6210\u529f\u5378\u8f7d\u3002<\/p>\n

9.\u907f\u514d\u5e38\u89c1\u9519\u8bef\uff1a\u6ca1\u6709\u6743\u9650\u6216\u8005\u5176\u4ed6\u7a0b\u5e8f\u6b63\u5728\u4f7f\u7528\u8be5\u5185\u6838\u6a21\u5757<\/p>\n

\u5728\u5378\u8f7d\u5185\u6838\u6a21\u5757\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u5e38\u89c1\u9519\u8bef\u3002\u5176\u4e2d\u4e00\u4e2a\u662f“Operation not permitted”\uff08\u6ca1\u6709\u6743\u9650\uff09\u3002\u8fd9\u901a\u5e38\u662f\u56e0\u4e3a\u4f60\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u6765\u6267\u884c\u8be5\u64cd\u4f5c\u3002\u53ef\u4ee5\u4f7f\u7528sudo\u547d\u4ee4\u6216\u8005\u5728root\u7528\u6237\u4e0b\u6267\u884c\u547d\u4ee4\u6765\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n

\u53e6\u4e00\u4e2a\u5e38\u89c1\u9519\u8bef\u662f“Module is in use”\uff08\u8be5\u5185\u6838\u6a21\u5757\u6b63\u5728\u88ab\u4f7f\u7528\uff09\u3002\u8fd9\u901a\u5e38\u662f\u56e0\u4e3a\u5176\u4ed6\u7a0b\u5e8f\u6b63\u5728\u4f7f\u7528\u8be5\u5185\u6838\u6a21\u5757linux \u865a\u62df\u4e3b\u673a\uff0c\u4f8b\u5982\u4e00\u4e9b\u9a71\u52a8\u7a0b\u5e8f\u6216\u8005\u5176\u4ed6\u4f9d\u8d56\u4e8e\u8be5\u5185\u6838\u6a21\u5757\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\u8981\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u53ef\u4ee5\u5148\u505c\u6b62\u4f7f\u7528\u8be5\u5185\u6838\u6a21\u5757\u7684\u7a0b\u5e8f\u6216\u8005\u5378\u8f7d\u4f9d\u8d56\u4e8e\u8be5\u5185\u6838\u6a21\u5757\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u7136\u540e\u518d\u5c1d\u8bd5\u5378\u8f7d\u5185\u6838\u6a21\u5757\u3002<\/p>\n

10.\u603b\u7ed3<\/p>\n

\u672c\u6587\u4ecb\u7ecd\u4e86\u591a\u79cd\u5378\u8f7d\u5185\u6838\u6a21\u5757\u7684\u65b9\u6cd5\uff0c\u5305\u62ec\u4f7f\u7528rmmod\u547d\u4ee4\u3001modprobe\u547d\u4ee4\u3001\u5728\/etc\/modprobe.d\u76ee\u5f55\u4e2d\u6dfb\u52a0\u914d\u7f6e\u6587\u4ef6\u3001\u5728\/etc\/modules\u6587\u4ef6\u4e2d\u6dfb\u52a0\u9700\u8981\u5c4f\u853d\u7684\u5185\u6838\u6a21\u5757\u3001\u5728\/etc\/rc.local\u6587\u4ef6\u4e2d\u6dfb\u52a0\u547d\u4ee4\u3001\u5728blacklist.conf\u6587\u4ef6\u4e2d\u6dfb\u52a0\u9700\u8981\u5c4f\u853d\u7684\u5185\u6838\u6a21\u5757\u4ee5\u53ca\u4f7f\u7528make uninstall\u547d\u4ee4\u7b49\u3002\u540c\u65f6\uff0c\u6211\u4eec\u8fd8\u4ecb\u7ecd\u4e86\u5982\u4f55\u5224\u65ad\u662f\u5426\u6210\u529f\u5378\u8f7d\u5185\u6838\u6a21\u5757\u4ee5\u53ca\u5982\u4f55\u907f\u514d\u4e00\u4e9b\u5e38\u89c1\u9519\u8bef\u3002\u5e0c\u671b\u8fd9\u4e9b\u65b9\u6cd5\u80fd\u591f\u5e2e\u52a9\u8bfb\u8005\u8f7b\u677e\u5b8c\u6210Linux\u5185\u6838\u6a21\u5757\u7684\u5378\u8f7d\u8fc7\u7a0b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u60f3\u8981\u5728Linux\u7cfb\u7edf\u4e2d\u5378\u8f7d\u5185\u6838\u6a21\u5757\u5417\uff1f\u8fd9\u91cc\u63d0\u4f9b\u4e86\u4e00\u4e9b\u9ad8\u6548\u5b9e\u7528\u7684\u65b9\u6cd5\uff0c\u8ba9\u4f60\u8f7b\u677e\u5b8c\u6210\u5378\u8f7d\u8fc7\u7a0b\u3002rmmod\u547d\u4ee4\u662f\u6700\u7b80\u5355\u76f4\u63a5\u7684\u65b9\u6cd5\u4e4b\u4e00\uff0c\u5b83\u53ef\u4ee5\u5feb\u901f\u5378\u8f7d\u5185\u6838\u6a21\u5757\u3002\u53ea\u9700\u8981\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165rmmod\u547d\u4ee4\u548c\u6a21\u5757\u540d\uff0c\u5c31\u53ef\u4ee5\u5b8c\u6210\u5378\u8f7d\u8fc7\u7a0b\u3002\u8981\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u53ef\u4ee5\u5148\u505c\u6b62\u4f7f\u7528\u8be5\u5185\u6838\u6a21\u5757\u7684\u7a0b\u5e8f\u6216\u8005\u5378\u8f7d\u4f9d\u8d56\u4e8e\u8be5\u5185\u6838\u6a21\u5757\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u7136\u540e\u518d\u5c1d\u8bd5\u5378\u8f7d\u5185\u6838\u6a21\u5757\u3002\u5e0c\u671b\u8fd9\u4e9b\u65b9\u6cd5\u80fd\u591f\u5e2e\u52a9\u8bfb\u8005\u8f7b\u677e\u5b8c\u6210Linux\u5185\u6838\u6a21\u5757\u7684\u5378\u8f7d\u8fc7\u7a0b\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-268560","post","type-post","status-publish","format-standard","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/268560","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=268560"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/268560\/revisions"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=268560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=268560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=268560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}