Ubuntu 16.04 command line sendmail installation hanged

I was trying to install sendmail but it is hanging while trying to generate ssl certificates. I have canceled the installation process and later killed processes that was locking any new packages from installing.

But whenever I run apt-get install <package_name> it goes back to the sendmail installation and trys to install the ssl certs.

I have rebooted the system but problem is persisted.

How do I resolve this?

CLI Information

sudo dpkg --configure -a
Setting up sendmail-bin (8.15.2-3) ...
Updating sendmail environment ...
Reading configuration from /etc/mail/sendmail.conf.
Validating configuration.
Writing configuration to /etc/mail/sendmail.conf.
Writing /etc/cron.d/sendmail.
Disabling HOST statistics file(/var/lib/sendmail/host_status).
Reading configuration from /etc/mail/sendmail.conf.
Validating configuration.
Writing configuration to /etc/mail/sendmail.conf.
Writing /etc/cron.d/sendmail.
Could not open /etc/mail/databases(No such file or directory), creating it.
Reading configuration from /etc/mail/sendmail.conf.
Validating configuration.
Creating /etc/mail/databases...

Checking filesystem, this may take some time - it will not hang!
  ...   Done.

Checking for installed MDAs...
sasl2-bin not installed, not configuring sendmail support.

To enable sendmail SASL2 support at a later date, invoke "/usr/share/sendmail/update_auth"


Creating/Updating SSL(for TLS) information
Creating /etc/mail/tls/starttls.m4...
Creating SSL certificates for sendmail.

A similar problem can be found here but there wasn't a solution. OP just changed the OS.


I just experienced this problem also. It appears to hang on line 240 of this script /usr/share/sendmail/update_tls.

To solve the problem, I executed the following commands:

cd /etc/mail/tls
sudo openssl dsaparam -out sendmail-common.prm 2048
sudo chown root:smmsp sendmail-common.prm
sudo chmod 0640 sendmail-common.prm
sudo dpkg --configure -a

It should now install.