Linux Kernel Modules

Kernel modules allow for kernel functionality to be loaded at will.

Loading a module

For example, the CD-ROM drive was not functioning correctly on my system and the sg module needed to be loaded.

This can be done while booted with

sudo modprobe sg

However, this will be unloaded on next boot. To have this loaded permanently a configuration file needs to be created in /etc/modules-load.d/:

sudo nvim /etc/modules-load.d/sg.conf

# Containing the text:
sq

Then on reboot it will auto-load.

Showing information on a module

The modinfo command will give a printout of information relating to the module:

modinfo sg

filename:       /lib/modules/6.1.1-arch1-1/kernel/drivers/scsi/sg.ko.zst
alias:          char-major-21-*
version:        3.5.36
license:        GPL
description:    SCSI generic (sg) driver
author:         Douglas Gilbert
...

Showing all loaded kernel modules

This can be done with the lsmod command.