How to Blacklist Kernel Modules in Ubuntu to Prevent Drivers from Loading

During the Ubuntu boot process, the Linux kernel detects your motherboard architecture and peripheral hardware devices, automatically loading the appropriate device drivers as loadable kernel modules (.ko files). While this automatic plug-and-play hardware detection works seamlessly in most scenarios, certain hardware setups suffer from driver conflicts, system freezes, kernel panics, or reduced performance when default open-source drivers load prematurely.

A classic example is installing proprietary NVIDIA graphics drivers, which requires completely disabling the open-source nouveau display module. Similarly, conflicting Wi-Fi drivers, noisy PC speaker beep modules (pcspkr), or unwanted webcam modules must be prevented from initialization. In this guide, you will learn how to inspect loaded kernel modules, create persistent blacklist configuration files, and update your initial ramdisk in Ubuntu.

Why Blacklist a Linux Kernel Module?

Blacklisting kernel modules gives administrators direct control over hardware initialization:

  • Resolves driver conflicts: Prevents competing drivers from claiming the same PCI device or USB interface.
  • Enables clean proprietary driver installation: Stops open-source display drivers from locking GPU framebuffer memory before vendor installers run.
  • Hardens server security: Disables unused legacy protocols and file systems such as FireWire, floppy drives, or rare network protocols.

Step 1: Identify the Loaded Module Name

Before blacklisting a module, verify its exact system identifier using lsmod:

lsmod | grep -i nouveau

To inspect module details, authors, and dependencies, run:

modinfo nouveau

Step 2: Create a Custom Blacklist Configuration File

Ubuntu manages module parameters via configuration files inside /etc/modprobe.d/. Rather than modifying default system files, create a dedicated custom blacklist file:

sudo nano /etc/modprobe.d/blacklist-custom.conf

Add the blacklist directive followed by the exact module name. For example, to prevent the nouveau driver from loading:

# Blacklist open-source Nouveau GPU driver
blacklist nouveau
options nouveau modeset=0

To blacklist additional modules (such as the annoying motherboard buzzer pcspkr or a conflicting Wi-Fi driver), add them on new lines:

blacklist pcspkr
blacklist rtl8188ee

Save the file and exit the text editor by pressing Ctrl + O, Enter, then Ctrl + X.

Step 3: Update the Initial RAM Filesystem (initramfs)

Many critical hardware drivers (including display and storage controllers) are loaded very early during the boot phase from the initial ramdisk (initramfs) before the root filesystem is even mounted. To ensure your new blacklist rules take effect during boot, regenerate the initramfs image:

sudo update-initramfs -u

This process updates the RAM filesystem for your current active kernel release.

Step 4: Reboot and Verify

Restart your Ubuntu system to apply changes:

sudo reboot

Once your machine reboots, run lsmod to verify that the module is no longer running:

lsmod | grep nouveau

If the command returns empty output without error, the module has been successfully blacklisted and will not initialize.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.