25

I get this warning for several packages every time I install any package or perform apt-get upgrade. Not sure what is causing it; it's a fresh Debian install on my OpenVZ server and I haven't changed any dpkg settings.

Here's an example:

root@debian:~# apt-get install cowsay
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  filters
The following NEW packages will be installed:
  cowsay
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 21.9 kB of archives.
After this operation, 91.1 kB of additional disk space will be used.
Get:1 http://ftp.us.debian.org/debian/ unstable/main cowsay all 3.03+dfsg1-4 [21.9 kB]
Fetched 21.9 kB in 0s (70.2 kB/s)
Selecting previously unselected package cowsay.
dpkg: warning: files list file for package 'libssh2-1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libkrb5-3:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libwrap0:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libcap2:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libpam-ck-connector:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libc6:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libtalloc2:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libselinux1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libp11-kit0:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libavahi-client3:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libbz2-1.0:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libpcre3:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libgpm2:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libgnutls26:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libavahi-common3:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libcroco3:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'liblzma5:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libpaper1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libsensors4:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libbsd0:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libavahi-common-data:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libss2:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libblkid1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libslang2:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libacl1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libcomerr2:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libkrb5support0:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'e2fslibs:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'librtmp0:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libidn11:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libpcap0.8:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libattr1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libdevmapper1.02.1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'odbcinst1debian2:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libexpat1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libltdl7:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libkeyutils1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libcups2:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libsqlite3-0:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libck-connector0:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'zlib1g:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libnl1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libfontconfig1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libudev0:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libsepol1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libmagic1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libk5crypto3:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libunistring0:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libgpg-error0:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libusb-0.1-4:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libpam0g:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libpopt0:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libgssapi-krb5-2:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libgeoip1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libcurl3-gnutls:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libtasn1-3:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libuuid1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libgcrypt11:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libgdbm3:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libdbus-1-3:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libsysfs2:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libfreetype6:amd64' missing; assuming package has no files currently installed
(Reading database ... 21908 files and directories currently installed.)
Unpacking cowsay (from .../cowsay_3.03+dfsg1-4_all.deb) ...
Processing triggers for man-db ...
Setting up cowsay (3.03+dfsg1-4) ...
root@debian:~# 

Everything works fine, but these warning messages are pretty annoying. Does anyone know how I can fix this?

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

-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
-rwxr-xr-x 1 root root    135 Aug 15 06:06 libssh2-1.postinst
-rwxr-xr-x 1 root root    132 Aug 15 06:06 libssh2-1.postrm
-rw-r--r-- 1 root root     20 Aug 15 06:06 libssh2-1.shlibs
-rw-r--r-- 1 root root   4377 Aug 15 06:06 libssh2-1.symbols
Mark
  • 357
  • 1
  • 4
  • 10

12 Answers12

22

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
Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47
exic
  • 579
  • 4
  • 8
  • `-bash: syntax error near unexpected token ``do'`. Not good at bash; could you please fix it? – Mark Sep 21 '12 at 16:34
  • Mark: It's fine here, could it be you missed the beginning `for` on the previous line? – exic Sep 21 '12 at 20:09
  • Sadly this does nothing for me whilst running in command. But I love the ideae – Jamie Hutber Jun 28 '14 at 11:00
  • 1
    the script didn't quite work, however the the idea to reinstall did the trick sudo apt-get install --reinstall "package name" – AllGamer May 25 '16 at 02:24
  • first run `sudo bash` then paste script – Soliman Dec 27 '17 at 11:22
  • @exic I ran your command after "sudo bash", it did do anything, as u can see: https://pastebin.com/k2AS5tKC Is there something else I need to do before I run this command!? Am I missing something? – Pranav Jul 23 '19 at 14:43
  • Maybe you have a language pack installed and don't get the exact message, or the output changed since 2012 – what's the output of your `apt-get upgrade`? – exic Jul 24 '19 at 07:40
  • @exic The output of my "sudo apt upgrade" is: https://pastebin.com/XpC08R0S (Use @+myName to tag my name so that I know that u have replayed. I will get a notification.) – Pranav Jul 25 '19 at 12:40
  • @PrabeshBhattarai where do you see the warning then? You could as well just copy-paste every package name and reinstall manually. The script in this answer is just to make it more convenient. – exic Jul 25 '19 at 13:36
8

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.

dzhi
  • 770
  • 3
  • 10
  • 23
  • Doesn't works, if `dpkg-deb -c /var/cache/apt/archives/libc6_2.13-38_amd64.deb` has entries with symbolic links, eg `dpkg-deb -c /var/cache/apt/archives/mc_3%3a4.8.13-3_amd64.deb | grep mc.csh` returns `./usr/share/mc/bin/mc.csh -> ../../../lib/mc/mc.csh` – A.B. Sep 05 '15 at 10:31
  • @A.B. Wouldn't know. I ditched Debian and went entirely FreeBSD wherever i could. – dzhi Sep 05 '15 at 17:48
2

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.

austinian
  • 1,699
  • 2
  • 15
  • 29
user308018
  • 21
  • 1
1

