While installing any software I get "files list file for package 'gnupg' is missing final newline"

Package operation failed
The installation or removal of a software package failed.

installArchives() failed: Selecting previously unselected package libidn11:i386. 
(Reading database ... 
(Reading database ... 5% 
(Reading database ... 10% 
(Reading database ... 15% 
(Reading database ... 20% 
(Reading database ... 25% 
(Reading database ... 30% 
(Reading database ... 35% 
(Reading database ... 40% 
(Reading database ... 45% 
(Reading database ... 50% 
(Reading database ... 55%
dpkg: unrecoverable fatal error, aborting: 
 files list file for package 'gnupg' is missing final newline 
Error in function: 
SystemError: E:Sub-process /usr/bin/dpkg returned an error code (2)

Solution 1:

It seems that a special file is corrupted. In the directory /var/lib/dpkg/info you'll find the file gnupg.list. Have a look inside. Probably you'll see corruptions. It is safe to delete this file. So open a terminal and enter

sudo rm /var/lib/dpkg/info/gnupg.list

After you've finished update your package database (sudo apt update or any other tool). Now you should have a correct gnupg.list back and the error should disappear.