Q: A newly compiled kernel module is not loading, with `modprobe` returning "module not found." The `.ko` file exists. What is wrong?
Linux kernel modules must reside in the correct directory and be indexed by depmod before modprobe can find them.
#Linux #Linux / SRE — Scenario-Based Interview Questions #L2 #SRE #Systems #Troubleshooting
🎙️ Candidate Opening & Architectural Context
""We encountered this OS-level bottleneck during peak traffic and diagnosed it down to kernel and filesystem metrics. The interviewer is testing: Kernel module system, depmod, module paths.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third.""
Advertisement
🛠️ Production Runbook & Step-by-Step Resolution
1️⃣
Initial Diagnostics & Root Cause Analysis
Linux kernel modules must reside in the correct directory and be indexed by depmod before modprobe can find them.
- Wrong directory: Modules must be placed under
/lib/modules/$(uname -r)/. If the.kofile was compiled for a different kernel version, it will be in the wrong directory tree. - Missing dependency index: After placing the module in the correct path, you must run
depmod -ato rebuild the module dependency database (modules.dep). Without this,modprobecannot locate the module. - Version mismatch: The module was compiled against a different kernel version. The kernel enforces version magic matching. Check with
modinfo mymodule.koand comparevermagicagainstuname -r.
2️⃣
Remediation & Permanent Safeguards
Common causes: Correct workflow: Place module → depmod -a → modprobe mymodule.
- Force loading (dangerous):
insmod /path/to/mymodule.kobypasses dependency resolution and loads the module directly, but risks kernel panics if dependencies are unmet.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: Wrong directory: Modules must be placed under /lib/modules/$(uname -r)/. If the .ko file was compiled for a different kernel versi."
⚡ 60-Second Elevator Pitch Talking Points
- Wrong directory: Modules must be placed under /lib/modules/$(uname -r)/. If the .ko file was comp...
- Missing dependency index: After placing the module in the correct path, you must run depmod -a to...
- Version mismatch: The module was compiled against a different kernel version. The kernel enforces...
Advertisement