Course contentsShow
← Linux
Lesson 1782 of 1,81915. Kernel Concepts for Systems AdministratorsFree lesson

Blacklisting unstable drivers

You will prevent specific modules from loading to avoid system hangs.

In this lesson, you will learn how to prevent specific kernel modules from loading during the boot process to ensure system stability when dealing with problematic drivers.

The Problem of Unstable Drivers

Even in a modular kernel architecture, the kernel’s hardware detection mechanism (often triggered by udev or the initramfs) may automatically probe and load a driver that causes system hangs or crashes. When you identify a specific driver—such as an experimental Wi-Fi card or an outdated graphics module—as the source of your kernel panics, you must explicitly instruct the kernel to ignore it.

Implementing the Blacklist

The most robust way to prevent a module from loading is by using the modprobe blacklist configuration files. These files tell the kernel's module loader that, regardless of hardware detection, the specified driver should never be initialized.

Navigate to /etc/modprobe.d/ and create a configuration file, for instance, blacklist-unstable.conf. Inside this file, use the blacklist directive:

# Prevent the unstable 'nouveau' driver from loading
blacklist nouveau

# Prevent the experimental 'wlan-test' module
blacklist wlan-test

Why This Works

When modprobe attempts to resolve a module request—either during the initial boot sequence or when a device is hot-plugged—it parses these configuration files first. If a module is blacklisted, modprobe effectively returns a "not found" error, preventing the kernel from attempting to link the potentially faulty code into memory.

Note that blacklist only prevents automatic loading. If another module has a hard dependency on the blacklisted module (managed via depmod), the dependency might still force it to load. In such advanced cases, you can combine the blacklist with an alias to /bin/true (or /bin/false) to ensure that even a forced load results in a no-op:

install wlan-test /bin/true

By explicitly blacklisting, you reclaim control over the kernel's initialization path, bypassing hardware auto-detection for specific components that threaten your system's uptime.

Key Takeaway: Use the /etc/modprobe.d/ directory to create permanent blacklist entries that intercept the module loading process, effectively neutralizing unstable drivers before they can trigger a kernel panic.