≡ Menu

Howto: Prevent a Linux kernel module from auto loading

In some situation you may want to avoid loading a Linux driver module automatically . For example:
[a] You would like to use proprietary device driver (I’m against any sort of proprietary drivers) and not inbuilt (reverse engineer) kernel driver.

[b] If your server system connected without a diskette / floppy drive; kernel will try to load floppy driver – disable floppy driver or module.

[c] In some cases buggy driver causes kernel BUG on load so you just want to avoid the problem.

The Linux kernel get module information from /etc/modprobe.conf file and /etc/modprobe.d/* file(s).

If you are using CentOS/Redhat/RHEL/Fedora Linux…

Just open your /etc/modprobe.conf file and turn of auto loading using following syntax:
alias driver-name off

If you are using Debian / Ubuntu Linux…

open /etc/modprobe.d/blacklist file and add drivername using following syntax:
blacklist driver-name

Reboot your box and use lsmod command to show the status of modules in the Linux Kernel.

Share this on:
{ 12 comments… add one }
  • Béranger June 14, 2007, 6:30 am

    Blacklisting in /etc/modprobe.d/blacklist works in F7 too, not only in Debian!

  • Erik Bussink June 14, 2007, 7:04 pm

    On a similar path, how would you go about disabling USB without having to add nousb on the kernel settings line in GRUB ?

  • nixCraft June 15, 2007, 10:34 am

    You need to add following drivers

    lsmod and modinfo command always gives information about loaded drivers.

  • Prakash August 31, 2007, 8:57 pm

    the method is if nothing works in debian based distros to blacklist a certain module,try making a file /etc/modprobe.d/00local with content as
    install modulename /bin/true

  • MotoHoss July 15, 2008, 9:57 pm

    The debian way? An update has been written and is available here : http://wiki.debian.org/KernelModuleBlacklisting

  • Ravi J December 29, 2009, 7:53 pm

    I am unable to stop kvm, kvm_intel from getting loaded even after adding those to blacklist (Ubuntu 9.10).

  • Dhananjay March 1, 2011, 1:19 pm

    Thanks a lot.

  • 0xA00A July 13, 2011, 9:35 am

    on fedora 15 you do:
    sudo gedit /etc/modprobe.d/blacklist.conf
    blacklist driver-name

  • Riccardo September 1, 2011, 7:22 pm

    On Suse is like fedora 15:

    sudo gedit /etc/modprobe.d/blacklist.conf
    blacklist driver-name

  • Gary October 14, 2011, 8:46 pm

    alias driver-name off does nto work on CentOS 5.5

  • nathan April 21, 2012, 8:55 pm

    OpenSuse 11.4 can only mount one type of filesystem ‘ISO9660’ . What is my problem?
    Thank you

  • cristian February 4, 2013, 5:30 pm

    How I can do to join the blacklist all except driver being used. thanks. cristian

Security: Are you a robot or human?

Leave a Comment