Loading and Unloading Modules in Linux

In this article I will give an example of manual and automatic loading/unloading models in Linux.

First, switch to root user if not under it, for example in Ubuntu it can be done like this:

sudo su

Let’s see a list of the downloaded modules:


To see if a particular module has been loaded so it can (where NAME is the module name):

lsmod | grep NAME

The following commands are used to load/unload a module:

modprobe NAME
modprobe -r NAME

When the module load command is executed, modprobe looks for it in the directory:

/lib/modules/$(uname -r)

You can see what it is like:

ls /lib/modules/$(uname -r)
ls /lib/modules/$(uname -r)/kernel/net/netfilter/

To load/unload a module from another directory, you can execute the following commands:

insmod /path/to/module/name.ko
rmmod /path/to/module/name.ko

View information about the module and the possible startup parameters as follows:

modinfo NAME

You can see specific information about the module, for example, where it is located:

modinfo --filename NAME

In order for the modules to start at the very beginning of the system startup, they must be written to the /etc/modules.conf file, and in order to start last when all services are started, the file is /etc/rc.local.
In addition to the file /etc/modules.conf there is also a directory /etc/modprobe.d/, where there are similar files with the extension .conf.

For example, in rc.local modules are written like this:

/sbin/modprobe NAME

The modules.conf file is written like this:


To prevent the module from loading, you can write the word blacklist before the module name:

blacklist NAME

Updating the Linux kernel on Hetzner servers

It took one day to update the CentOS kernel on the server in Hetzner, which worked without rebooting for about 2 years.

I looked at various information about the system, the versions of the installed kernels and the running kernel:

lsb_release -a
uname -r
uname -a
cat /proc/version
sudo rpm -q kernel
ls /boot | grep vmlinuz

Updated kernel:

yum -y update

Rebooted the server using the link in cPanel https://example.com:2087/scripts/dialog?dialog=reboot

You can also use the command:


After rebooting the server did not start, I immediately made a request for technical support via the https://robot.your-server.de.
Technical support responded within two minutes, as they reported, the server did not respond to keystrokes, there was a black screen, after the physical shutdown and power-up, it successfully launched.
Here such there are cases of a reset, it is necessary to be ready to everything.
At the next reboots, hangup no longer occurred.

Solution of the error NMI watchdog: BUG: soft lockup – CPU#0 stuck for 23s!

I noticed several times that the server was crashing with Ubuntu Server installed on 14.04.01, after which only a hard reset with power outage helped.

Continue reading “Solution of the error NMI watchdog: BUG: soft lockup – CPU#0 stuck for 23s!”