Rmmod Command in Linux | Linuxize

[ad_1]

The core component of each Linux operating system is the Linux kernel. It manages the system’s resources, and acts as an intermediary between the computer’s hardware and software.

The Linux kernel is a software that has a modular design. A kernel module, or often referred to as a driver, is a piece of code that extends the kernel’s functionality. Modules can be compiled as loadable modules or built into the kernel. Loadable modules can be dynamically loaded and unloaded in the running kernel on request, without the need to reboot the system.

In this article, we’ll talk about how to use the rmmod command to remove modules from the Linux Kernel.

rmmod Command #

The general syntax for the rmmod (remove module) command is as follows:

rmmod [OPTIONS] MODULE_NAME...

On modern Linux systems, rmmod is part of kmod, a binary that implements multiple programs used to manage Linux kernel modules.

Only users with administrative privileged can remove modules.

You can print a list of all modules loaded on your system with the lsmod
command. The Kernel modules are stored in the /lib/modules/<kernel_version> directory.

Removing a module with the rmmod command is pretty simple; simply invoke the command followed by the module name:

rmmod module_name

The command prints message only if something goes wrong. For example, if another module uses the module, the command will print something like this:

rmmod: ERROR: Module module_name is in use by: module_name_2

To display information about what the command is doing, use the -v (--verbose) option.

If you want to remove a module that is being used or not designed to be removed, invoke the command with the -f (--verbose) option. Using this option is extremely dangerous as it can cause a system crash.

rmmod also accepts multiple modules as arguments:

rmmod module_name1 module_name2

Prevent a Kernel Module from Loading at Boot-Time #

When a module is removed using the rmmod command, the module remains unloaded until the system is rebooted. On the next system boot, the removed module will be loaded.

To permanently disable a Kernel module from loading at boot-time, create a .conf file with any name inside the /etc/modprobe.d. The syntax is:

/etc/modprobe.d/blacklist.conf

If you want to blacklist additional modules, specify the modules on a new line, or create a new .conf file.

Conclusion #

The rmmod command is used to remove Linux kernel modules. Generally, most Linux users are using the modprobe -r
command instead of rmmod.

[ad_2]

Source link

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.