Ubuntu dpkg Package Missing Final Newline
July 31, 2014
Posted by on
I’ve yet to understand why it is happening. But at least I have a temporary cure.
You get a message like the following while running apt-get upgrade:
dpkg: unrecoverable fatal error, aborting:
files list file for package 'apache2-mpm-prefork' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)
You have to move apt’s information about the package out of the way and then re-install the package. As follows:
server:root# mv /var/lib/dpkg/info/apache2-mpm-prefork.* \
server:root# apt-get install --reinstall apache2-mpm-prefork
dpkg: warning: files list file for package 'apache2-mpm-prefork' missing; assuming package has no files currently installed
If you get warnings about other packages missing newlines repeat the procedure recursively.
Once you’ve done this you should be able to run an apt-get upgrade cleanly.