Menu
Menu

aptitude dist-upgrade or howto resolve dpkg: warning: files list file for package

Posted in linux, server, srvbox on 2013/08/11
Tags: , , , , , , , ,

Today I was doing dist-upgrade on one of my servers and end up with warnings for several packages like the samples below:


dpkg: warning: files list file for package 'libc6:i386' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libslang2:i386' missing; assuming package has no files currently installed

I've fix the issue by reinstalling the problematic packages with the following oneliner:


for pp in `awk '/files list file for package/ {p=$8; if ($8 !~ /\047/) p=$11; gsub(/\047|:.*/,"",p); if (!packages[p]) packages[p]=p;} END {for (i in packages) print i; }' /var/log/apt/term.log`; do
   aptitude reinstall "$pp";
done

Unfortunately there was still one error in there:


A copy of the C library was found in an unexpected directory:
  '/lib/i386-linux-gnu/libc-2.13.so'
It is not safe to upgrade the C library in this situation;
please remove that copy of the C library or get it out of
'/lib/i386-linux-gnu' and try again.

dpkg: error processing /var/cache/apt/archives/libc6_2.13-38_i386.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/libc6_2.13-38_i386.deb

In order to fix that one I've recreated the missing libc6:i386 package list file (again most magic happens in awk)


dpkg-deb -c /var/cache/apt/archives/libc6_2.13-38_i386.deb | awk {'sub(/^\./,"",$6);sub(/^\/$/,"/.",$6); sub(/\/$/,"",$6); print $6'} > /var/lib/dpkg/info/libc6:i386.list

The second error was there because of the change to multiarch in debian. The old file list file for libc was called libc6.list. Theoretically one could just rename the /var/lib/dpkg/info/libc6.list to /var/lib/dpkg/info/libc6:i386.list, but with the above command it is assured that the list file will contain exactly what is included in the deb package.

Comments are closed.