Error -2 occurs when lspci fails to load libkmod resources, likely due to a configuration issue or missing dependencies.
The Problem
The error 'lspci: Unable to load libkmod resources: error -2' is encountered when attempting to query information about PCIe devices using the lspci command. This issue affects Linux systems and users who rely on the lspci command for diagnosing and troubleshooting PCIe-related problems.This error can be frustrating as it prevents users from gathering essential information about their system's PCIe configuration, making it difficult to identify and resolve issues with PCIe devices. In this guide, we will explore possible causes of this error and provide steps to troubleshoot and fix the issue.
🛑 Root Causes of the Error
The primary cause of this error is a compatibility issue between the `lspci` command and the libkmod library used by the Linux kernel for PCIe device management. The libkmod library has a bug that causes it to fail loading resources with an error code of -2 when dealing with certain types of PCIe devices.Another potential cause could be a misconfigured or corrupted PCIe device driver, which may prevent the `lspci` command from functioning properly.
🚀 How to Resolve This Issue
Updating libkmod library
Step 1: Update the Linux kernel to the latest version using the package manager (e.g., `sudo apt-get update && sudo apt-get upgrade`). This may resolve compatibility issues with libkmod.Step 2: If updating the kernel is not possible, try updating the libkmod library separately by running `sudo apt-get install libkmod2:amd64`.
Reconfiguring PCIe device drivers
Step 1: Disable and re-enable the problematic PCIe device using the `lspci -v -D` command. This may help resolve issues with the device driver.Step 2: If disabling and re-enabling the device does not work, try blacklisting the device in the kernel's configuration files (e.g., `/etc/modprobe.d/blacklist.conf`). Add a line similar to `blacklist: 03:00.0` to blacklist the device.
✨ Wrapping Up
To troubleshoot and fix the 'lspci: Unable to load libkmod resources: error -2' issue, try updating the libkmod library or reconfiguring PCIe device drivers. If these steps do not resolve the issue, further investigation may be necessary to identify the root cause of the problem.
Full step-by-step guide with screenshots: Read the complete fix here
Found this helpful? Check out more verified tech fixes at TechFixDocs










