"Linux Gazette...making Linux just a little more fun!"


The Answer Guy


By James T. Dennis, [email protected]
Starshine Technical Services, http://www.starshine.org/


(?)Where to put 'insmod' and 'modprobe' Commands for Start-up

From anonymous on 14 Aug 1998

If it entertains you, a couple of questions:

Where the bleep should one specify modules to be installed when a system boots? I can't find it stated directly in any of the books, maybe /lib/modules/default ?

(!)There are three ways to do this.
The simplest is to load and unload the modules as you need them (thus you find your first 'ifconfig' command and insert an 'insmod' or a 'modprobe' command for your ethernet card before it; you change your ppp startup script to load the ppp module, etc).
Another way is to put all of you 'modprobe' or 'insmod' commands in some file like /etc/rc.d/init.d/modules and call that from one of your early rc scripts. You can trace through these rc script by starting with the inittab which generally has a set of references like:
# /etc/inittab
l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l6:6:wait:/etc/rc.d/rc 6
... all of these call the /etc/rc.d/rc script -- with a parameter to specify the runlevel, of course.
So you look in that script and insert a call to your /etc/rc.d/init.d/modules in the appropriate block or you put a set of symlinks under each of the rcX.d/ directories that correspond to each of the runlevels where you want these modules loaded. You'll want to prefix any of those symlink names with the SXX --- using a low number like S01modules --- to make sure that the "modules" script is called very early in the boot process, before anything that depends on them is called.
The difference between 'insmod' and 'modprobe' is that 'insmod' is a somewhat simpler program. You usually have to specify a full path with it -- and you much load modules in the correct order. 'modprobe' relies an a modules dependency tree to find and load the specified module *and any that it requires*. To prepare the dependency tree you must run 'depmod -a' at least once after building and installing any new kernel or modules. Some distributions will run a 'depmod -a' command as part of the normal startup sequence.
Yet another way, ultimately the one that is most convenient, is to run kerneld (2.0.x) or kmod (2.1.x and eventually 2.2). These kernel module loaders will dynamically load and unload modules and their dependents. This is similar to the way that Solaris does it (although it doesn't seem to be optional under Solaris).

(?)The "multiple configuations" thing in linuxconf (control-panel/system) seems to be reasonably broken; are you writing about any of this?

(!)I played with linuxconf only briefly. It seemed like it was often trying to do "too much" and I'd've preferred a mode where I could just use it to spit out configuration files and instructions on where I should put them.

(?)Boy does the world need your book; the docs that are there seem pretty hopeless...

(!)They can be frustrating. I try to help because I figure I've beat my head against that wall enough for any ten people.


Copyright © 1998, James T. Dennis
Published in Linux Gazette Issue 32 September 1998


[ Answer Guy Index ] phreak abandon javaterm BBS flaws doslinux resume
softwindows convert apache emulate database distrib proxy
disable DVI superblock serial permission detach cdr
rs422 modem notfound tuning libc5 startup clock ping
accounts lilo NDS 95slow nonlinux progenv cluster ftpd


[ Table Of Contents ] [ Front Page ] [ Previous Section ] [ Next Section ]