deno
+
react
ada
+
scheme
+
+
+
+
+
supabase
+
+
+
nvim
fauna
+
+
+
+
+
remix
ios
+
+
+
+
+
โˆช
notepad++
echo
+
rollup
fiber
?
+=
+
+
symfony
+
+
lit
+
+
+
===
+
+
koa
+
r
bsd
+
cypress
+
+
rubymine
%
composer
+
astro
+
express
ansible
riot
yarn
supabase
marko
macos
+
qdrant
+
+
+
+
mocha
+
+
+
couchdb
+
travis
ractive
+
+
+
+
elm
+
Back to Blog
๐Ÿ”ง Kernel Modules Management with modprobe in AlmaLinux: Power Guide
AlmaLinux Kernel Modules

๐Ÿ”ง Kernel Modules Management with modprobe in AlmaLinux: Power Guide

Published Aug 20, 2025

Learn to manage kernel modules in AlmaLinux using modprobe, lsmod, and modinfo. Load drivers, troubleshoot hardware, and optimize your kernel with beginner-friendly examples.

10 min read
0 views
Table of Contents

๐Ÿ”ง Kernel Modules Management with modprobe in AlmaLinux: Power Guide

So your WiFi isnโ€™t working? Or maybe you plugged in some hardware and Linux doesnโ€™t see it? ๐Ÿ˜ค Thatโ€™s probably a kernel module issue! When I first started with Linux, kernel modules seemed like dark magic. But guess what? Theyโ€™re actually pretty simple once you understand them! Today Iโ€™m gonna show you how to load, unload, and manage kernel modules like a pro. Letโ€™s unlock the power of your kernel! ๐Ÿš€

๐Ÿค” Why are Kernel Modules Important?

Kernel modules are like plugins for your operating system. They add features without rebooting! Hereโ€™s why understanding them is crucial:

  • ๐Ÿ”Œ Hardware Support - Make devices work properly
  • ๐Ÿ’พ Save Memory - Load only what you need
  • ๐Ÿš€ Add Features - Extend kernel capabilities
  • ๐Ÿ”ง Fix Problems - Troubleshoot hardware issues
  • ๐ŸŽฎ Gaming/Graphics - Load GPU drivers
  • ๐Ÿ”’ Security - Enable security features

I once spent hours trying to get a USB WiFi adapter workingโ€ฆ turns out I just needed to load the right module. Five seconds, problem solved! ๐Ÿ˜…

๐ŸŽฏ What You Need

Before we dive into kernel modules, make sure you have:

  • โœ… AlmaLinux system running
  • โœ… Root or sudo access
  • โœ… Terminal ready
  • โœ… 15 minutes to master modules
  • โœ… Maybe some hardware to test with!

๐Ÿ“ Step 1: Understanding Kernel Modules

Letโ€™s explore what modules are loaded and available on your system!

View Loaded Modules

# List all loaded modules
lsmod

# Output looks like:
# Module                  Size  Used by
# nvidia_drm             61440  3
# nvidia_modeset       1216512  4 nvidia_drm
# nvidia              35332096  86 nvidia_modeset

# Count loaded modules
lsmod | wc -l

# Find specific module
lsmod | grep bluetooth

# More detailed view
cat /proc/modules

Get Module Information

# Detailed info about a module
modinfo e1000e  # Intel network driver

# Output shows:
# filename:       /lib/modules/.../e1000e.ko
# version:        3.2.6-k
# license:        GPL
# description:    Intel(R) PRO/1000 Network Driver
# author:         Intel Corporation

# Check module parameters
modinfo -p module_name

# See dependencies
modinfo -F depends module_name

# Find module file
modinfo -n module_name

Available Modules

# List all available modules
find /lib/modules/$(uname -r) -type f -name '*.ko*'

# Count available modules
find /lib/modules/$(uname -r) -type f -name '*.ko*' | wc -l

