# How to autoload modules on demand, not boot

## Letharion

Aren't modules supposed to be autoloadable somehow? What do I need to do?

For example:

```
# pon VPN debug dump logfd 2 nodetach 

...

CHAP authentication succeeded

MPPE required, but kernel has no support.

Connection terminated.

# modprobe ppp-mppe

# pon VPN debug dump logfd 2 nodetach 

...

CHAP authentication succeeded

...

MPPE 128-bit stateless compression enabled

...

```

I would have expected the mppe module to be loaded automagically.Last edited by Letharion on Sun Mar 22, 2009 12:30 pm; edited 1 time in total

----------

## yther

Have a look at the files in /etc/modules.autoload.d/   :Smile: 

Sometimes the magic needs a little help.

----------

## Letharion

Hey, yther, thanks  :Smile: 

However:

```
# ls /etc | grep mod

modprobe.conf

modprobe.d

modules.conf

modules.d
```

So I'm not sure how to proceed

----------

## yther

That's curious!  I thought all Gentoo systems had that.  I certainly remember having such a setup for a long time.  On mine, /etc/modules.autoload.d/ has two files in it, kernel-2.4 and kernel-2.6.  Those must have been provided as part of the base layout, because I have never had a 2.4 kernel on this box.

I wonder why you don't have it... different arch or baselayout, perhaps?  Looks like baselayout provides that directory:

```
miharu linux # equery belongs /etc/modules.autoload.d

[ Searching for file(s) /etc/modules.autoload.d in *... ]

sys-apps/baselayout-1.12.11.1 (/etc/modules.autoload.d)
```

Well, assuming your kernel does have support for modules, you could try making /etc/modules.autoload yourself.  See "man modules.autoload" for the really simple details.   :Wink: 

----------

## cyrillic

Baselayout2 uses /etc/conf.d/modules instead for this purpose.

----------

## Letharion

Ah, that's it. I'm on baselayout 2. Thanks guys  :Smile: 

----------

## yther

Ah, so!  I have not yet seen the need to move to baselayout2.   :Smile: 

You learn something every day...

----------

## Letharion

No urgent need until it goes stable  :Smile: 

I'm just the suicidal type  :Wink: 

I always thought that the kind of autoloading we're discussing however, was on boot, not on request.

----------

## Letharion

And it appears to be.

Adding the mppe module to autoload loads it on boot. Not really what I wanted. I'm changing my title to better reflect this.

How do I have the module loaded, when needed?

----------

