Linux kernel is a wonderful piece of software which will act a master to all softwares installed in an OS. In this post we will see how to load servents(aka modules) in to kernel. Though Linux architecture taken inspiration from Unix, there are some differences between their kernel architecure. One major difference is Linux kernel is a modular kernel where as Unix kernel is a monolithic kernel.
What is a modular kernel?
A modular kernel is a type of kernel where you can load a module(a piece of software to make some hardware/software to work properly) or remove a module when that module is no longer required by your Operating System. In windows world these are called as "Drivers". This is the beauty of Linux kernel where you can load only required modules and remove unwanted modules which will have less burden on the system.
In this post we will see "How to load a module at the time of boot." We have two options to do this. One is prescribed one and other one is a work around which you should not prefer.
Load kernel modules using modules file
In Debian based machines like Ubuntu the modules file is located at /etc/modules. For example if you want pptp
Save the file and exit.
In Redhat based machines we have to create a shell script file say for example xyz.modules in /etc/sysconfig/modules folder and change permissions to executable. We can create as many .modules files you want or keep all modules in single .modules file.
Save the file and change permissions to executable
Load kernel modules through /etc/rc.local file
This is common in most of the Linux flavors. Edit /etc/rc.local file to enter modprob/insmod commands to execute them at the time of booting.
Note 1: This note is for people who do not know about /etc/rc.local file. This is a file which will be executed after init completes it’s booting and before we get login prompt. This is just file with sequence of commands. If you want to execute any command at the time of boot, you just have to keep that command in this file.
Save the file and exit.
Now your system will load these modules when ever it boots up.
In our next posts we will see how to use other kernel related commands like lsmod, insmod, modinfo, rmmod, modprob, depmod, dkms, kmod.
Latest posts by Surendra Anne (see all)
- Docker: How to copy files to/from docker container - June 30, 2020
- Anisble: ERROR! unexpected parameter type in action:
Fix- June 29, 2020
- FREE: JOIN OUR DEVOPS TELEGRAM GROUPS - August 2, 2019
- Review: Whizlabs Practice Tests for AWS Certified Solutions Architect Professional (CSAP) - August 27, 2018
- How to use ohai/chef-shell to get node attributes - July 19, 2018