In Ubuntu 16.04, if during a package installation, you got the following error.
update-alternatives: error: /var/lib/dpkg/alternatives/rename corrupt: invalid status dpkg: error processing package perl (--configure): subprocess installed post-installation script returned error exit status 2 Errors were encountered while processing: perl E: Sub-process /usr/bin/dpkg returned an error code (1)
In this current case, it is the package “rename” with the package “perl”, but it probably can be used for any package.
Solution:
sudo mv /var/lib/dpkg/alternatives/rename /var/lib/dpkg/alternatives/rename.old sudo apt-get install rename sudo apt-get install perl