Lnx*_*lck 48
Note: blacklisting will not work for modules which are built into the kernel image (i.e. not loaded via a separate
.ko
file. The only way to disable such modules is via a kernel parameter (if available) or by recompiling the kernel.
Just open your /etc/modprobe.d/blacklist
file and add drivername using following syntax:
blacklist driver-name
Run Code Online (Sandbox Code Playgroud)
EDIT: In later versions since 12.10 (12.04?) the file is /etc/modprobe.d/blacklist.conf
Reboot your box and use lsmod command to show the status of modules in the Linux Kernel
Note: here driver-name
is the name of your desired blacklist driver. For example, If you wanted to disable the NIC card driver, you can find the name of kernel driver for your LAN card by using the command lspci -v
command in a terminal.
For Example my output was :
........ ........ 6:00.0 Ethernet controller: Broadcom Corporation NetLink BCM5906M Fast Ethernet PCI Express (rev 02) Subsystem: Lenovo Device 3861 Flags: bus master, fast devsel, latency 0, IRQ 46 Memory at b8000000 (64-bit, non-prefetchable) [size=64K] Expansion ROM at [disabled] Capabilities: Kernel driver in use: tg3 Kernel modules: tg3 ........ ........
Here, I see the driver is tg3
. so you need to write tg3
(or your driver) in the place of driver-name
.
Plenty of info can be found here.
Pan*_*her 29
您还可以在使用语法启动时在 grub 命令行(linux 行)上临时将它们列入黑名单
module_to_blacklist.blacklist=yes
Run Code Online (Sandbox Code Playgroud)
小智 16
在至少 Ubuntu 16.04 LTS 中将模块列入黑名单的另一种方法是将以下行添加到内核命令行:
modprobe.blacklist=MODULE_NAME
Run Code Online (Sandbox Code Playgroud)
使用 /etc/modprobe 系统是最好的方法,但这是一种替代方法,可以通过在启动时编辑 GRUB 命令行来紧急使用。
这也可以通过编辑 /etc/default/grub 并添加到GRUB_CMDLINE_LINUX_DEFAULT
变量来永久化。例如,在我的 /etc/default/grub 中,我有:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash modprobe.blacklist=nouveau"
Run Code Online (Sandbox Code Playgroud)
然后我跑update-grub2
,然后update-initramfs -u
。重新启动后,您将摆脱该模块,只要启动后没有加载它。
此方法也适用于 EL 变体(RHEL、CentOS、SciLinux),但您必须使用该发行版的方法来更新 grub 和 initrd。
(注意那些试图将 nouveau 列入黑名单的人:确保不要通过运行加载 X systemctl set-default multi-user.target
,否则当 X 启动时它会再次加载 nouveau!)
小智 5
在最近的版本中,您需要在黑名单文件中使用 install 指令
install modulename /bin/false
Run Code Online (Sandbox Code Playgroud)
将上面的“modulename”替换为模块的名称。这将强制阻止其加载。
您可以在 modprobe.conf 的手册中找到有关安装指令的更多信息
man modprobe.conf
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
249894 次 |
最近记录: |