HOWTO: Blacklisting kernel module from auto loading in Debian
Purpose: In this post we will how to prevent a kernel module (a.k.a blacklist) from auto loading during Debian Linux start up. You probably are thinking that you already know this (and you might), however there has been some change in recent kernels and you need to use a different method to blacklist a module in Debian.,
Earlier Method (Deprecated)
Say for example you would like to prevent the Linux kernel module, e1000e, from loading. Many people would suggest the following method to blacklist a kernel module
nano /etc/modprobe.d/blacklist.conf
and add the following line:
blacklist e1000e
Save and quit the file.
Now you would think that this method will work, but in fact it does not. I have tried this method with Debian Lenny 5.0 with 2.6.30 kernel and in fact it does not work. I think in more recent kernels (not sure from versions), the above method does not work.
Here is how to prevent auto loading…
Step 1: Find out the module name that you want to prevent
Your first job is to find out the name of the Linux kernel module that you would like to prevent from auto loading by Linux kernel. Here are some methods on how to find out the name of the Linux kernel module for some common/standard hardware that are being current used. I am assuming the module name, e1000e, for this blog post.
Step 2: Create a <module-name>.conf file
nano /etc/modprobe.d/e1000e.conf
and add the following line:
blacklist e1000e
Save and quit the file.
Note that there is also a file called blacklist.conf inside the /etc/modprobe.d/ directory. Do not add the blacklist <module-name> line inside that file. It won’t prevent the module from auto loading. In fact the beginning of that file states the same:
It does not affect autoloading of modules by the kernel. This file is provided by the udev package.
Step 3: Re-generate module dependency file and map
depmod -ae
this will generate a file called “modules.dep” and some map files but we are not going to play with them. This is just for your information.
Step 4: Re-generate your initrd file
The last step is to re-generate your initrd file in the /boot/ directory. This step is only applicable if your system uses initrd file for booting. If you don’t use an initrd then you are done and go to Step 5.
update-initramfs -u -k `uname -r` -v
Step 5: Reboot your system
Finally reboot/restart your system:
shutdown -r now
and check if the module is loading or not by the following command:
lsmod | grep e1000e
The above command should not return anything.
Additional Note:
In the next release of Debian (i.e. Squeeze), I think all the files under /etc/modprobe.d/ directory should have “.conf” as their extension, otherwise those files will be ignored.
Happy Preventing!

Email Subscription









November 4th, 2009 at 8:06 pm
[...] how to prevent auto loading (blacklisting) of Linux kernel module in Debian | Organizing Linux Infor… (tags: linux tips kernel kickstart) [...]
November 15th, 2009 at 9:16 am
This is the (debian) way. I was missing the update-initramfs part. BTW, you go from Step 4 to Step 6.
Thanks!
Reply to this comment
Admin Reply:
November 17th, 2009 at 7:22 pm
Thanks for point that out. I corrected it.
Reply to this comment
December 26th, 2009 at 5:02 pm
Sadly it doesn’t work for me. I need to disable uhci_hcd which works with ‘rmmod uhci-hcd’ and ‘rmmod uhci_hcd’ at the commandline (and in rc.local:) but blacklisting them does not work.
Reply to this comment
February 18th, 2010 at 4:49 am
Thankyou very much!!
Reply to this comment
July 19th, 2010 at 3:26 pm
[...] Hi and welcome to LQ. This should help you. http://linux.koolsolutions.com/2009/10/11/…ing-in-debian/ [...]
July 28th, 2010 at 12:51 pm
Thank you so much I have been banging my head against this and yelling in the lab at work
Reply to this comment
August 29th, 2010 at 10:31 pm
[...] I found this: http://linux.koolsolutions.com/2009/10/11/…ing-in-debian/ And it works. [...]