Stop module version mismatches from wrecking your boot sequence
By Saket Jain Published Linux/Unix
Stop module version mismatches from wrecking your boot sequence
Technical Briefing | 12/1/2026
We have all been there. You update your kernel, run your update tool, and assume everything is clean. Then the system hits a kernel panic or sits at a black screen because the module loader could not resolve a symbol. It turns out that some obscure driver you compiled manually three years ago is still hanging around in /lib/modules, and the kernel loader is trying to pull it in because of a stale depmod file. It’s a headache that ruins your maintenance window.
Why depmod is probably lying to you
The kernel does not just scan the filesystem every time you need a module. It relies on the modules.dep map. If your initramfs was generated before you cleaned out those old, junk modules, the map points to nowhere. The most annoying part is that the kernel won’t always tell you it’s looking at a broken map until the exact moment you need it to load that drive controller. I once spent an hour in a rescue shell only to find a symlink pointing to a non-existent build directory.
depmod -a -v $(uname -r) | grep -i error
- Check /lib/modules/$(uname -r)/modules.dep to see if absolute paths are pointing to deleted build paths
- Run depmod with the verbose flag to catch missing symbol warnings before they break the boot
- Verify your initramfs content using lsinitramfs to ensure old modules are not being baked into the boot image
Clean up the rot
Don’t just ignore these errors as minor warnings. If depmod is unhappy, your bootloader is effectively playing Russian Roulette. Clear out your /lib/modules directory of any folders that do not match a kernel you actually intend to boot. If you are using DKMS, make sure to purge the specific versioned modules that are no longer supported. Next time you feel the urge to ignore a module warning, remember that a reboot is waiting to trap you.
