5

When I run sudo apt-get (anything), I invariably get this error:

dpkg: unrecoverable fatal error, aborting:
 files list file for package 'thunderbird-gnome-support' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)

After some Googling, I learn that this is because /var/lib/dpkg/info/thunderbird-gnome-support.list is corrupt. I cat that file, and it most certainly is corrupt - it should be a plain text file containing a list of absolute file paths, but instead is a binary file.

Now I inspect the other files in the same directory, and it appears that many of them are corrupt in the same way. This indicates that something went severely wrong in my file system, that caused many files to get corrupted. Unfortunately, it happened to affect system files.

How do I recover from this?


More details:

Just prior to this, I installed a routine update when Ubuntu prompted me. It was a new Linux kernel, and some system file headers.

After restarting, these were my specs:

OS specs:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 13.10
Release:    13.10
Codename:   saucy
$ uname -a
Linux brendang-linux 3.11.0-24-generic #41-Ubuntu SMP Mon Jun 9 20:36:00 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Immediately after restarting for the first time, the entire file system appeared to be mounted as read only (which has not been the case previously). Subsequently I have had to reboot several times before the system worked. I have done touch /forcefsck in between them to ensure that fsck runs, and am not sure what else needs to be done.

  • 1
    Have same problem. Did you resolve this? – XiaoChuan Yu Feb 26 '15 at 5:32
4

In my case i got a lot of *.list files corrupted. If you do

file /var/lib/dpkg/info/<package_name>.list

you should usually get:

/var/lib/dpkg/info/<package_name>.list: ASCII text

but if your list files are corrupted you will get:

/var/lib/dpkg/info/<package_name>.list: data

I made two scripts to fix this problem.

The first script check for this and rename each corrupted .list file into *.list.broken

move_broken_list_files.sh

The second script cycle for each *.list.broken file and force reinstallation of the package.

install_missing_list.sh

sometimes the install fails because of problems with triggers:

fgets gave an empty string from '/var/lib/dpkg/info/libnih1:amd64.triggers'

in that case you have to move/rename that file like:

mv /var/lib/dpkg/info/libnih1:amd64.triggers /var/lib/dpkg/info/libnih1:amd64.triggers.broken

Hope this helps someone facing the same mess.

| improve this answer | |
  • I was having the same exact issue OP reported. Your solution helped me recovering from this situation (on Debian Sid). I'm still planning to do a full OS reinstall though. I still wonder what might have caused all these files getting corrupted. I think it could have been my SSD going badly or a bad dpkg release. – Julián Landerreche Jul 9 at 19:00
  • Thank you for showing to use file -- I didn't even know it existed!! I just ran mv <NAME>.list <NAME>.list.BINARY for each (3) binary files. These were in /etc/apt/sources.list.d (and running nano on them just showed a bunch of ^@'s). Then I just ran cp <NAME>.list.save <NAME>.list and it seems to work! :D – TheTechRobo36414519 Jul 14 at 23:35
  • Ye, it's working :D – TheTechRobo36414519 Jul 14 at 23:41
0

I solved this as follows:

  • delete the offending file (in the OP case /var/lib/dpkg/info/thunderbird-gnome-support.list
  • reinstall the offending package using apt-get install --reinstall thunderbird-gnome-support

This recreated the deleted file list for me as well.

Of course, this can be cumbersome if a lot of files are corrupt, but in my case it was only a single file and the solution was quite easy in this case.

| improve this answer | |
0

Backup your damaged list (you can move all .list files)

mkdir /tmp/damaged && mv /var/lib/dpkg/info/*.list /tmp/damaged

Then, you can install your new package

apt install thunderbird-gnome-support
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.