Lesson
1.2 Objective review
Kernel modules
Most drivers are loadable kernel modules (.ko or compressed .ko.xz / .ko.zst files under /lib/modules/$(uname -r)/). They can be loaded and removed without a reboot.
| Command | What it does |
|---|---|
lsmod |
Lists loaded modules, their size and which modules use them (reads /proc/modules) |
modinfo <name> |
Shows a module's file, description, license, dependencies and parameters |
modprobe <name> |
Loads a module and its dependencies, using modules.dep. Preferred way to load |
modprobe -r <name> |
Removes a module and unused dependencies |
insmod <path.ko> |
Loads one module file by path. Does not resolve dependencies |
rmmod <name> |
Removes one module. Fails if the module is in use |
depmod |
Rebuilds modules.dep, the dependency map modprobe relies on. Run after adding a module by hand |
Configuration:
/etc/modprobe.d/*.conf: options and blacklists, for exampleoptions e1000e InterruptThrottleRate=3000orblacklist nouveau. A blacklist stops automatic loading by alias;install <name> /bin/falseblocks it completely./etc/modules-load.d/*.conf: modules to load at every boot, one name per line (read bysystemd-modules-load).- Parameters of a loaded module appear in
/sys/module/<name>/parameters/.
Device management and hardware inventory
Devices are detected by the kernel, published in /sys, and given device files in /dev by udev (systemd-udevd), which applies rules from /usr/lib/udev/rules.d/ and /etc/udev/rules.d/. udevadm info and udevadm monitor inspect it.
| Command | Shows |
|---|---|
dmesg |
The kernel ring buffer: driver messages, hardware errors, USB plug events. dmesg -T adds readable times, dmesg -w follows |
lspci |
PCI devices (network cards, GPUs, storage controllers). -k shows the driver in use, -v more detail |
lsusb |
USB devices with vendor and product IDs. -t shows a tree |
lscpu |
CPU architecture, cores, threads, sockets, caches, virtualization flags |
lsmem |
Memory blocks and whether they are online |
lshw |
Full hardware inventory (-short, -class network). Run as root for complete output |
dmidecode |
Reads the SMBIOS/DMI table: system vendor, model, serial number, BIOS version, memory slots (-t memory) |
ipmitool |
Talks to the server's baseboard management controller (BMC) over IPMI: power on/off, sensor readings, event log, even remotely with -I lanplus -H <bmc> |
sensors (lm_sensors) |
Temperatures, fan speeds and voltages. Run sensors-detect once to find chips |
initrd management
The initramfs must be rebuilt when you change something needed before the root filesystem is mounted: a storage driver, LVM, RAID, LUKS, or a module blacklist that must apply early.
| Tool | Where |
|---|---|
dracut |
RHEL, Fedora, SUSE. dracut -f rebuilds the image for the running kernel; dracut -f /boot/initramfs-<ver>.img <ver> for another |
mkinitrd |
Older wrapper (still on SUSE and older RHEL) |
update-initramfs -u |
Debian and Ubuntu (-k all for every kernel) |
lsinitrd (dracut) or lsinitramfs (Debian) list what is inside an image.
Custom hardware
- Embedded systems: Linux on routers, appliances, IoT devices and single board computers. Typically ARM or RISC-V, flash storage, minimal userland (BusyBox), built with Yocto or Buildroot, and often read only root filesystems.
- GPU use cases: machine learning training and inference, scientific computing, video transcoding and rendering, virtual desktop acceleration. NVIDIA GPUs need the proprietary driver or open kernel modules (blacklisting
nouveau);nvidia-smireports usage. - nvtop: an interactive,
htopstyle monitor for GPU utilization, memory and processes (NVIDIA, AMD and Intel).
On the exam, if a module "fails with unknown symbol" errors when loaded, the cause is usually a missing dependency: use modprobe, which reads modules.dep, rather than insmod.