Chapter 3. Some other Linux information, perhaps not for the new user
- Table of Contents
- Modules, who are they, and how do they work ?
- A script to turn off the 'beep'
- Using your printer in an intelligent way
- Slow loading X or X clients (netscape or similar) ?
- BackSpace not working in X ?
- No colours in your file listings ?
- How to find a program for a specific purpose ?
- Date and time in Emacs status bar
- Changing your caps lock into Ctrl in X
I'll try to assemble some of my experiences here, dealing with some problems, software I've coped with, and other things..
Modules, who are they, and how do they work ?
A very nice feature of the Linux kernel is the modules. Modules are pieces of software that can be loaded and unloaded from the kernel at runtime. That way you can save kernel memory (and that's important for small machines, since kernel memory is never swapped out on disk), and keep your kernel clean when you're not working with some of your hardware.
Especially sound and network cards are really good to compile as modules, since sometimes they are a bit hard to configure, and when you have a module, you don't have to recompile and reboot your kernel to configure some irq or io setting. Quite a lifesaver, really !
The tools used.
The tools you use to handle modules are all located in /sbin. They are insmod, modprobe, lsmod, depmod and rmmod.. Notice the names, and compare them to some often used unix commands such as ls and rm and you'll immediatelly understand what each command will do for you. As always I recommend reading the manual pages. Anyway, here's a short table of what they do:
| Command | Function |
| lsmod | List the modules currently loaded. A completely harmless command, even a normal user can run it. |
| rmmod | Removes a loaded module from memory. Checks dependencies, ie if a module needs another module, the other module may not be unloaded before the first one. |
| insmod | Inserts a specific module in memory. You may give a path, or just a filename with or without extension. In the latter case, insmod will search some standard module paths to find the module. |
| modprobe | Inserts a module in memory, but checks dependencies. If you modprobe module A, and module A needs module B to run, modprobe will insert module B and then module A. |
| depmod | Calculates dependencies between modules needed by the other module commands. This is most probably done by your init scripts at system startup, but some time you may need to execute a depmod -a |
There is also a daemon, kerneld, that loads and unloads modules automatically. That way, your CDROM driver may be a module, and every time you try to access the device, the kernel will insert the modules needed. Very nice feature! Kerneld is replaced by a kernel process called kmod in the new stable kernel (The 2.2.XXX series of kernels). It has the same functionality.
How do I make modules?
When you compile your kernel, you choose to make things as modules, instead of into the kernel itself.
The modules will be installed when you do a make modules ; make modules_install after your kernel is compiled. They will reside in a directory called /lib/modules/xx.yy.zz where xx.yy.zz is your kernel version.