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
To unload a kernel module, we use the rmmod (remove module) command. The following example will unload or remove the speedstep-lib. ko module.
In order to prevent kernel modules loading during boot, the module name must be added to a configuration file for the "modprobe" utility. This file must reside in /etc/modprobe. d . Ensure the module is not configured to get loaded in either /etc/modprobe.
To active/load a GRUB module while in the GRUB command-line (CLI mode), type "insmod MODULE". The modules are typically stored under /boot/grub/i386-pc/ or some similarly name directory. To list the available modules, type "ls /boot/grub/i386-pc/*. mod" (if your system supports that command).
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.
/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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With