Skip to content

How to Disable and Blacklist a Linux Kernel Module

Updated 2 min read

Updated: 28 September 2026 · Applies to: kmod 28 to 31 with dracut or initramfs-tools on AlmaLinux and Rocky Linux 9 and 10, RHEL 9 and 10, Ubuntu 24.04 and 26.04, Debian 13

Sometimes a kernel module must never load: a driver that crashes the machine, a feature you do not want (for example the floppy or usb-storage driver on a server), or one that conflicts with a vendor driver (such as nouveau with the NVIDIA driver). A reliable block has three parts: the blacklist entry, a line that stops other modules from loading it, and a rebuilt initramfs.

Steps

  1. Check whether it is loaded now: lsmod | grep -w floppy
  2. Create /etc/modprobe.d/blacklist-floppy.conf:
    blacklist floppy
    install floppy /bin/false
    blacklist stops automatic loading when the hardware is detected. The install line makes any attempt to load it, including as a dependency of another module, run /bin/false instead.
  3. Rebuild the initramfs, so the block also applies early in the boot process:
    dracut -f                  # AlmaLinux, Rocky Linux, RHEL
    update-initramfs -u        # Ubuntu, Debian
  4. Unload it now, if it is loaded: modprobe -r floppy (or reboot).
  5. Check after the next reboot: lsmod | grep -w floppy should print nothing, and modprobe floppy should fail.

Emergency: block it from the boot menu

If the module crashes the server during boot, you cannot log in to create the file. In the GRUB menu, edit the boot entry (see how to change GRUB kernel parameters before booting) and add to the kernel line:

modprobe.blacklist=floppy rd.driver.blacklist=floppy

rd.driver.blacklist applies to the dracut initramfs on AlmaLinux, Rocky Linux and RHEL. Once the system is up, make the block permanent with the steps above.

Undo

Delete the file in /etc/modprobe.d/, rebuild the initramfs again, and load the module with modprobe floppy.

Common problems

  • The module still loads: it is built into the kernel (modinfo floppy says "builtin"), which cannot be blacklisted, or the initramfs was not rebuilt.
  • The name does not match: use the name lsmod shows; dashes and underscores are treated the same by modprobe.

For loading modules and setting options, see the beginners guide to kernel module configuration.

Official documentation: modprobe.d manual page and dracut.cmdline manual page.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Linux server management

hardening, patching, monitoring and automation for Ubuntu, Debian, RHEL and AlmaLinux.

Was this answer helpful?

Still stuck? Open a ticket