Installing the problematic package makes the error message disappear, as already answered, but I reinstalled all the packages more manually. Using the script you don't get an error message and you don't know if the script is really working. In my case, I was having another error that prevented the re-installation of the packages. First, take one of the missing packages and reinstall it yourself to see that the re-installation works. Do this preferably with the last missing package listed. Try to reinstall any program from the terminal to get the error message with the name of the packages, what can be done with the command sudo apt-get reinstall aNy_PrOgRaM. With the error message, save it to a file with the extension shell script file_name.sh and leave only the name of the packages separated by space. This can be done with the text replacement option from any text editor. Line breaks are removed by substituting \n for space. Just with the name of the packages in hand, put the sudo apt-get install command at the beginning of everything. Run the command chmod +x file_name.sh and then run ./file_name.sh. Repeat the procedure if the problem to repeat with other packages. In my case it was necessary to download more than 4 GB to reinstall all packages. Everything happens in an interactive way, so you will have no doubt if the procedure is working or not. I also had problems with lic6, as already stated in the answers. It was difficult to solve the problem but the synaptic program helped me with this task. synaptic is an easy to use and is used to solve problems with broken packages and similar problems. I had to uninstall a program (virtualbox) and I have problems with debconf: DbDriver ”config“ but I solved the problem.

1

Not enough rep to comment: @exic / @mark, I found that it uses a backtick at the beginning of the package name and a quotemark afterward, thus different punctuation needs to be checked. I'm not sure if this was related. My solution:

for package in $(apt-get upgrade 2>&1 | grep "warning: files list file" | sed "s/.*\`//; s/'.*//"); do apt-get install --reinstall "$package"; done
zaTricky
  • 537
  • 4
  • 13
1

All the other answers here assume that you want to re-install the packages. In my case, I did not want to do so. I had used locate to try to remove all traces of them including their apt file lists.

The first step is to make sure the packages are removed using the package manager:

sudo apt remove <package list>

Then apt has a command you can run to clean it. This will get rid of the warning while still leaving the packages uninstalled:

sudo apt autoclean

Source on Ask Ubuntu: Files list file for package missing

0

You may need to get package status a different way with dpkg -l This set of command may help capture those other package statuses outside of ii (installed) rc (residual configuration files)

dpkg -l |egrep -v "^ii.+.|^rc.+."|awk 'NR>=6 {print $2}'

or get only install + config files with ic flag

dpkg -l |egrep "^ic.+."|awk 'NR>=5 {print $2}'

Now with a passable loop you can get a coffee...

for i in $(dpkg -l |egrep "^ic.+."|awk 'NR>=6 {print $2}');do apt reinstall $i ;done
PaSe
  • 1
0

First of all i have to thanks all of you, but none of the codes works for me, so i have to keep reading and finally get my own solution. I posted it here becouse maybe it could help someone. The first step it's to find the names of the packages that apears on the error mesage. To do this i excute this sed command on the Terminal

sudo apt-get install --reinstall libwayland-client0 | sed -e 's/^.*`\(.*\).\,.*$/\1/' > error.txt

This will generate the mesage error, trying to install one of the problematic packages. You can replace the name by any of the packages that shows on yours dpkg mesage. The second part of the command will find the names of the packages and generate a txt file named error.txt

In my case i'm using 64 bit Xubuntu, so some of the results has the ":amd64" extension. So, if that is your case, you have to do this

sed "s/.amd64//" error.txt > error1.txt

This sed will delete the :amd64 extension at the end of the packages names and generates a new txt called error1.txt

Then you have to set a variable with all the packages names, doing this

package=$(cat error1.txt)

And, finally, execute apt-get this way

sudo apt-get install --reinstall $package

In my case the list is very long so i recommend to cut the list in several parts and repeat the last 2 steps.

If you prefer to test the command instead of using apt-get you could do

echo $package

I have to say that i'm using spanish version of Xubuntu, so maybe you have to change ` by ' in the first sed command.

sudo apt-get install --reinstall libwayland-client0 | sed -e 's/^.*'\(.*\).\,.*$/\1/' > error.txt

So i hope i could help. Txs again.

julio
  • 1
  • 1
0

This worked for me:

$ dpkg -S dummy query 2>/tmp/warnings
$ cat /tmp/warnings | awk '{print $8}' > /tmp/packages
# manually edit /tmp/packages to remove (') around package names. 
# Use a txt editor and just replaceall (') with nothing
# https://askubuntu.com/questions/12041/how-can-i-navigate-to-tmp
# then run the following:
$ for package in $(cat /tmp/packages); do echo apt-get install --reinstall $package; apt-get install --reinstall $package; done;

Source: https://forums.debian.net/viewtopic.php?t=119371

0

Copy the error message to a file, for example 111.txt. Then run command

for package in $(cat 111.txt | grep "warning: files list file" | sed "s/'//g" | sed "s/\`//g"|awk '{print $8}'); do apt-get purge "$package" -y; apt-get install "$package" -y;done
jscott
  • 24,204
  • 8
  • 77
  • 99
0

I use Deepin Linux operating system, I changed the above commands to work. I use Chinese language.

for package in $(sed "s/.*\ \(.*\)\ .*/\1/"  error.txt)
do
    apt-get install -y --reinstall "$package"
done

If you use English

for package in $(sed "s/.*'\(.*\)'.*/\1/" error.txt)
do
    apt-get install -y --reinstall "$package"
done
tripleee
  • 1,324
  • 3
  • 14
  • 24
jay
  • 1
  • 1
-1

Never got any of the above commands to work but this finally worked for me after outputting the error message to the error.txt file

for package in $("s/.*'\(.*\)'.*/\1/" error.txt); do apt-get install --reinstall "$package"; done

Hope it helps someone else.

artsim
  • 1
  • Not my downvote, but you appear to be missing the `sed` command immediately after `$(`, which is a syntax error. – tripleee Jun 22 '22 at 07:28