Hardware⏱️ 3 min read📅 2026-06-11

How to Fix: Why does lspci stop with error -2?

Error -2 occurs when lspci fails to load libkmod resources, likely due to a configuration issue or missing dependencies.

Quick Answer: Check the system's kernel version and update it if necessary, as newer versions may resolve compatibility issues with libkmod.

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

  1. 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.
  2. 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

  1. 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.
  2. 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.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions