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

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
jimmij
Tux's lil' helper
Tux's lil' helper


Joined: 02 Dec 2008
Posts: 143

PostPosted: Sat Jul 21, 2012 1:01 pm    Post subject: How to prevent autoloading modules? Reply with quote

I have several modules (eg. uvcvideo, wl) which I do not want to be loaded on startup.
The problem is that they are loading anyway and I cannot figure out who to blame.
They are pulled from /lib/modules, but not all modules from there are loaded, eg. vboxdrv, vboxnetflt behaves normally.
I'm confused.
/etc/conf.d/modules is empty
Perhaps some init script calls them?
Code:

$> rc-update show
            alsasound | boot                                         
             bootmisc | boot                                         
          consolefont | boot                                         
                 dbus |      default                                 
                devfs |                                        sysinit
        device-mapper | boot                                         
               dhcpcd | boot                                         
                dmesg |                                        sysinit
                 fsck | boot                                         
                  gpm |      default                                 
             hostname | boot                                         
              hwclock | boot                                         
              keymaps | boot                                         
            killprocs |                        shutdown               
           lm_sensors |      default                                 
                local |      default nonetwork                       
           localmount | boot                                         
              modules | boot                                         
             mount-ro |                        shutdown               
                 mtab | boot                                         
             net.eth0 |      default                                 
               net.lo | boot                                         
               procfs | boot                                         
                 root | boot                                         
            savecache |                        shutdown               
                 swap | boot                                         
               sysctl | boot                                         
            syslog-ng |      default                                 
         termencoding | boot                     


kernel: 3.3.8-gentoo
_________________
Vanitas vanitatum et omnia vanitas.
Libera temet ex inferis.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sat Jul 21, 2012 2:16 pm    Post subject: Reply with quote

jimmij ...

simply add the modules to /etc/modprobe.d/blacklist.conf eg:

Code:
blacklist bluetooth

best ... khay
Back to top
View user's profile Send private message
jimmij
Tux's lil' helper
Tux's lil' helper


Joined: 02 Dec 2008
Posts: 143

PostPosted: Sat Jul 21, 2012 4:24 pm    Post subject: Reply with quote

Yes... this is some solution, but I would prefer to understand what is going on. :roll:
_________________
Vanitas vanitatum et omnia vanitas.
Libera temet ex inferis.
Back to top
View user's profile Send private message
Gusar
Advocate
Advocate


Joined: 09 Apr 2005
Posts: 2665
Location: Slovenia

PostPosted: Sat Jul 21, 2012 4:57 pm    Post subject: Reply with quote

It's the magic of hardware detection. The kernel knows you have a webcam, so it loads the appropriate module. Well, it's actually udev that loads the module, but because the kernel has told it a webcam is there. Now, before you ask why virtualbox modules aren't loaded automatically... well, virtualbox isn't a hardware device, so the kernel/udev combo that works for those can't work for virtualbox.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sat Jul 21, 2012 6:06 pm    Post subject: Reply with quote

jimmij wrote:
Yes... this is some solution, but I would prefer to understand what is going on.

jimmij ... you didn't ask for a tutorial but "how to prevent autoloading modules" and I answered that question, so "eyerolls".

khay
Back to top
View user's profile Send private message
jimmij
Tux's lil' helper
Tux's lil' helper


Joined: 02 Dec 2008
Posts: 143

PostPosted: Sat Jul 21, 2012 8:26 pm    Post subject: Reply with quote

Gusar wrote:
It's the magic of hardware detection. The kernel knows you have a webcam, so it loads the appropriate module. Well, it's actually udev that loads the module, but because the kernel has told it a webcam is there.

Oh, I see, that makes sense...
So another question: how can I politely ask udev and/or kernel to not load any modules without my explicit order?
I hope there is better (more general) rule than adding them one by one to the blacklist.
_________________
Vanitas vanitatum et omnia vanitas.
Libera temet ex inferis.
Back to top
View user's profile Send private message
Gusar
Advocate
Advocate


Joined: 09 Apr 2005
Posts: 2665
Location: Slovenia

PostPosted: Sat Jul 21, 2012 8:45 pm    Post subject: Reply with quote

jimmij wrote:
So another question: how can I politely ask udev and/or kernel to not load any modules without my explicit order?

I'm not aware of anything, as that's kinda the point of udev. You could not use udev, but honestly, that's way more hassle than simply creating a few blacklist entries.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6780

PostPosted: Sun Jul 22, 2012 6:49 am    Post subject: Reply with quote

Gusar wrote:
that's way more hassle than simply creating a few blacklist entries.

I suppose that blacklist entries will prevent you from loading the module later manually.
I think the clean way is to put your own udev rule for the corresponding device in /etc/udev/rules.d which does nothing but to stop the later rules from being run. (I do not remember without reading the udev documentation how this is done, but I remember that this is possible)
Back to top
View user's profile Send private message
olek
Apprentice
Apprentice


Joined: 22 Oct 2011
Posts: 173

PostPosted: Sun Jul 22, 2012 8:40 am    Post subject: Reply with quote

@mv
You are able to load them manually, blacklisted modules just don't get auto-loaded.
_________________
https://plaintext.blog
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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