How to Fix “dpkg: warning: files list file for package missing” Error in Debian/Ubuntu


2 views

When working with Debian-based systems, you might encounter this persistent warning during package operations:

dpkg: warning: files list file for package 'libssh2-1:amd64' missing; assuming package has no files currently installed

This occurs when dpkg can't find the .list files in /var/lib/dpkg/info/ that track installed files for each package. While the system continues to function, these warnings can clutter your terminal output and indicate potential package management issues.

The primary causes include:

  • Corrupted dpkg database
  • Incomplete package installations
  • Manual modifications to /var/lib/dpkg/info/
  • Disk errors affecting system files

Method 1: Rebuild Package Lists

First, try regenerating the package lists:

sudo apt-get update
sudo apt-get install --reinstall $(dpkg --get-selections | grep -v deinstall | cut -f1)

Method 2: Manual File Restoration

For specific packages showing warnings:

# Example for libssh2-1
sudo touch /var/lib/dpkg/info/libssh2-1:amd64.list
sudo dpkg --configure --pending

Method 3: Complete Database Repair

For severe cases, rebuild the entire dpkg database:

sudo mv /var/lib/dpkg/info /var/lib/dpkg/info_old
sudo mkdir /var/lib/dpkg/info
sudo apt-get update
sudo apt-get -f install
  • Always use apt or dpkg for package management
  • Avoid manual file deletions in /var/lib/dpkg/
  • Regularly run sudo apt-get clean and sudo apt-get autoremove

After applying fixes, verify with:

ls -la /var/lib/dpkg/info | grep -i "package-name"

You should see complete sets of .list, .postinst, and other control files for each package.


When working with Debian-based systems, you might encounter warnings like:

dpkg: warning: files list file for package 'libssh2-1:amd64' missing
dpkg: warning: files list file for package 'libkrb5-3:amd64' missing

These messages indicate that dpkg cannot find the .list files in /var/lib/dpkg/info/ that track installed files for packages. While the system continues to function, these warnings can be annoying and may indicate underlying package management issues.

The most common scenarios include:

  • Improper system shutdown during package operations
  • Manual modification of dpkg database files
  • Filesystem corruption in /var/lib/dpkg/
  • VPS/container-specific issues (common in OpenVZ/LXC environments)

First, check if the package files actually exist:

ls -la /var/lib/dpkg/info | grep libssh

If you see output like this but still get warnings, we need deeper verification:

-rw-r--r-- 1 root root    327 Sep 21 15:51 libssh2-1.list
-rw-r--r-- 1 root root    359 Aug 15 06:06 libssh2-1.md5sums

Here's the complete fix procedure:

# Step 1: Backup the dpkg status file
sudo cp /var/lib/dpkg/status /var/lib/dpkg/status-bak

# Step 2: Rebuild package information
sudo apt-get install --reinstall -o Dpkg::Options::="--force-confask,confnew,confmiss" $(apt list --installed 2>/dev/null | grep installed | cut -d/ -f1)

# Step 3: Clean up
sudo apt-get clean
sudo apt-get autoremove

# Step 4: Verify
sudo dpkg --configure -a
sudo apt-get install -f

For VPS/container environments where the above doesn't work:

# Create dummy files for missing packages
for pkg in $(dpkg -l | grep ^ii | awk '{print $2}'); do
    if [ ! -f "/var/lib/dpkg/info/${pkg}.list" ]; then
        echo "Creating dummy list for ${pkg}"
        touch "/var/lib/dpkg/info/${pkg}.list"
    fi
done

Best practices to avoid this problem:

  • Avoid manual modification of /var/lib/dpkg/ contents
  • Use apt-get or aptitude instead of direct dpkg commands
  • Ensure proper shutdown procedures
  • Regularly check package consistency with debsums

For persistent cases, consider recreating the dpkg database:

# Warning: This is a nuclear option
sudo mv /var/lib/dpkg/info /var/lib/dpkg/info_old
sudo mkdir /var/lib/dpkg/info
sudo apt-get update
sudo apt-get -f install
sudo mv /var/lib/dpkg/info/* /var/lib/dpkg/info_old/
sudo rm -rf /var/lib/dpkg/info
sudo mv /var/lib/dpkg/info_old /var/lib/dpkg/info