# Search for specific hardware modules
ls /lib/modules/$(uname -r)/kernel/drivers/net/wireless/

# See module directories
ls /lib/modules/$(uname -r)/kernel/drivers/

๐Ÿ”ง Step 2: Loading and Unloading Modules

Time to actually manage these modules!

Load Modules with modprobe

# Load a module
sudo modprobe module_name

# Load with parameters
sudo modprobe module_name parameter=value

# Example: Load USB storage
sudo modprobe usb-storage

# Load network driver
sudo modprobe e1000e

# Load with options
sudo modprobe usbcore autosuspend=2

# Force load (dangerous!)
sudo modprobe -f module_name

# Dry run (see what would happen)
sudo modprobe -n --first-time module_name

Remove Modules

# Remove a module
sudo modprobe -r module_name

# Or use rmmod
sudo rmmod module_name

# Remove and dependent modules
sudo modprobe -r module_name --remove-dependencies

# Force removal (careful!)
sudo rmmod -f module_name

# Check if module is in use
lsmod | grep module_name

Manual Loading with insmod

# Lower level - needs full path
sudo insmod /lib/modules/$(uname -r)/kernel/drivers/net/e1000e.ko

# With parameters
sudo insmod module.ko param1=value1 param2=value2

# Difference from modprobe:
# insmod = just loads the module
# modprobe = loads module + dependencies

๐ŸŒŸ Step 3: Persistent Module Configuration

Make modules load automatically at boot!

Automatic Loading

# Create config file
sudo nano /etc/modules-load.d/mymodules.conf

# Add modules to load at boot
# One per line:
nvidia
bluetooth
usb-storage

# Or with systemd
echo "module_name" | sudo tee /etc/modules-load.d/module_name.conf

Module Parameters

# Set module parameters
sudo nano /etc/modprobe.d/mymodule.conf

# Add parameters:
options module_name parameter1=value1 parameter2=value2

# Example for Intel graphics
options i915 enable_guc=2

# WiFi power saving
options iwlwifi power_save=0

# Sound card options
options snd-hda-intel index=0 model=auto

Blacklisting Modules

# Prevent module from loading
sudo nano /etc/modprobe.d/blacklist.conf

# Add:
blacklist module_name

# Example - disable nouveau for NVIDIA
blacklist nouveau
options nouveau modeset=0

# Blacklist and prevent dependencies
install module_name /bin/true

# Update initramfs after blacklisting
sudo dracut --force

โœ… Step 4: Troubleshooting Hardware

Letโ€™s fix common hardware issues!

WiFi Not Working

# Check if WiFi module is loaded
lspci -k | grep -A 3 -i wireless

# Find WiFi hardware
lspci | grep -i wireless
lsusb | grep -i wireless

# Common WiFi modules
sudo modprobe iwlwifi    # Intel
sudo modprobe ath9k      # Atheros
sudo modprobe rtl8192ce  # Realtek

# Check module loaded
lsmod | grep wifi

# See errors
dmesg | grep -i wifi

Graphics Issues

# Check graphics hardware
lspci -k | grep -A 2 -i vga

# NVIDIA setup
sudo modprobe nvidia
sudo modprobe nvidia-drm
sudo modprobe nvidia-modeset

# AMD setup
sudo modprobe amdgpu

# Intel
sudo modprobe i915

# Check loaded
lsmod | grep -E "nvidia|amdgpu|i915"

๐ŸŽฎ Quick Examples

Example 1: Hardware Detection Script ๐Ÿ”

#!/bin/bash
# Detect and load appropriate modules

echo "๐Ÿ” Hardware Module Detector"
echo "=========================="

