Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to prevent loading of some modules?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Dr. Arbeitslos
Apprentice
Apprentice


Joined: 13 Aug 2005
Posts: 152

PostPosted: Tue Apr 10, 2007 8:23 am    Post subject: How to prevent loading of some modules? Reply with quote

hi,

if my comp starts up, some modules are loaded autoamatically ( by kernel itself or udev or...? ).
is there a way to prevent this for designated modules? e.g. "evbug" is loaded by udev (it announces it) and spams my /var/log/messages all the time.
I know how to remove it from kernel configuration, but that is not what i'm asking for (maybe I need it in future).
I also know how to load modules that are not loaded automatically (by /etc/modules.autoload.d/kernel-2.6), but is there also a way for the opposite (preventing modules from automatic loading)?

thanks for your help.
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Tue Apr 10, 2007 8:44 am    Post subject: Reply with quote

Use /etc/modprobe.d/blacklist
Code:
# Used to stop udev from loading modules.
# http://bugs.gentoo.org/show_bug.cgi?id=130766
# Run "modules-update" after changing.

blacklist evbug


Edit: Fixed my confusion over modules and modprobe :)


Last edited by PaulBredbury on Tue Apr 10, 2007 11:05 am; edited 1 time in total
Back to top
View user's profile Send private message
Dr. Arbeitslos
Apprentice
Apprentice


Joined: 13 Aug 2005
Posts: 152

PostPosted: Tue Apr 10, 2007 10:44 am    Post subject: Reply with quote

Thank you PaulBredbury.

after reading

https://bugs.gentoo.org/show_bug.cgi?id=130766

and googling a bit it seems blacklisting is now done inside

/etc/modprobe.d/blacklist.

both files are working for me, but modules-update after adding /etc/modules.d/blacklist gave me an error message (and worked anyway).
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Tue Apr 10, 2007 11:10 am    Post subject: Reply with quote

You're right about modprobe.d

To fix the silly error message:
Code:
$ modules-update
 * Updating /etc/modprobe.conf ...
 * Warning: could not generate /etc/modprobe.conf!                        [ !! ]
 * Updating /etc/modprobe.conf by hand ...
 * Warning: could not generate /etc/modprobe.conf!                        [ !! ]
 * Updating modules.dep ...                                               [ ok ]

Run:
Code:
cd /etc
mv modules.conf modules.conf-bak
mv modprobe.conf modprobe.conf-bak
modules-update
Back to top
View user's profile Send private message
dch24
Tux's lil' helper
Tux's lil' helper


Joined: 15 Feb 2007
Posts: 99

PostPosted: Wed Jul 11, 2007 11:06 pm    Post subject: Reply with quote

This post describes the difference between 'blacklist' and what you are trying to do:
Joey Hess wrote:
Package: module-init-tools
Version: 3.3-pre11-1
Severity: normal

If you look up "module blacklist" or "modprobe blacklist" or "udev
blacklist" in google, the results are various and mostly wrong,
outdated, or distro-specific.

modprobe.conf(5)'s docuentation of the blacklist command is ok, but
still leaves open the question of how to really blacklist a module so
modprobe won't load it at all.

Expecting a regular user to read the documentation of the install
command and think of "install module /bin/true" as the way to turn off
loading of a module is probably expecting too much of many users. It's
even expecting too much of some developers; I did not make this
connection on my first or second reading of the man page, and did not
think of it until I saw it mentioned on the web[1].

Since module-init-tools has a FAQ, I thought it might help to document
how to blacklist a module there.

Something like:

Code:
Q) How do I prevent udev or modprobe from loading a module?
A) Putting this in a file in /etc/modprobe.d/ will guarantee that modprobe
   never loads a module (in this case the PC speaker driver), but it not
   necessarily the best approach in all circumstances:

   install pcspkr /bin/true

   If there are two modules that can both support the same device, and
   the wrong module is being used, the above won't help; it will prevent
   the wrong module from being loaded, but will not load the correct
   module. In this case, you should instead use the blacklist command:

   blacklist eepro100

   This will prevent the older eepro100 module from being used, and
   allow the newer e100 module to be loaded instead.

   See the modprobe.conf(5) man page for details.


If you add this you might also want to add a pointer to it to
/etc/modprobe.d/blacklist

--
see shy jo

[1] http://www.beranger.org/index.php?page=3k&fullarticle=2256
Currently the 20th hit for "udev blacklist"

In other words, this will disable it at the modprobe level. (Then when you want to use it, just add a # to comment out the line, and run update-modules and modprobe it in. Not exactly what you wanted, but ...)

There's a good discussion in the bug #130766 thread about using /etc/conf.d/rc to disable services (so the modules are still loaded but the service doesn't get started) and about the security hole opened by autoloading evbug. The bug is closed because "Comment #46 From Matthias Schwarzott 2007-02-13 00:16:10 0000 [reply] udev-104-r11 (and -r10) implement the wrapper-based blacklisting, by using the blacklist-lines from modprobe.conf" but I have not seen documentation or an example of how this works.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum