udevd is failing because it can’t find a kernel module it expects to load.

Common Causes and Fixes

1. Module Not Loaded at Boot

Diagnosis: Check dmesg for messages like udevd: module <module_name> not found or udevd: failed to load module <module_name>. Verify if the module is loaded with lsmod | grep <module_name>.

Cause: The kernel’s module loading mechanism (modprobe) is failing to find the module file. This usually happens when the module isn’t installed in the expected location or the module dependency chain is broken.

Fix: Ensure the module is present and loadable.

  1. Identify the module: Look at the udevd logs or the specific device that’s causing the error. For example, if it’s a USB device, it might be usbcore or a specific driver like uvcvideo.
  2. Check for the module file: Navigate to /lib/modules/$(uname -r)/ and look for the .ko file corresponding to the module. If it’s missing, the module needs to be reinstalled or rebuilt.
  3. Attempt manual loading: Run sudo modprobe <module_name>. If this fails, it will likely provide a more specific error about missing dependencies or incorrect paths.
  4. Reinstall kernel modules: If the module file is missing, the most robust fix is to reinstall the kernel and its modules.
    • On Debian/Ubuntu: sudo apt-get update && sudo apt-get install --reinstall linux-image-$(uname -r) linux-modules-$(uname -r)
    • On RHEL/CentOS/Fedora: sudo dnf reinstall kernel-core-$(uname -r) kernel-modules-$(uname -r)
  5. Why it works: This ensures the kernel’s module directory is populated correctly with all necessary .ko files and their dependencies, allowing modprobe to find and load them.

2. Incorrect Module Alias or udev Rule

Diagnosis: Examine udev rules in /etc/udev/rules.d/ and /usr/lib/udev/rules.d/. Look for rules that attempt to load a specific module based on device attributes (ATTRS{...}, SUBSYSTEMS{...}).

Cause: A custom udev rule might be misconfigured, trying to load a module that doesn’t exist, or has a typo in the module name or device matching criteria.

Fix: Review and correct udev rules.

  1. Identify problematic rule: If you recently added or modified a udev rule, start there.
  2. Check udev rule syntax: Ensure RUN+="/sbin/modprobe <module_name>" is correctly formatted and <module_name> is accurate.
  3. Verify device matching: Make sure the rule’s matching conditions (e.g., SUBSYSTEM=="usb", ATTRS{idVendor}=="1234") are correct for the device in question. Use udevadm info -a -p $(udevadm info -q path -n /dev/<device_node>) to get detailed device attributes.
  4. Disable or correct the rule: Comment out or fix the line causing the issue. For example, change RUN+="/sbin/modprobe my_bad_module" to RUN+="/sbin/modprobe my_good_module" or remove the line entirely if the module isn’t needed.
  5. Reload rules: sudo udevadm control --reload-rules && sudo udevadm trigger
  6. Why it works: This ensures that udev only attempts to load valid, existing kernel modules based on accurate device identification.

3. Kernel Configuration Mismatch

Diagnosis: If you recently compiled a custom kernel or switched kernel versions, the module might have been compiled as a module (m) but not included in the initramfs, or it might have been excluded entirely.

Cause: The kernel was compiled without the required module, or the module was compiled but not packaged into the initial RAM filesystem (initramfs/initrd) which udevd relies on early in the boot process.

Fix: Rebuild the initramfs with the necessary module.

  1. Check kernel config: If you built the kernel, check the .config file (usually in /usr/src/linux-headers-$(uname -r)/ or /boot/config-$(uname -r)) to ensure the module is enabled (either y for built-in or m for module).
  2. Update initramfs:
    • On Debian/Ubuntu: sudo update-initramfs -u -k $(uname -r)
    • On RHEL/CentOS/Fedora: sudo dracut -f /boot/initramfs-$(uname -r).img $(uname -r)
  3. Reboot: A reboot is often required for udevd to pick up the changes from the new initramfs.
  4. Why it works: This process rebuilds the initial RAM disk image, embedding the required kernel module so it’s available to udevd when the system boots, even before the root filesystem is fully mounted.

4. Missing Module Dependencies

Diagnosis: modprobe <module_name> will often report missing dependencies when run manually. The udevd logs might also hint at this indirectly.

Cause: Kernel modules can depend on other modules. If a dependency module is not available or not loaded, the dependent module cannot be loaded either.

Fix: Install or load the missing dependency module.

  1. Identify dependency: Run modinfo <module_name>. Look for the depends: line.
  2. Load dependency: Try loading the dependency first: sudo modprobe <dependency_module>.
  3. Install dependency: If the dependency module itself is missing, you may need to install a package that provides it (e.g., firmware-linux-nonfree on Debian/Ubuntu for certain hardware) or rebuild the kernel with that dependency enabled.
  4. Why it works: By ensuring all prerequisite modules are loaded, the target module can be successfully initialized by the kernel.

5. Corrupted Module File or Filesystem Issue

Diagnosis: File corruption can prevent a module from being read. dmesg might show I/O errors or read failures when modprobe attempts to access the module file.

Cause: The kernel module file (.ko) on disk is damaged, or there’s an underlying filesystem issue preventing its read access.

Fix: Reinstall the module or check the filesystem.

  1. Reinstall kernel package: As described in Cause 1, reinstalling the kernel package often replaces corrupted module files.
  2. Check filesystem: Run fsck on the partition where /lib/modules/ resides (usually / or /boot). This requires unmounting the partition, so it’s typically done from a live CD/USB or during boot.
  3. Verify integrity: If you suspect specific file corruption, you can try comparing checksums if available (though this is rare for kernel modules).
  4. Why it works: This replaces any damaged module files with clean copies and ensures the integrity of the storage medium, allowing the module to be read correctly.

6. Outdated udev Database

Diagnosis: Less common, but udev’s internal database might be out of sync.

Cause: The udev database, which maps device events to actions, can become stale.

Fix: Rebuild the udev database.

  1. Clean and rebuild: sudo rm /dev/.udev.db* followed by sudo udevadm trigger.
  2. Reboot: A reboot is recommended to ensure a clean state.
  3. Why it works: This forces udev to re-scan all devices and rebuild its internal mapping from scratch, resolving potential inconsistencies.

The next error you’ll likely encounter after fixing this is a "device not found" or a specific hardware malfunction if the module was critical for device operation.

Want structured learning?

Take the full Systemd course →