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.

I will quote some of the logs at this moment:

Jun 17 20:16:19 server-gw kernel: [3455576.132542] Code: be 00 02 00 00 e8 46 26 8c ff 5d c3 0f 1f 40 00 66 66 66 66 90 55 48 89 e5 53 48 89 f3 66 66 66 66 90 66 83 07 02 48 89 df 57 9d <66> 66 90 66 90 5b 5d c3 0f 1f 44 00 00 b8 02 00 00 00 f0 66 0f
Jun 17 20:16:47 server-gw kernel: [3455604.143698] NMI watchdog: BUG: soft lockup – CPU#0 stuck for 23s! [kworker/0:2:19206]
Jun 17 20:16:47 server-gw kernel: [3455604.146475] Modules linked in: xt_nat xt_tcpudp iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 ipt_ISG(OE) iptable_filter ip_tables x_tables ipmi_ssif gpio_ich amdkfd amd_iommu_v2 intel_powerclamp coretemp radeon kvm_intel kvm crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel aes_x86_64 lrw gf128mul ttm glue_helper ablk_helper cryptd drm_kms_helper serio_raw drm lpc_ich joydev i2c_algo_bit i7core_edac hpilo edac_core shpchp ipmi_si 8250_fintek ipmi_msghandler mac_hid acpi_power_meter nf_nat_pptp nf_nat_proto_gre nf_conntrack_pptp nf_conntrack_proto_gre nf_nat nf_conntrack lp parport hid_generic usbhid hid psmouse be2net vxlan bnx2 pata_acpi ip6_udp_tunnel udp_tunnel hpsa
Jun 17 20:16:47 server-gw kernel: [3455604.146529] CPU: 0 PID: 19206 Comm: kworker/0:2 Tainted: G IOEL 3.19.0-39-generic #44~14.04.1-Ubuntu
Jun 17 20:16:47 server-gw kernel: [3455604.146531] Hardware name: HP ProLiant DL380 G7, BIOS P67 09/30/2010
Jun 17 20:16:47 server kernel: [3455604.146537] Workqueue: events inet_frag_worker

The problem was a bug in the Ubuntu kernel version – 3.19.0-39-generic, and naturally the solution to the problem was to update the system with commands:

sudo apt-get update
sudo apt-get upgrade

After that, the error disappeared.

The kernel version can be viewed by the command:

uname -r

Ubuntu version:

lsb_release -r