dpkg: unrecoverable fatal error, aborting: files list file for package 'linux-generic' is missing final newline

Solution 1:

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.

Solution 2:

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

Solution 3:

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