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.
/sbin/lsmod
displays a list of currently loaded modules. For example:
~]$ /sbin/lsmod
Module Size Used by
autofs4 25618 3
sunrpc 231823 1
bonding 115826 0
ip6t_REJECT 4641 2
nf_conntrack_ipv6 19623 2
ip6table_filter 2895 1
ip6_tables 19232 1 ip6table_filter
ipv6 322766 61 bonding,ip6t_REJECT,nf_conntrack_ipv6
dm_mirror 13723 0
dm_region_hash 11920 1 dm_mirror
dm_log 9944 2 dm_mirror,dm_region_hash
uinput 8126 0
sg 30478 0
sr_mod 16066 0
snd_ens1370 23085 4
gameport 10783 1 snd_ens1370
snd_rawmidi 22955 1 snd_ens1370
cdrom 39833 1 sr_mod
snd_seq 56461 0
snd_seq_device 6634 2 snd_rawmidi,snd_seq
snd_pcm 83399 1 snd_ens1370
snd_timer 22304 4 snd_seq,snd_pcm
snd 70077 12 snd_ens1370,snd_rawmidi,snd_seq,snd_seq_device,snd_pcm,snd_timer
virtio_net 15937 0
i2c_piix4 12707 0
soundcore 7892 1 snd
joydev 10514 0
snd_page_alloc 8604 2 snd_ens1370,snd_pcm
i2c_core 31338 1 i2c_piix4
virtio_balloon 3599 0
ext4 362885 2
mbcache 7510 1 ext4
jbd2 98427 1 ext4
virtio_blk 5159 3
ata_generic 3619 0
pata_acpi 3675 0
virtio_pci 6741 0
virtio_ring 6026 1 virtio_pci
virtio 4864 4 virtio_net,virtio_balloon,virtio_blk,virtio_pci
ata_piix 22532 0
dm_mod 73839 8 dm_mirror,dm_log
/sbin/lsmod
command is less verbose and easier to read than the output of cat /proc/modules
.
/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.
~]# /sbin/modprobe e100
e100
module before loading the e100
module itself.
/sbin/modprobe
executes them, use the -v
option. For example:
~]# /sbin/modprobe -v e100
/sbin/insmod /lib/modules/2.6.9-5.EL/kernel/drivers/net/e100.ko Using /lib/modules/2.6.9-5.EL/kernel/drivers/net/e100.ko Symbol version prefix 'smp_'
/sbin/insmod
command can also be used to load kernel modules; however, it does not resolve dependencies. You should thus always use /sbin/modprobe
instead of the insmod
command to load kernel modules.
/sbin/rmmod
command followed by the module name. The rmmod
utility only unloads modules that are not in use and that are not a dependency of other modules in use.
~]# /sbin/rmmod e100
e100
kernel module.
modinfo
. Use the command /sbin/modinfo
to display information about a kernel module. The general syntax is:
~]# /sbin/modinfo [options]
<kernel_module_name>
-d
, which displays a brief description of the module, and -p
, which lists the parameters the module supports. The modinfo
command is useful for listing information such as version, dependencies, paramater options, and aliases of modules.For a complete list of options, refer to the modinfo
man page.
[9] A driver is software which enables Linux to use a particular hardware device. Without a driver, the kernel cannot communicate with attached devices.