Blacklisting
Blacklisting, in the context of kernel modules, is a mechanism to
prevent the kernel module from loading. This could be useful if, for
example, the associated hardware is not needed, or if loading that
module causes problems: for instance there may be two kernel modules
that try to control the same piece of hardware, and loading them
together would result in a conflict.
Some modules are loaded as part of the initramfs. mkinitcpio -M
will
print out all automatically detected modules: to prevent the initramfs
from loading some of those modules, blacklist them in
/etc/modprobe.d/modprobe.conf. Running mkinitcpio -v
will list all
modules pulled in by the various hooks (e.g. filesystems hook, block
hook, etc.). Remember to add that .conf file to the FILES section in
/etc/mkinitcpio.conf, if you have not done so already, and rebuild the
initramfs once you have blacklisted the modules, and reboot
afterwards.
Using files in /etc/modprobe.d/
Create a .conf file inside /etc/modprobe.d/ and append a line for each
module you want to blacklist, using the blacklist keyword. If for
example you want to prevent the pcspkr module from loading:
/etc/modprobe.d/nobeep.conf
# Do not load the 'pcspkr' module on boot.
blacklist pcspkr
Note: The blacklist command will blacklist a module so that it will
not be loaded automatically, but the module may be loaded if another
non-blacklisted module depends on it or if it is loaded manually.
However, there is a workaround for this behaviour; the install command
instructs modprobe to run a custom command instead of inserting the
module in the kernel as normal, so you can force the module to always
fail loading with:
/etc/modprobe.d/blacklist.conf
...
install module_name /bin/false
...
This will effectively blacklist that module and any other that depends
on it.
sudo modprobe -r uvcvideo
时,您会得到什么结果? - jobin/etc/modprobe.d
目录下。它还包含用于屏蔽蓝牙模块的条目。这样设置是有效的,所以该文件会被解释执行。 - Marc Hauptmann