persistent install or upgrade errors - "files list file for package 'libinput-bin' is missing final newline"
System Ubuntu server 20.04.3, Raspberry pi 4B. Attempts to run apt install, apt upgrade, virtually anything returns the same errors:
dpkg: unrecoverable fatal error, aborting:
files list file for package 'libinput-bin' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)
The name of the file may change when attempting to install different packages but the errors persist no matter what I try to install.
Solution 1:
You have to remove problematic file by
sudo rm /var/lib/dpkg/info/libinput-bin.list
and then reinstall this package to get correct contents of the above file by
sudo apt-get install --reinstall libinput-bin