How to load modules from kernel during boot in Linux

Recently I ran into a situation where my kernel was not loading vmxnet3 module during startup of the system hence I had to change the network card module from default vmxnet3 to E1000 on my VMware setup for each server.

If you are also facing similar problem or you want to load any other kernel module during startup(boot) of the Linux machine follow below steps.

NOTE: I am using SuSE Linux Enterprise System 11 SP4 hence the files and the commands used might not work on other variant of Linux.

Verify if vmxnet3 module is provided by kernel

# find / -name vmxnet3*.ko
/lib/modules/3.0.101-71.1.10543.0.PTF-default/kernel/drivers/net/vmxnet3/vmxnet3.ko

A more generic command to list kernel modules is

# modprobe --list | grep -i vmxnet
/lib/modules/3.0.101-71.1.10543.0.PTF-default/kernel/drivers/net/vmxnet3/vmxnet3.ko

So this validates that vmxnet3 is available within my kernel, so lets check if it is installed/loaded on my system

# lsmod | grep -i vmxnet3

If you don't get any output so it means vmxnet3 module is not loaded on your machine

Add the module name with "MODULES_LOADED_ON_BOOT" variable in the below file

# vi /etc/sysconfig/kernel
MODULES_LOADED_ON_BOOT=" ipmi_devintf ipmi_si vmxnet3"

Save and exit the file.

You can validate your configuration changes followed by a reboot with below command

# lsmod | grep -i vmxnet
vmxnet3                54163  0

As you see vmxnet3 module is loaded now.

If you want to avoid doing a reboot then you can manually load/activate a module using below command

# modprobe vmxnet3

This will activate your vmxnet3 module

# lsmod | grep -i vmxnet vmxnet3                
54163  0

I hope the article was useful.

Leave a Comment