How do you blacklist a kernel module?
IntermediateConceptBoot Process & Kernel
Answer
In one line: To blacklist a kernel module means to stop it from loading automatically. You do it with a config file in /etc/modprobe.d/.
Example — stop the nouveau graphics driver (common before installing NVIDIA drivers on a GPU server):
echo "blacklist nouveau" | sudo tee /etc/modprobe.d/blacklist-nouveau.conf
sudo update-initramfs -u # Ubuntu/Debian — also update the initramfs
sudo dracut -f # RHEL/Rocky
sudo reboot
Important detail: blacklist only stops automatic loading. The module can still load if another module needs it or someone runs modprobe manually. To block it completely:
echo "install usb-storage /bin/false" | sudo tee /etc/modprobe.d/no-usb-storage.conf
This makes any attempt to load usb-storage run /bin/false instead, so the module never loads — a common security hardening step to block USB drives on servers.
Check it worked: after a reboot, lsmod | grep nouveau should print nothing.
More on Boot Process & Kernel
Walk through the Linux boot process from power-on to login prompt.BeginnerWhat is the difference between BIOS and UEFI booting?IntermediateWhat does GRUB2 do and where is its configuration?BeginnerWhat is the initramfs and why is it needed?AdvancedHow do you view and change kernel command-line parameters?IntermediateWhat is systemd and why did it replace SysV init?Beginner