• Альбом - подарок первокласснику (№ 5)

  • Злые сестры

  • Oct.11, 2009 in Drivers, HOWTO, Kernel, Linux

    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 .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 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!

  • Альбом - подарок первокласснику (№ 5)

  • Злые сестры