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.

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 5 comments… read them below or add one }

1 Béranger 06.14.07 at 6:30 am

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

2 Erik Bussink 06.14.07 at 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 ?

3 vivek 06.15.07 at 10:34 am

You need to add following drivers
usbcore
ehci_hcd
uhci_hcd

lsmod and modinfo command always gives information about loaded drivers.

4 Prakash 08.31.07 at 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

5 MotoHoss 07.15.08 at 9:57 pm

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

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post: Shell du command tip – estimate file space usage and exclude particular files

Next post: Troubleshooting tip: Lan card (NIC) ordering changed after upgrading to Redhat (RHEL) Linux 4.5