Howto: Prevent a Linux kernel module from auto loading

by Vivek Gite on June 13, 2007 · 10 comments

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.

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

We're here to help you make the most of sysadmin work. So, subscribe!

{ 10 comments… read them below or add one }

1 Béranger June 14, 2007

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

Reply

2 Erik Bussink June 14, 2007

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

Reply

3 vivek June 15, 2007

You need to add following drivers
usbcore
ehci_hcd
uhci_hcd

lsmod and modinfo command always gives information about loaded drivers.

Reply

4 Prakash August 31, 2007

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

Reply

5 MotoHoss July 15, 2008

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

Reply

6 Ravi J December 29, 2009

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

Reply

7 Dhananjay March 1, 2011

Thanks a lot.

Reply

8 0xA00A July 13, 2011

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

Reply

9 Riccardo September 1, 2011

On Suse is like fedora 15:

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

Reply

10 Gary October 14, 2011

alias driver-name off does nto work on CentOS 5.5

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 5 + 6 ?
Please leave these two fields as-is:
Are you a human being? Solve the simple math so we know that you are a human and not a bot.



Previous post:

Next post: