Manually Maintaining Modules

Modules can be manually loaded using the insmod command. This command is very straightforward—it's just the command and the module name. For example, to load the 3c509 device driver, enter insmod 3c509. This does not install the module with the autoclean option. If you want this driver removed from memory when it is not in use, add the -k option to the insmod command, and enter insmod -k 3c509.

One limitation with the insmod command is that it does not understand module dependencies. If you used it to load the smc-ultra module, it would not automatically load the required 8390 module. For this reason, modprobe is a better command for manually loading modules. As with the insmod command, the syntax is simple. To load the smc-ultra drive, simply enter modprobe smc-ultra.

modprobe reads the module dependencies file that is produced by the depmod command. Whenever the kernel or the module libraries are updated, run depmod to produce a new file containing the module dependencies. The command depmod -a searches all of the standard modules libraries and creates the necessary file. After it is run, you can use modprobe to install any module and have the other modules it depends on automatically installed.

Use the rmmod command to remove unneeded modules. Again, the syntax is simple; rmmod appletalk removes the appletalk driver from your system.

These manual maintenance commands have limited utility on a running system, because the correct things are usually done by Linux without any prodding from you. For example, I booted a small system on my home network, and immediately ran lsmod. I saw from this listing that I had appletalk and ipx installed, and I knew I didn't need either one. I typed in rmmode appletalk, but the message returned was rmmod: module appletalk not loaded because the system had already removed this unneeded module faster than I could type the command. Additionally, attempting to remove a command that is currently active returns the message Device or resource busy. For these reasons, I have rarely needed to use the rmmod command on an operational system.

Was this article helpful?

0 0

Post a comment