English Persian
Working with Kernel Modules
indexterm:[kernel module,definition]indexterm:[module,kernel module]indexterm:[drivers,kernel module] The Linux kernel is modular, which means it can extend its capabilities through the use of dynamically-loaded _kernel modules_. A kernel module can provide:
a device driver which adds support for new hardware; or,
support for a file system such as `btrfs` or `NFS`.
Like the kernel itself, modules can take parameters that customize their behavior, though the default parameters work well in most cases. User-space tools can list the modules currently loaded into a running kernel; query all available modules for available parameters and module-specific information; and load or unload (remove) modules dynamically into or from a running kernel. Many of these utilities, which are provided by the [package]*kmod* package, take module dependencies into account when performing operations so that manual dependency-tracking is rarely necessary.
On modern systems, kernel modules are automatically loaded by various mechanisms when the conditions call for it. However, there are occasions when it is necessary to load or unload modules manually, such as when one module is preferred over another although either could provide basic functionality, or when a module is misbehaving.
This chapter explains how to:
use the user-space [application]*kmod* utilities to display, query, load and unload kernel modules and their dependencies;
set module parameters both dynamically on the command line and permanently so that you can customize the behavior of your kernel modules; and,
load modules at boot time.
Installing the kmod package
In order to use the kernel module utilities described in this chapter, first ensure the [package]*kmod* package is installed on your system by running, as root:
~]#{nbsp}dnf install kmod
For more information on installing packages with DNF, see xref:../package-management/DNF.adoc#sec-Installing[Installing Packages].
Listing Currently-Loaded Modules
indexterm:[kernel module,listing,currently loaded modules]indexterm:[kernel module,utilities,lsmod]indexterm:[lsmod,kernel module] You can list all kernel modules that are currently loaded into the kernel by running the [command]#lsmod# command, for example:
~]$ lsmod
Module Size Used by
tcp_lp 12663 0
bnep 19704 2
bluetooth 372662 7 bnep
rfkill 26536 3 bluetooth
fuse 87661 3
ip6t_rpfilter 12546 1
ip6t_REJECT 12939 2
ipt_REJECT 12541 2
xt_conntrack 12760 7
ebtable_nat 12807 0
ebtable_broute 12731 0
bridge 110196 1 ebtable_broute
stp 12976 1 bridge
llc 14552 2 stp,bridge
ebtable_filter 12827 0
ebtables 30913 3 ebtable_broute,ebtable_nat,ebtable_filter
ip6table_nat 13015 1
nf_conntrack_ipv6 18738 5
nf_defrag_ipv6 34651 1 nf_conntrack_ipv6
nf_nat_ipv6 13279 1 ip6table_nat
ip6table_mangle 12700 1
ip6table_security 12710 1
ip6table_raw 12683 1
ip6table_filter 12815 1
ip6_tables 27025 5 ip6table_filter,ip6table_mangle,ip6table_security,ip6table_nat,ip6table_raw
iptable_nat 13011 1
nf_conntrack_ipv4 14862 4
nf_defrag_ipv4 12729 1 nf_conntrack_ipv4
nf_nat_ipv4 13263 1 iptable_nat
nf_nat 21798 4 nf_nat_ipv4,nf_nat_ipv6,ip6table_nat,iptable_nat
[output truncated]
Each row of [command]#lsmod# output specifies:
the name of a kernel module currently loaded in memory;
the amount of memory it uses; and,