DistributedNetworks DistributedNetworks

Compiling Kernel   «Prev 

Working with kernel modules

lsmod program's output

A group of commands for managing kernel modules is available if the module-init-tools package is installed. Use these commands to determine if a module has been loaded successfully or when trying different modules for a piece of new hardware.
The command


displays a list of currently loaded modules. For example
Module                Size  Used by
nfs                   218437  1
lockd                  63977  2 nfs
parport_pc             24705  1
lp                     12077  0
parport                37129  2 parport_pc,lp
autofs4                23237  2
i2c_dev                11329  0
i2c_core               22081  1 i2c_dev
sunrpc                157093  5 nfs,lockd
button                  6481  0
battery                 8901  0
ac                      4805  0
md5                     4033  1
ipv6                  232833  16
ohci_hcd               21713  0
e100                   39493  0
mii                     4673  1 e100
floppy                 58481  0
sg                     33377  0
dm_snapshot            17029  0
dm_zero                 2369  0
dm_mirror              22957  2
ext3                  116809  2
jbd                    71257  1 ext3
dm_mod                 54741  6 dm_snapshot,dm_zero,dm_mirror
ips                    46173  2
aic7xxx               148121  0
sd_mod                 17217  3
scsi_mod              121421  4 sg,ips,aic7xxx,sd_mod

The /sbin/lsmod output is less verbose and easier to read than the output from viewing /proc/modules.
To load a kernel module, use the /sbin/modprobe command followed by the kernel module name. By default, modprobe attempts to load the module from the /lib/modules/<kernel-version>/kernel/drivers/ subdirectories.
There is a subdirectory for each type of module, such as the net/ subdirectory for network interface drivers. Some kernel modules have module dependencies, meaning that other modules must be loaded first for it to load. The /sbin/modprobe command checks for these dependencies and loads the module dependencies before loading the specified module

ls mod output

1. This is a banner describing each field of lsmod's output.
2. This is the NFS locking functionality, loaded as a module.
3. This is the RPC functionality, loaded as a module.
4. Natural language support (NLS) which gives users access to foreign characters, is also a loaded module.
5. Support for Microsoft filesystems is loaded as a module.
6. This is the module's size in bytes.
7. This is the number of time the kernel is using the module. Modules might have more than one instance.
8. Indicates the modules resources will be cleaned up automatically when it is unloaded.
9. This shows that the sunrpc module is dependent on lockd.
10. This shows that the vfat module is dependent on fat.