21.5. Setting Module Parameters
Like the kernel itself, modules can also take parameters that change their behavior. Most of the time, the default ones work well, but occasionally it is necessary or desirable to set custom parameters for a module. Because parameters cannot be dynamically set for a module that is already loaded into a running kernel, there are two different methods for setting them.
You can unload all dependencies of the module you want to set parameters for, unload the module using modprobe -r
, and then load it with modprobe
along with a list of customized parameters. This method is often used when the module does not have many dependencies, or to test different combinations of parameters without making them persistent, and is the method covered in this section.
Alternatively, you can list the new parameters in an existing or newly-created file in the
/etc/modprobe.d/
directory. This method makes the module parameters persistent by ensuring that they are set each time the module is loaded, such as after every reboot or
modprobe
command. This method is covered in
Section 21.6, “Persistent Module Loading”, though the following information is a prerequisite.
You can use modprobe
to load a kernel module with custom parameters using the following command line format:
modprobe module_name [parameter=value]
When loading a module with custom parameters on the command line, be aware of the following:
You can enter multiple parameters and values by separating them with spaces.
Some module parameters expect a list of comma-separated values as their argument. When entering the list of values, do not insert a space after each comma, or modprobe
will incorrectly interpret the values following spaces as additional parameters.
The modprobe
command silently succeeds with an exit status of 0
if:
Thus, you must ensure that the module is not already loaded before attempting to load it with custom parameters. The modprobe
command does not automatically reload the module, or alert you that it is already loaded.
Here are the recommended steps for setting custom parameters and then loading a kernel module. This procedure illustrates the steps using the e1000e
module, which is the network driver for Intel PRO/1000 network adapters, as an example:
Procedure 21.1. Loading a Kernel Module with Custom Parameters
-
First, ensure the module is not already loaded into the kernel. For example:
~]# lsmod | grep e1000e
~]#
Output indicates that the module is already loaded into the kernel, in which case you must first unload it before proceeding. See
Section 21.4, “Unloading a Module” for instructions on safely unloading it.
-
Load the module and list all custom parameters after the module name. For example, if you wanted to load the Intel PRO/1000 network driver with the interrupt throttle rate set to 3000 interrupts per second for the first, second and third instances of the driver, and Energy Efficient Ethernet (EEE) turned on , you would run, as root
:
~]# modprobe e1000e InterruptThrottleRate=3000,3000,3000 EEE=1
This example illustrates passing multiple valued to a single parameter by separating them with commas and omitting any spaces between them.