How to Add a Kernel Module to a Software Image initrd In 4 Steps


There are times when you need to customize the operating system that servers in your cluster are running in order to enable some special capability. One example is enabling a server to take advantage of accelerator or GPU hardware by installing a kernel module. Bright does this automatically for some of the most popular devices, like NVIDIA GPUs, but you may have other needs. For example, kernel modules often are required to control particular storage, network, or other devices.

Carrying out such low-level modifications on a server can be risky. If done incorrectly, kernel modifications could cause the server to fail. The risk is compounded in a clustered environment since different servers may need different kernel modules to load every time they are restarted.kernel-visual

Fortunately, Bright Cluster Manager can minimize the risk out of installing kernel modules, and automate the process so that the cluster’s operation remains consistent.

Here’s how it’s done:

Step 1: First find out the kernel version of the nodes for which you want to add the kernel module.

[root@vnode003 ~]# uname -r


Note that the module is not currently loaded on the node.

[root@vnode003 ~]# lsmod | grep hello


Kernel modules need to be added on the head node. Copy it to the appropriate directory ('updates' is a good choice for home grown kernel modules). Make sure you set the permissions to 0744.

[root@openstack ~]# cd /cm/images/virtual-node-image/lib/modules/2.6.32-


[root@openstack updates]# cp /tmp/hello.ko .

[root@openstack updates]# chmod 744 hello.ko

[root@openstack updates]# ls -l

total 96

-rwxr--r-- 1 root root 91096 Feb 2 07:39 hello.ko


Step 2: chroot into the software image and run the 'depmod -a' command.

[root@openstack updates]# chroot /cm/images/virtual-node-image

[root@openstack /]# depmod –a


Step 3: Exit the chroot shell and add the module to the kernel modules sub-mode of the software image.        

[root@openstack /]# exit

[root@openstack updates]# cmsh

[openstack]% softwareimage use virtual-node-image

[openstack->softwareimage[virtual-node-image]]% kernelmodules

[openstack->softwareimage[virtual-node-image]->kernelmodules]% add hello




Step 4: Once the initrd is regenerated successfully, reboot the node. When it comes up, the module will be loaded.

[root@vnode003 ~]# lsmod | grep hello

hello 862 0


That’s all there is to it. Because Bright manages the cluster from bare metal on up the stack, you can handle low-level tasks like installing kernel modules right along with other management tasks, such as health checking and installing third-party software.

Bright Computing is the leading hardware-agnostic provider of cluster, server, and cloud management software. Running in more than 500 data centers across the globe, Bright Cluster Manager™ provides a single, unified solution for the provisioning, scheduling, monitoring, and management of HPC clusters, Hadoop clusters, and OpenStack clouds.

Bright OpenStack