11

When I try to install I get this error:

dpkg: unrecoverable fatal error, aborting:  files list file for package `fonts-tlwg-kinnari' contains empty filename
E: Sub-process /usr/bin/dpkg returned an error code (2)

And the installation is aborted.

I'm using Ubuntu 14.04

4 Answers4

14

This is a bug reported at launchpad.

The error shown will be either:

files list file for package '*' is missing final newline

Or:

files list file for package '*' contains an empty filename

Where * start is a random but steady "per install" package name.

Solution:

Donwload the .deb

sudo apt-get download fonts-tlwg-kinnari

Run this code

sudo dpkg -c /var/cache/apt/archives/fonts-tlwg-kinnari_1%3a0.5.1-3_all.deb  | awk '{if ($6 == "./") { print "/."; } \
else if (substr($6, length($6), 1) == "/") \
{print substr($6, 2, length($6) - 2); } \
else { print substr($6, 2, length($6) - 1);}}' > /var/lib/dpkg/info/fonts-tlwg-kinnari.list 

You can read more at launchpad

  • This is also the one solution that helped me. Please note that it may be due to a filesystem corruption (raspberry pi in my case). The .list file contained some file entries but then some stuff that looked like log output. The reported file length was exactly the same for both files, unfortunately I deleted the corrupt .list file before checking again. – kay_D Jun 30 '19 at 15:35
11

Another option from Adrian's answer above is this:

sudo rm /var/lib/dpkg/info/fonts-tlwg-kinnari.list

and then

sudo apt-get install --reinstall fonts-tlwg-kinnari

Basically, this error means something got corrupted on your filesystem. It's a bad sign, and these list files are needed for the package manager to figure out what is and isn't safe to upgrade.

This regeneration of the list file is the best option, but it's not 100% safe.

Either way, keep in mind that something went wrong with your drive, and watch out for more errors.

crcarlin
  • 131
1

I finally had some time to fix this on my own. For future reference

I moved all the linux* files to somewhere else. ex: ~/ (home) sudo mv /var/lib/dpkg/info/linux* ./

sudo dpkg --configure -a
sudo apt update
sudo apt upgrade

That fixed it

1

Adrian Cid Almaguer's answer is the only thing that worked for me, the general idea being "recreate the missing file from the .deb package".

A note though: check first in /var/cache/apt/archives/ and /var/lib/dpkg/info to see if the .deb file already exists. If so, just use that instead of doing the sudo apt-get download.

Also, sudo dpkg ... | awk ... | sudo tee /var/lib/dpkg/info/example.list is likely to work better for most people; the sudo tee combination overcoming the permissions problem > redirection encounters.

studog
  • 200