Ubuntu sendmail installation hangs.
https://askubuntu.com/questions/937666/ubuntu-16-04-command-line-sendmail-installation-hanged
when it hangs we need to kill the process
https://askubuntu.com/questions/219545/dpkg-error-dpkg-status-database-is-locked-by-another-process
mail takes forever to send?
https://www.digitalocean.com/community/questions/sendmail-is-slow-to-send-mail
If you check your /var/log/mail.log you will probably find something like this: My unqualified host name (localhost) unknown; sleeping for retry. This is because sendmail requires "hostname" to be a fully qualified domain name.
update your "/etc/hosts" file: nano /etc/hosts
to look like this: 127.0.0.1 localhost.localdomain localhost yourhostname