7.Configuring modules
7. Configuring Modules:
Configuring modules in a Linux system involves managing kernel modules or device drivers. Kernel modules are pieces of code that can be loaded and unloaded into the running kernel to add or remove functionality. These modules often interact with hardware devices or provide additional features to the kernel.
Module Management Commands:
Listing Loaded Modules:
lsmod
: This command lists all currently loaded kernel modules.Example output:
Loading Modules:
modprobe
: This command is used to load kernel modules into the running kernel.Example:
To load a module at boot time, you can add it to the
/etc/modules
file.
Unloading Modules:
rmmod
: This command is used to remove (unload) kernel modules from the running kernel.Example:
Module Configuration Files:
/etc/modules:
This file lists kernel modules that should be loaded at boot time.
Edit this file to add modules that you want to load automatically at startup.
Example
/etc/modules
file:/etc/modprobe.d/ Directory:
The
/etc/modprobe.d/
directory contains configuration files for module loading.You can create custom configuration files to set options and aliases for specific modules.
Example:
Example
my_module.conf
file:
Module Options:
Setting Module Options:
Some modules support options that can be configured when loading the module.
Use the
modprobe
command with themodule_name option_name=value
syntax to set options.
Example:
Persistent Module Options:
To set module options persistently, create a configuration file in
/etc/modprobe.d/
.Use the format
options module_name option_name=value
in the configuration file.
Example:
Example
my_module.conf
file:
Module Aliases:
Module Aliases:
Module aliases define alternative names for modules.
They are used by the kernel to load modules when devices are detected.
Aliases are defined in
/lib/modules/$(uname -r)/modules.alias
and other files.
Setting Module Aliases:
You can create custom module aliases using
/etc/modprobe.d/
configuration files.
Example:
Example
my_module-alias.conf
file:
Last updated
Was this helpful?