The really right, modern and clean way to load modules in CentOS 5

I needed to autoload some modules on some CentOS boxen and had a really hard time finding the most modern way to load them. After having them in /etc/rc.d/rc.local i found that i could also put them into /etc/rc.modules which then helped me find the following lines in /etc/rc.sysinit:

# Load other user-defined modules
for file in /etc/sysconfig/modules/*.modules ; do
[ -x $file ] && $file
done
# Load modules (for backward compatibility with VARs)
if [ -f /etc/rc.modules ]; then
/etc/rc.modules
fi

The cleanest way therefore seems to be like so:

echo "modprobe some_module" > /etc/sysconfig/modules/something.modules
chmod +x /etc/sysconfig/modules/something.modules

This kind of files could even be installed from a RPM without needing any special pre-install/uninstall handling.
This probably also applies to various Flavor of Redhat and Fedora. Personally i prefer gentoos nice modules.autoload file.

5 Responses to “The really right, modern and clean way to load modules in CentOS 5”

  1. Правильный и красивый способ добавлять модули ядра в автозагрузку в CentOS 5.X» mysyslog.ru Says:

    […] на блог с красивым и правильным методом добавления модулей в […]

  2. How to auto load kernel module on system boot in CentOS 5 | Walking in Light with Christ - Faith, Computing, Diary Says:

    […] based Linux distributions like Redhat, Fedora, RHEL etc.A similar article to this could be seen on The really right, modern and clean way to load modules in CentOS 5 Like […]

  3. mauro Says:

    thx for the tips.

    i’m using centos 6 now, and i dont know how to install “external module” before load it automatically.
    Any ideas ?

    thx

  4. hairmare (@hairmare) Says:

    If the module is available in Centos you can use “yum install ” to install it. Autoloading most likely still works as i described.

    hth

    hairmare

  5. Leo Says:

    CentOS 6 puts module loading files into the directory:

    /etc/sysconfig/modules

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: