# Modules not autoloading need help badly

## Apewall

After rebooting from a normal session of linux (without alterring any of the system config files) linux has stopped loading modules from my /etc/modules.autoload.d/kernel-2.6

It boots everything else normally but ignores the modules listed in the autoload.

```
/etc/modules.autoload.d/kernel-2.6

sk98lin

usbhid

ehci-hcd

uhci-hcd
```

I am able to modprobe each of these individually so they are all still working, it simply doesnt TRY to load them when booting.

ANY suggestions? Never ran into this problem before.

----------

## troymc

Is /etc/init.d/modules in a runlevel?

rc-update add modules boot

troymc

----------

## Apewall

Yes it is already on runlevel and listed in lsmod when in session.

----------

## mirojira

Is /etc/init.d/modules linked  in /etc/runlevels/boot ?

```

# ls -l /etc/runlevels/boot/modules

lrwxrwxrwx 1 root root 19 Jun  5 14:28 /etc/runlevels/boot/modules -> /etc/init.d/modules

```

----------

## Apewall

```
# ls -l /etc/runlevels/boot/modules 

lrwxrwxrwx 1 root root 19 Jun  5 14:28 /etc/runlevels/boot/modules -> /etc/init.d/modules
```

link seems to be correct.

could someone post me their /etc/init.d/modules I'd like to compare.

----------

## jeanck

This's mine:

```

#!/sbin/runscript

# Copyright 1999-2005 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

depend() {

   need checkroot hostname

   use isapnp

}

load_modules() {

   local x=

   local i=0

   local retval=0

   local modules=

   local modargs=

   local modcount=0

   local config="$1"

   [ -z "${config}" ] && return 0

   [ ! -r "${config}" ] && return 0

   # Loop over every line in $config

   eval $(awk '

      BEGIN {

         COUNT = 0 # Make sure COUNT is set

      }

      $0 !~ /(^[[:space:]]*(#|$))/ {

         if (MODULES == "")

            MODULES = $1

         else

            MODULES = MODULES " " $1

         

         # Not the greatest method to remove $1 from $0, but it works

         sub(/^[[:space:]]*[^[:space:]]*[[:space:]]*/, "")

         ARGS[COUNT] = $0

         COUNT++

      }

      

      END {

         # 'eval' will make sure these are set to proper bash variables

         print "modcount=" COUNT

         print "modules=\"" MODULES "\""

         for (x = 0;x < COUNT;x++)

            print "modargs[" x "]=\"" ARGS[x] "\""

      }

   ' "${config}")

   if [ "${modcount}" -gt 0 ]

   then

      einfo "Using ${config} as config:"

      

      for x in ${modules}

      do

         ebegin "  Loading module ${x}"

         modprobe -q ${x} ${modargs[${i}]} &>/dev/null

         retval=$?

         eend ${retval} "  Failed to load ${x}"

         

         i=$((i+1))

         [ "${retval}" -eq 0 ] || modcount=$((modcount-1))

      done

      einfo "Autoloaded ${modcount} module(s)"

   fi

   return 0

}

start() {

   local KV=$(uname -r)

   local KV_MAJOR=$(KV_major "${KV}")

   local KV_MINOR=$(KV_minor "${KV}")

   local KV_MICRO=$(KV_micro "${KV}")

   # Should not fail if kernel do not have module

   # support compiled in ...

   [ -f /proc/modules ] || return 0

   if [ -z "${CDBOOT}" ] && touch /etc/modules.conf 2> /dev/null

   then

      ebegin "Calculating module dependencies"

      /sbin/modules-update

      eend $? "Failed to calculate module dependencies"

   fi

   local autoload=""

   if [[ -f /etc/modules.autoload && ! -L /etc/modules.autoload ]]; then

      autoload=/etc/modules.autoload

   else

      local x

      for x in "${KV}" ${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} ${KV_MAJOR}.${KV_MINOR} ; do

         if [[ -f /etc/modules.autoload.d/kernel-"${x}" ]] ; then

            autoload="/etc/modules.autoload.d/kernel-${x}"

            break

         fi

      done

   fi

   [[ -n ${autoload} ]] && load_modules "${autoload}"

   #

   # Just in case a sysadmin prefers generic symbolic links in

   # /lib/modules/boot for boot time modules we will load these modules

   #

   if [ -n "$(modprobe -l -t boot)" ]

   then

      modprobe -a -t boot \*  &>/dev/null

   fi

}

# vim:ts=4

```

Good luck,

Jeanck

----------

## Apewall

Bah, this is driving me insane.

etc/init.d/modules is intact and fine, i see no logical reason why its doing this.

Its booting the "modules" up from rc as it shows up in lsmod after the boot

but its not actually booting up the modules listed under /etc/modules.autoload.d/kernel-2.6

----------

## jeanck

Hey, I just got an idea!

Sometime ago, when I started to use gentoo, I was with my friend Bio_Freak trying to load an e100 module, but of course, We were soooo nooobie that we didn't know, about that time, that we could just place de e100 module listed on the /etc/modules.autoload.d/kernerl-2.6...

Tought times. Lots of nights without sleep...

So far nothing new, huh, but let me continue.

As crazy creative guys we start thinking with the knowledge we got by that time, that ended up on an unusual solution:

We did a script for loading the modules at start up.

Yeah, I know, that's not the best way to do it.

But you know. If you can win then, ally then!

Read this: http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4#doc_chap4

Specially: 4.d. Writing Init Scripts

That should guide you on that.

Here is something near what we did that evil day:

```

#!/sbin/runscript

start()

{

modprobe "module1"

modprobe "module2"

}

```

Save that at:

```
/etc/init.d/"script name"
```

Add that to boot:

```
rc-update add "script name" boot
```

I hope that could solve your problem. That was so long ago, I hope I hadn't forget any step on that.

It's not the best way, but is quickly than modprobe handly in fact.

Good Luck, any problems mail me or post here,

Jean

----------

## Apewall

I actually did that already just to avoid having to modprobe 4 modules after booting up.  I consider it a temporary fix though.  Hopefully eventually someone whos ran into this will run into the thread:p

----------

## t0dbld

 *Apewall wrote:*   

> I actually did that already just to avoid having to modprobe 4 modules after booting up.  I consider it a temporary fix though.  Hopefully eventually someone whos ran into this will run into the thread:p

 

was there ever a fix for this ? i have the same problem

----------

## Chris W

Congratulations on resurrecting a 5 year old thread.

If you have an up to date system then your problem is not the same as this.  OpenRC and baselayout 2 did away with /etc/modules.autoload.d: see http://www.gentoo.org/doc/en/openrc-migration.xml

----------

