# stop modules from being loaded at boot up

## Geddy Leon

Dell precision laptop, kernel version 2.6.29.4, when machine boots up, lsmod says:

```

~ # lsmod

Module                  Size  Used by

nvidia               8120776  22 

sdhci_pci               8392  0 

e1000e                128536  0 

sdhci                  17292  1 sdhci_pci

wl                   1266116  0 

```

Who loaded these ? Was it udev? or the /etc/init.d/modules script ? something else ?  If it was udev, what rules file does this... I looked but couldn't make sense of what was going on there... "wl" (wireless driver) and "sdhc"i & "sdhci_pci" (sd card reader) I only use sometimes, I don't want them to be loaded when the machine boots up... I want to be able to modprobe them myself, when I need them.  

My /etc/modules.autoload.d/kernel-2.6 file is empty

There is the file /etc/modprobe.d/nvidia.conf with some options for the nvidia driver, does that mean anything ? /etc/modules.conf and the /etc/modules.d dir do not have anything that looks like it would configure these particular modules to be loaded.

there are lots of modules in /lib/modules/2.6.29.4, why are only those picked to be loaded on boot up by whoever is doing it ?

```

~ # find /lib/modules/2.6.29.4/ -type f -iname '*.ko' 

/lib/modules/2.6.29.4/kernel/arch/x86/oprofile/oprofile.ko

/lib/modules/2.6.29.4/kernel/lib/crc7.ko

/lib/modules/2.6.29.4/kernel/lib/crc-ccitt.ko

/lib/modules/2.6.29.4/kernel/lib/crc16.ko

/lib/modules/2.6.29.4/kernel/drivers/hid/hid-dummy.ko

/lib/modules/2.6.29.4/kernel/drivers/mmc/host/sdhci-pci.ko

/lib/modules/2.6.29.4/kernel/drivers/mmc/host/sdhci.ko

/lib/modules/2.6.29.4/kernel/drivers/video/backlight/lcd.ko

/lib/modules/2.6.29.4/kernel/drivers/scsi/scsi_wait_scan.ko

/lib/modules/2.6.29.4/kernel/drivers/net/wireless/b43/b43.ko

/lib/modules/2.6.29.4/kernel/drivers/net/wireless/zd1211rw/zd1211rw.ko

/lib/modules/2.6.29.4/kernel/drivers/net/wireless/b43legacy/b43legacy.ko

/lib/modules/2.6.29.4/kernel/drivers/net/ppp_generic.ko

/lib/modules/2.6.29.4/kernel/drivers/net/ppp_synctty.ko

/lib/modules/2.6.29.4/kernel/drivers/net/mii.ko

/lib/modules/2.6.29.4/kernel/drivers/net/e1000e/e1000e.ko

/lib/modules/2.6.29.4/kernel/drivers/net/usb/usbnet.ko

/lib/modules/2.6.29.4/kernel/drivers/net/usb/asix.ko

/lib/modules/2.6.29.4/kernel/drivers/net/usb/cdc_ether.ko

/lib/modules/2.6.29.4/kernel/drivers/net/slhc.ko

/lib/modules/2.6.29.4/kernel/drivers/net/pppox.ko

/lib/modules/2.6.29.4/kernel/drivers/net/pppoe.ko

/lib/modules/2.6.29.4/kernel/drivers/net/ppp_async.ko

/lib/modules/2.6.29.4/kernel/drivers/char/i8k.ko

/lib/modules/2.6.29.4/kernel/drivers/ssb/ssb.ko

/lib/modules/2.6.29.4/kernel/fs/reiserfs/reiserfs.ko

/lib/modules/2.6.29.4/kernel/fs/jbd2/jbd2.ko

/lib/modules/2.6.29.4/kernel/fs/ext4/ext4.ko

/lib/modules/2.6.29.4/video/nvidia.ko

/lib/modules/2.6.29.4/net/wireless/wl.ko

```

any info on how i can sort this out appreciated... ideally lsmod should be empty right after boot up, i get to load modules as I see fit... thanks

----------

## sebaro

```
rc-update -s
```

----------

## cyrillic

 *Geddy Leon wrote:*   

> ideally lsmod should be empty right after boot up, i get to load modules as I see fit... 

 

KMOD - The kernel's module loader is responsible for what you are seeing.

In older kernel versions, CONFIG_KMOD could be turned off, now it is on by default.

If you want to break kernel module loading, you could always move your modules to a nonstandard location, and load them later with insmod and the full path.

----------

## Geddy Leon

Thanks for the suggestions... it is udev after all, it is reading the files /lib/modules/2.6.29.4/modules.alias and /lib/modules/2.6.29.4/modules.alias.bin.

Moving these files out stops the loading on bootup, and modprobe still works without having to give the full path.

Will wait another day or so to make sure everything is still working before marking this as solved.

----------

## code_raptor

Why dont just blacklist those modules from loading at startup instead? that way you dont have to delete those files

```
echo "blacklist <module_name>" >> /etc/modprobe.d/blacklist

update-modules

```

----------

## Geddy Leon

should it be "/etc/modprobe.d/blacklist.conf", or "/etc/modprobe.d/blacklist"  ??

also, just wondering what exactly is the definition of "coldplugging" and how is that different from "hotplugging"/"hotplug events" ??

----------

## ppurka

I don't remember how it is on baselayout-1. On baselayout-2, if you blacklist a module, then the module will not be autoloaded when the need arises. For example, if you blacklist usbhid and later you plug in a usb mouse receiver, then the kernel will not automatically load the module. You will need to explicitly modprobe the module. This can be a big disadvantage if you want a plug-and-play behaviour.

----------

## Geddy Leon

yes, the same is true when removing the /lib/modules/2.6.29.4/modules.alias and /lib/modules/2.6.29.4/modules.alias.bin files as I have been doing.

is there a solution that will not load on boot up but still do automatic loading when the need arises ?

that would be best, for sure.

----------

## ppurka

 *Geddy Leon wrote:*   

> yes, the same is true when removing the /lib/modules/2.6.29.4/modules.alias and /lib/modules/2.6.29.4/modules.alias.bin files as I have been doing.
> 
> is there a solution that will not load on boot up but still do automatic loading when the need arises ?
> 
> that would be best, for sure.

 I myself wanted such a solution, but I don't think there is.

----------

## Captain Newbie

 *ppurka wrote:*   

>  *Geddy Leon wrote:*   yes, the same is true when removing the /lib/modules/2.6.29.4/modules.alias and /lib/modules/2.6.29.4/modules.alias.bin files as I have been doing.
> 
> is there a solution that will not load on boot up but still do automatic loading when the need arises ?
> 
> that would be best, for sure. I myself wanted such a solution, but I don't think there is.

 

Demand loading (and unloading) is a neat idea indeed...some bright spark should work on that.

----------

## cyrillic

 *Captain Newbie wrote:*   

> Demand loading (and unloading) is a neat idea indeed...some bright spark should work on that.

 

Demand loading (and unloading) already works, and is enabled by default.

This whole thread is about making it not work.

----------

## dmpogo

 *cyrillic wrote:*   

>  *Captain Newbie wrote:*   Demand loading (and unloading) is a neat idea indeed...some bright spark should work on that. 
> 
> Demand loading (and unloading) already works, and is enabled by default.
> 
> This whole thread is about making it not work.

 

demand unloading is probably not working anymore. Used to be in the last century.

----------

