In simple terms, the problem that I have is that I am trying to install the linux-headers for my kernel and I get the error
Selecting previously unselected package linux-headers-4.4.0-97.
dpkg: unrecoverable fatal error, aborting:
files list file for package `pptp-linux' contains empty filename
E: Sub-process /usr/bin/dpkg returned an error code (2)
The rest of the post explains what happened and how did I reach to this state. Before that the linux headers were working properly.
I was working on a remote server when my connection was dropped. I was using a software library that depends on the linux header files which I installed with $sudo apt-get install linux-headers-4.4.0-97-generic a few weeks ago.
After I gained access I rebooted the system and then I couldn't connect remotely. I went to the server room and the server's monitor was displaying an error, saying that the /boot/ partition doesn't have enough space. So realized that there were many different versions of the linux-heaaders-* installed into the system and I tried to run: $ sudo apt-get remove but I always had a problem with the dpkg with an error similar to one displayed below.
I couldn't do anything so, manually with rm -rf I deleted the abi, config, initrd, and vmlinuz files for all the version other than the one I use and the previous one. Afterwards, I run sudo apt-get autoremove and then sudo apt-get update and sudo update-grub.
After that I tried to re-run the software I was running before the connection was dropped and the software wouldn't run (actually is a software and a driver at the same time). I tried to re-make and I got an error saying that the linux headers do not have a build sub-directory.
Then I tried to reinstall the linux headers for my kernel's version.
$ sudo apt-get install linux-headers-4.4.0-97-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
linux-headers-4.4.0-97
The following NEW packages will be installed
linux-headers-4.4.0-97 linux-headers-4.4.0-97-generic
0 to upgrade, 2 to newly install, 0 to remove and 18 not to upgrade.
Need to get 0 B/10.7 MB of archives.
After this operation, 87.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package linux-headers-4.4.0-97.
dpkg: unrecoverable fatal error, aborting:
files list file for package `pptp-linux' contains empty filename
E: Sub-process /usr/bin/dpkg returned an error code (2)
I also run:
$ sudo apt-get install --reinstall linux-headers-4.4.0-97-generic
and (to remove the previous versions of the header files):
$ sudo apt-get remove linux-headers-4.4.0-80-generic
but I get a similar error message. And $ sudo apt-get update doesn't help. Also, I have to run $ sudo dpkg --configure -a from time to time.