Kernel module configuration
From openSUSE
Sometimes when working with openSUSE you will find the need to ensure that certain settings are used when loading a module, or that certain modules load automatically at startup or boot, or to ensure that certain modules are never loaded by adding them to a blacklist. openSUSE has some different methods for performing these tasks compared to other versions of Linux. This article will detail the openSUSE way to go about these tasks.
Contents |
Manually loading and unloading kernel modules
For testing purposes, sometimes you need to load or remove a kernel module immediately. The command to perform this task is the modprobe command. It can both load and unload, or add and remove, modules. These commands must be performed from a superuser or root shell.
Be aware that these changes are only in effect until the next time you restart the operating system. After that, you will either have to re-type the commands, or use the steps outlined below to ensure that the modules are loaded/configured the same way each time the operating system is started.
The command to use modprobe to load or add a module is the following:
modprobe modulenametoadd [options]
The command to use modprobe to unload or remove a module is the following:
modprobe -r modulenametoremove
Loading kernel modules at boot
When searching for information on this topic, you will find lots of outdated or incompatible ways to perform this task. With YaST, it's easy enough to do, or you can use the command line interface (CLI) with a text editor.
YaST: Loading kernel modules at boot
- Open YaST and authenticate, if necessary.
- Navigate to System > /etc/sysconfig Editor
- Navigate to System > Kernel > MODULES_LOADED_ON_BOOT
- Enter a list of modules to load at startup, separated by spaces.
- Click Finish when done.
- Confirm the modified variables and click OK.
The module(s) will now load at startup.
Command line interface: Loading kernel modules at boot
- In a superuser or root shell, use a text editing tool, such as vim or nano to edit the /etc/sysconfig/kernel file.
- Find the line starting with: MODULES_LOADED_ON_BOOT
- Between the quotes, enter the modules you wish loaded at boot time, separated by spaces.
- Save the file and exit the editor.
- Type in the following command:
SuSEconfig
The module(s) will now load at startup.
Performing the module load immediately
To make the modules get loaded immediately, you can use the following command in a superuser or root shell:
/etc/init.d/boot.loadmodules restart
Configuring kernel module arguments
When using modprobe or other automated kernel loading tools, multiple modules can be loaded at once. Therefore, there has to be a place to store the configuration information for each module. The old method for doing this was editing the /etc/modprobe.conf file. However, in openSUSE, there are two places to put it instead, the /etc/modprobe.conf.local, or the more preferred way, a separate file in the /etc/modprobe.d directory. When creating a text file in the /etc/modprobe.d directory, it is best to group related module information into separate files that are given a name that describes the reason for the settings.
The format of modprobe.conf.local and a separate text file located in the /etc/modprobe.d directory is the same.
alias: The alias command allows you to refer to modules with a more comfortable name.
alias newshortname old-really-long-module-name
option: The option command allows you to specify modules arguments when they are automatically loaded or added to the kernel.
option modulename options...
To get a complete list of commands, type the following command at a prompt:
man modprobe.conf
Adding a module to the blacklist
- From the command line interface with root privileges, you can create the file /etc/modprobe.d/blacklist.local or edit the /etc/modprobe.conf.local with a text editor, such as vim or nano.
- The format of the command to keep a module from loading is the following:
blacklist modulename
- Save the file and exit the editor.
The module will no longer be loaded automatically.

