29
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  apt apt-transport-https apt-utils dpkg libapt-inst2.0 libapt-pkg5.0 ntpdate
  oracle-java8-installer oracle-java8-set-default thermald
10 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/4,389 kB of archives.
After this operation, 8,192 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Preconfiguring packages ...
dpkg: unrecoverable fatal error, aborting:
 files list file for package 'linux-generic' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)

I already tried the usual stuff like:

 sudo dpkg --configure -a 
 sudo apt-get -f install
 sudo apt-get clean
 sudo apt-get update && sudo apt-get upgrade

Any help, thanks!

cat -net /var/lib/dpkg/info/linux-generic.list
     1  ^LbM-BM-^FRq^MU^Evalueq^NK^HubU^Mcertificationq^ONU^Hoverviewq^PNU$
     2  updated_atq^QNU^Vavailable_translationsq^RNU^Dyearq^SMM-CM-^]^GU^Fimagesq^TNU^Bidq^UNU^Ipaused_atq^VNU^Eindex
4
  • Please edit your question to include the output of cat -net /var/lib/dpkg/info/linux-generic.list Apr 27, 2017 at 23:40
  • I tried copying the linux-generic.list from a good ubuntu machine and it still doesn't work. May 7, 2017 at 18:41
  • Copied how exactly? the cat -net output you posted earlier appears to show a mess of Windows control characters (CR endings and byte order mark) - did you use a word processing program (Word / LibreOffice) by any chance? May 7, 2017 at 18:44
  • the corrupted linux-generic.list was output was copied from putty I used scp to copy from a working ubuntu machine to the corrupted one, replacing the bad one May 7, 2017 at 19:36

7 Answers 7

31

I had similar issues with the following error:

dpkg: unrecoverable fatal error, aborting:
 files list file for package 'libboost-regex1.55.0:armhf' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)

However, the folder /var/lib/dpkg/info/linux didn't exist on my system, as in previous post. (I was running Raspbian on a Raspberry pi 3)

I moved the following files:

/var/lib/dpkg/info/libboost-regex1.55.0:armhf.postrm
/var/lib/dpkg/info/libboost-regex1.55.0:armhf.list

Then ran:

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

It fixed the problem for me.

3
  • 3
    For this particular question, you would run: sudo rm /var/lib/dpkg/info/linux-generic.list and then you might need to reinstall the package: sudo apt install --reinstall linux-generic
    – mchid
    Nov 10, 2019 at 17:38
  • 3
    Thanks that worked. BUT I had to do a sudo apt-get install --reinstall <missing_library> as the final step
    – Wavesailor
    Nov 20, 2019 at 16:28
  • Worked for me with a the aforementioned reinstallation. Otherwise, throws "dpkg: warning: files list file for package 'PACKAGENAME' missing; assuming package has no files currently installed"
    – M1GEO
    Jan 8, 2021 at 16:21
8

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
  • 4
    Did not work for me. It did add extra errors: dpkg: warning: files list file for package 'linux-base' missing; assuming package has no files currently installed dpkg: warning: files list file for package 'linux-libc-dev:armhf' missing; assuming package has no files currently installed
    – Qwertie
    Feb 19, 2019 at 12:34
8

Firstly you have to remove that missing file

sudo rm /var/lib/dpkg/info/linux-generic.list 

Now you can again reinstall it

sudo apt-get install linux-generic --reinstall 
1
  • Don't be afraid! I had an issue with nginx and after removing the file I had the same issue with 'perl-openssl-defaults:arm64. So I also removed this file and then apt install nginx --reinstall successfully ran! BTW: The files returned some gibberisch upon cat. Either my SD card is failing or there was a problem when I removed some packages.
    – bomben
    Jul 23, 2022 at 9:38
2

I had a very similar issue and resolved it a different way, so I thought I'd share what I did. While attempting a sudo apt upgrade I received the following dpkg error:

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

I found python3-xdg.list in the /var/lib/dpkg/info/ directory and ran cat on the file. What printed out was something like this, with the command prompt immediately following the contents:

user@device:/var/lib/dpkg/info$ cat python3-xdg.list
sEDUsEDUsEDUuser@device:/var/lib/dpkg/info$

I thought I'd try editing the file, giving it the missing final newline, so printing the file would then display:

user@device:/var/lib/dpkg/info$ cat python3-xdg.list
sEDUsEDUsEDU
user@device:/var/lib/dpkg/info$

After this I had no more issues.

2

I was getting this kind of error and I solved it very easily.

Selecting previously unselected package curl.
dpkg: unrecoverable fatal error, aborting:
 files list file for package 'm17n-db' contains empty filename
E: Sub-process /usr/bin/dpkg returned an error code (2)

Here how I solved this error:

Go to /var/lib/dpkg/info/m17n-db.list Then open m17n-db.list in text editor/

You will see a empty new line at the last line of this file's text as like this:

m17n-db.list file's text

You just need to do this:

  1. Delete the empty new line if there is one.
  2. Then save the file with administrator password. there we go. All problems are fixed.
1

I had this issue:

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

sudo dpkg --configure -a also did not work for me.

So, I had to edit by vim /var/lib/dpkg/info/rockchip-fstab.list as:

/. from V\H

Which fixed the issue.

0

This answer beffore doesn't work for me.

This work for me:

# First go to this path, to edit status
cd /var/lib/dpkg
# Backup status file
sudo cp status status.bak
# Edit status file
sudo nano status

# We are going to search for corrup package and delete entire block
# the first line start with
Package: apport
# The last line to delete is the "line before" of "new line" next to the "new start of pakage"
# Save the file
# Note: Check images of example at end

# Check for errors
sudo apt upgrade
# Fix broken package
sudo apt --fix-broken install

# Optional: delete file backup
sudo rm status.bak

Delete lines from status file
Example with package: apport enter image description here

Delete thouse lines before the new line
Example to where to delete: enter image description here

Reference: Solución: dpkg: error fatal irrecuperable, abortando. E: Sub-process /usr/bin/dpkg returned an error code (2)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .