6

I want to autoload some kernel modules when it's started. I've read the manual book, but can't help. Now the modules that I want to autoload are vboxdrv vboxnetadp vboxpci vboxnetflt, The modules directory is /lib/modules/3.0.6-gentoo/, the config file directory is /etc/modules.autoload.d/kernel-3.0.6, in this file, the modules are all included. And Now after i reboot it, use lsmod, I can't see these modules loaded. What's the the problem?

thinkpad walle # ls -l /boot/
总用量 17068
lrwxrwxrwx 1 root root       1  1月 10 01:22 boot -> .
drwxr-xr-x 2 root root    4096  4月 27 10:55 grub
-rw-r--r-- 1 root root 5771120  3月 23 09:27 kernel-3.0.6
-rw-r--r-- 1 root root 5771120  4月 26 17:48 kernel-3.0.6-n5
-rw-r--r-- 1 root root 5876784  4月 27 10:55 kernel-3.0.6-n6
drwx------ 2 root root   16384  1月 17 15:47 lost+found

Now I use kernel-3.0.6-n6 as my boot kernel.

thinkpad walle # cat /etc/modules.autoload.d/kernel-3.0.6 
xt_mark
test_nx
scsi_wait_scan
wlagn
ext2
vboxdrv
vboxnetadp
vboxpci
vboxnetflt
Fei Xue
  • 1,995
  • 5
  • 19
  • 29

3 Answers3

13

The autoloaded modules are specified in /etc/conf.d/modules according to http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=7#doc_chap5

The /etc/init.d/modules script reads the /etc/conf.d/modules file and loads the modules. It should already be in the boot runlevel, but if it isn't, run rc-update add modules boot to have them loaded on boot.

mattst88
  • 1,462
  • 13
  • 21
8

/etc/conf.d/modules is not used now. Systemd uses its own structure

Put your module list file in /etc/modules-load.d/ man modules-load.d

Put your module option file in /etc/modprobe.d/ man modprobe.d

Community
  • 1
  • 1
Wataru
  • 391
  • 3
  • 11
  • 1
    Yes, `/etc/conf.d/modules` is the way to go now. And you can define a list of modules for a specific kernel version like kernel-3.0.6: `modules_3_0_6="vboxdrv vboxnetadp vboxpci vboxnetflt"`. – noisebleed May 24 '12 at 09:26
1

Well, editing /etc/conf.d/modules is not autoloading, because you need to edit this file after every kernel rebuild.

The main idea about autoloading hardware kernel modules is described here: http://doc.opensuse.org/documentation/html/openSUSE/opensuse-reference/cha.udev.html and http://wiki.gentoo.org/wiki/Udev

In few words: udev is managing your hardware, and every time when new hardware appears (kernel creates link in /dev), udev makes search for a proper kernel module, and loads it if found. All the device information is provided by sysfs.

Tim Gabets
  • 159
  • 1
  • 5