dpkg: warning: files list file for package 'x' missing

Solution 1:

He fixed it reinstalling the files that appeared there. So you might want to try something like this:

for package in $(apt-get upgrade 2>&1 |\
                 grep "warning: files list file for package '" |\
                 grep -Po "[^'\n ]+'" | grep -Po "[^']+"); do
    apt-get install --reinstall "$package";
done

Copy-paste friendly in one line:

for package in $(apt-get upgrade 2>&1 | grep "warning: files list file for package '" | grep -Po "[^'\n ]+'" | grep -Po "[^']+"); do apt-get install --reinstall "$package"; done

Be aware, that running this command takes some time, as we cycle through every package.

In some cases apt upgrade doesn't show the errors therefore you can reinstall one package (for example x) which gives the error and execute like this:

for package in $(apt-get install --reinstall x 2>&1 |\
             grep "warning: files list file for package '" |\
             grep -Po "[^'\n ]+'" | grep -Po "[^']+"); do
    apt-get install --reinstall "$package";
done

Solution 2:

Above answer didn't worked for me completely. Couple of packages, namely libc6, were still showing this error.

I found a solution on one forum. Bug is that new version of libc didn't echoed list of files to correct file. Instead of echoing it to /var/lib/dpkg/info/libc6:amd64.list it echoed it to /var/lib/dpkg/info/libc6.list

It can be fixed by running (adjust for your latest version and arch of libc6):

dpkg-deb -c /var/cache/apt/archives/libc6_2.13-38_amd64.deb | awk {'print $6'} | cut -f2- -d. | sed 's|^/$|/.|' | sed 's|/$||' > /var/lib/dpkg/info/libc6:amd64.list

Source: http://forums.debian.net/viewtopic.php?f=5&t=93201

Good luck to whoever would read this in future and finds it usable.


Solution 3:

Try saving this script:

for package in $(sudo apt-get install catdoc 2>&1 | grep "warning: files list file for package '" | grep -Po "[^'\n ]+'" | grep -Po "[^']+");
do
  sudo apt-get -y install --reinstall "$package"
done

Then, execute it with

sudo /bin/bash ./scriptname

This took a bit of extra work and some other commands too though like

sudo apt-get -f install
sudo apt-mark hold packagename
sudo dpkg -r --force-depends packagename

along with removing and reinstalling some specific packages.

This takes a fair bit of time and effort, still an apt-get will show a few errors though.

Tags:

Debian

Dpkg

Apt