How do I stop a Linux kernel module from loading automatically?

Posted on in Categories Debian Linux, Gentoo Linux, Howto, Linux, RedHat/Fedora Linux last updated March 30, 2006

A module (device driver) is causing Linux server to hang, so we replace Ethernet card with Intel LAN card. The old module still gets loaded. It is causing problem. So I decided to turn off module forever (I am not going to recompile kernel to get rid of this shity module).

The Linux kernel v2.6.xx queries /etc/modules.conf file to load modules for hardware device (old 2.4.xx version uses /etc/modprobe.conf file). If you are using Debian Linux look for /etc/modutils/aliases file.

Just locate name of module and turn it off using following syntax (or add/append line):
alias modulename off

Example
Open file /etc/modules.conf or /etc/modprobe.conf (RHEL 4/5) file:
# vi /etc/modules.conf
Now turn off 8139too module:
alias 8139too off
Read man page of update-modules.modutils/update-modules for more information. I am not sure what to do on Sun Solaris box if such situation popups. If anyone has more info/idea about Sun Solaris UNIX, please add in comments!

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

2 comment

  1. Using Fedora 8 (with upgrades) this does not work. The module loads regardless, when I try to unload it manually, I got a message about not having a module “off” or some such. I’ve also tried removing the alias and adding an install command to remove the module during installation, but that didn’t work either. If you have anymore suggestions, I’d like to hear ’em.

    – Mike

Leave a Comment