在 CentOS 里“禁用 drivers(驱动)”要分几种常见场景,下面按最常用、最安全的方式给你说明。
modprobe -r 驱动名
例如禁用 usb_storage:
modprobe -r usb_storage
⚠️ 若提示 Module is in use,需要先停止使用它的设备。
编辑或新建文件:
vim /etc/modprobe.d/blacklist.conf
添加:
blacklist 驱动名
例如:
blacklist nouveau
blacklist usb_storage
然后更新 initramfs(CentOS 7/8):
dracut --force
重启:
reboot
echo "install 驱动名 /bin/false" >> /etc/modprobe.d/disable.conf
例如:
echo "install usb_storage /bin/false" >> /etc/modprobe.d/disable.conf
lspci -k
echo "0000:xx:xx.x" > /sys/bus/pci/drivers/驱动名/unbind
grubby --args="rd.driver.blacklist=nouveau nouveau.modeset=0" --update-kernel=ALL
然后:
dracut --force
reboot
编辑:
vim /etc/modprobe.d/local.conf
install 驱动名 /bin/true
lsmod
blacklistdracut 重生 initramfslsmod 或 lspci -k如果你能告诉我:
我可以给你精确命令。