Product SiteDocumentation Site

29.2. Persistent Module Loading

Many kernel modules are loaded automatically at boot time, as /sbin/lsmod shows. You can specify other modules to be loaded at boot time by creating a file in the /etc/sysconfig/modules/ directory. You can use any name you like for the file that you create, but you must give it a .modules extension, and you must make it executable by running the following command:
modules]# chmod 755 <filename.modules> 

No Need to Load Network and SCSI Modules

Networking and SCSI modules do not generally need to be manually loaded as they have their own particular loading mechanisms.
Here is a complete sample script named bluez-uinput.modules that loads the uinput module:

if [ ! -c /dev/input/uinput ] ; then
        exec /sbin/modprobe uinput >/dev/null 2>&1
Example 29.1. /etc/sysconfig/modules/bluez-uinput.modules

The first line of any .modules file should be a shebang line that gives the location of the bash shell interpreter:
Like many configuration files, all .modules files are bash scripts. The if-conditional on line 3 tests to make sure that the /dev/input/uinput files does not exist (the ! symbol negates the condition), and, if that is the case, then executes /sbin/modprobe with the name of the kernel module to load—uinput in this example. The remainder of the line simply redirects any output so that the modprobe command is quiet.