# Check network cards
echo "Network devices:"
for device in $(lspci | grep -i ethernet | cut -d' ' -f1); do
    echo "  Device: $device"
    driver=$(lspci -k -s $device | grep "Kernel driver" | awk '{print $NF}')
    if [ ! -z "$driver" ]; then
        echo "    Driver: $driver (loaded)"
    else
        echo "    Driver: Not loaded!"
        # Try to find and load module
        module=$(lspci -k -s $device | grep "Kernel modules" | awk '{print $NF}')
        if [ ! -z "$module" ]; then
            echo "    Attempting to load: $module"
            sudo modprobe $module
        fi
    fi
done

# Check WiFi
echo ""
echo "Wireless devices:"
if lspci | grep -qi wireless; then
    lspci -k | grep -A 3 -i wireless
else
    echo "  No wireless devices found"
fi

# Check USB devices
echo ""
echo "USB devices requiring drivers:"
for device in $(lsusb | grep -v "hub" | cut -d' ' -f6); do
    echo "  USB Device: $device"
done

Example 2: Module Manager Tool ๐Ÿ› ๏ธ

#!/bin/bash
# Interactive module manager

show_menu() {
    echo "====================="
    echo "  ๐Ÿ”ง MODULE MANAGER"
    echo "====================="
    echo "1) List loaded modules"
    echo "2) Load module"
    echo "3) Remove module"
    echo "4) Module info"
    echo "5) Find module for hardware"
    echo "6) Blacklist module"
    echo "7) Exit"
    echo "====================="
}

while true; do
    show_menu
    read -p "Choice: " choice
    
    case $choice in
        1)
            echo "Loaded modules:"
            lsmod | head -20
            echo "..."
            echo "Total: $(lsmod | wc -l) modules"
            ;;
        2)
            read -p "Module name to load: " module
            if sudo modprobe $module; then
                echo "โœ… Module $module loaded!"
            else
                echo "โŒ Failed to load $module"
            fi
            ;;
        3)
            read -p "Module name to remove: " module
            if sudo modprobe -r $module; then
                echo "โœ… Module $module removed!"
            else
                echo "โŒ Failed to remove $module"
            fi
            ;;
        4)
            read -p "Module name: " module
            modinfo $module 2>/dev/null || echo "Module not found"
            ;;
        5)
            echo "PCI devices and drivers:"
            lspci -k | grep -A 2 "Kernel"
            ;;
        6)
            read -p "Module to blacklist: " module
            echo "blacklist $module" | sudo tee -a /etc/modprobe.d/blacklist.conf
            echo "โœ… Module blacklisted!"
            ;;
        7)
            exit 0
            ;;
    esac
    echo ""
    read -p "Press Enter to continue..."
done

Example 3: Module Health Check ๐Ÿฅ

#!/bin/bash
# Check module health and dependencies

check_module_health() {
    echo "๐Ÿฅ Module Health Check"
    echo "====================="
    
    # Critical modules that should be loaded
    critical_modules=(
        "ext4"      # Filesystem
        "ip_tables" # Firewall
        "selinux"   # Security
    )
    
    for module in "${critical_modules[@]}"; do
        if lsmod | grep -q "^$module"; then
            echo "โœ… $module: Loaded"
        else
            echo "โš ๏ธ $module: Not loaded!"
            echo "   Attempting to load..."
            sudo modprobe $module 2>/dev/null && echo "   โœ… Loaded!" || echo "   โŒ Failed!"
        fi
    done
    
    echo ""
    echo "Module Statistics:"
    echo "  Total loaded: $(lsmod | wc -l)"
    echo "  Network modules: $(lsmod | grep -c net)"
    echo "  USB modules: $(lsmod | grep -c usb)"
    echo "  Sound modules: $(lsmod | grep -c snd)"
    
    echo ""
    echo "Failed modules in dmesg:"
    dmesg | grep -i "failed to load\|module.*error" | tail -5
    
    echo ""
    echo "Blacklisted modules:"
    if [ -f /etc/modprobe.d/blacklist.conf ]; then
        grep "^blacklist" /etc/modprobe.d/blacklist.conf
    else
        echo "  None"
    fi
}

check_module_health

๐Ÿšจ Fix Common Problems

Problem 1: Module Not Found โŒ

Canโ€™t load a module?

# Update module database
sudo depmod -a

# Rebuild initramfs
sudo dracut --force

# Check kernel version matches
uname -r
ls /lib/modules/

# Install kernel modules package
sudo dnf install kernel-modules kernel-modules-extra

Problem 2: Module Wonโ€™t Load โŒ

Getting errors when loading?

# Check dependencies
modinfo module_name | grep depends

# Load dependencies first
sudo modprobe dependency1
sudo modprobe dependency2
sudo modprobe module_name

# Check for conflicts
dmesg | tail -20

# Force load (risky!)
sudo modprobe -f module_name

Problem 3: Hardware Not Detected โŒ

Device not working?

# Rescan PCI bus
echo 1 | sudo tee /sys/bus/pci/rescan

# Check if disabled
rfkill list all  # For wireless

# Enable device
rfkill unblock all

# Check BIOS/UEFI settings
# Some devices can be disabled there

Problem 4: Module Loads But Doesnโ€™t Work โŒ

Module loaded but hardware still broken?

# Check module parameters
modinfo -p module_name

# Try different parameters
sudo modprobe -r module_name
sudo modprobe module_name param=value

# Check firmware
dmesg | grep -i firmware

# Install firmware
sudo dnf install linux-firmware

๐Ÿ“‹ Simple Commands Summary

TaskCommand
๐Ÿ“‹ List moduleslsmod
โ„น๏ธ Module infomodinfo module_name
โž• Load modulesudo modprobe module_name
โž– Remove modulesudo modprobe -r module_name
๐Ÿ” Find hardwarelspci -k
๐Ÿšซ BlacklistEdit /etc/modprobe.d/blacklist.conf
๐Ÿ”„ Update databasesudo depmod -a
๐Ÿ“ Check logsdmesg | grep module

๐Ÿ’ก Tips for Success

  1. Check First ๐Ÿ” - Use lsmod before loading
  2. Read Logs ๐Ÿ“ - dmesg shows module errors
  3. Use modprobe ๐ŸŽฏ - Better than insmod
  4. Document Changes ๐Ÿ“‹ - Track what you modify
  5. Test Carefully ๐Ÿงช - Wrong module can crash system
  6. Keep Backups ๐Ÿ’พ - Before blacklisting modules

Funny story: I once blacklisted the wrong network module and lost remote access to a server. Had to drive to the data center at 2 AM to fix it. Learn from my mistakes! ๐Ÿ˜‚

๐Ÿ† What You Learned

Youโ€™re now a kernel module master! You can:

  • โœ… View and analyze loaded modules
  • โœ… Load and unload kernel modules
  • โœ… Configure persistent module settings
  • โœ… Troubleshoot hardware issues
  • โœ… Blacklist problematic modules
  • โœ… Manage module parameters
  • โœ… Fix driver problems

๐ŸŽฏ Why This Matters

Understanding kernel modules means:

  • ๐Ÿ”Œ Make any hardware work
  • ๐Ÿš€ Optimize system performance
  • ๐Ÿ› ๏ธ Fix driver issues yourself
  • ๐Ÿ’พ Control memory usage
  • ๐Ÿ”’ Enhance security
  • ๐Ÿ’ผ Essential Linux admin skill

Just last week, a friend brought me a laptop with โ€œbrokenโ€ WiFi. The shop quoted $200 for a new card. I loaded the right kernel module, and boom - WiFi worked perfectly! They bought me dinner and thinks Iโ€™m a wizard. And honestly? Now you have the same power! ๐Ÿง™โ€โ™‚๏ธ

Remember: Kernel modules are powerful but be careful. Always check what a module does before loading it. And never force-load modules on production systems unless you really know what youโ€™re doing! ๐ŸŒŸ

Happy module managing! May your hardware always be detected and your drivers always load! ๐Ÿ”งโœจ