I want to make a log of my experiences with upgrading my email server from Ubuntu 14.04 to 16.04.

When the installation upgraded the mysql installation, it tried to create the database “performance_schema”, which already existed. This caused the package upgrading to fail.

Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...

mysql start/running, process 20549
Checking if update is needed.
Checking server version.
Running queries to upgrade MySQL server.
mysql_upgrade: [ERROR] 1007: Can't create database 'performance_schema'; database exists
mysql_upgrade failed with exit status 5
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
 Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
Log ended: 2016-06-15 15:04:17

So I had to drop the table and re-run the apt process. I didn’t care because I didn’t have anything in mysql I cared about too much (I had just turned it on to add a database to track DMARC reports, and I had some legacy stuff in it).

Also, it warns me that the databases need to be upgraded using “mysql-upgrade.”

Next, once I tried to check my email through Courier-IMAP-SSL, I ran into this problem:

Thunderbird told me that there was a log-in problem and I need to change the password. Here is the error message in /var/log/mail.log:

imapd: authdaemon: s_connect() failed: No such file or directory

This obscure message caused me to search around a lot until I finally found a site that off hand mentioned that this is an issue if the authdaemon is not running. I wish the error message would have been more specific. For some reason, “systemd” decided not to start it on boot. The command “systemctl status courier-authdaemon.service” showed that it was disabled. So I enabled it and started it:

sudo systemctl enable courier-authdaemon.service
sudo systemctl start courier-authdaemon.service

Problem solved!

Another interesting wrinkle. I could not get my “opendmarc” service to start. It turns out that when you end a variable with a comment in the “/etc/default/opendmarc” file, systemctl pastes it verbatim onto the command line and executes the command. Here is an excerpt from my default file:

SOCKET="inet:12345@localhost" # listen on loopback on port 12345

The command looks like this in the opendmarc.service stub:

ExecStart=/usr/sbin/opendkim -x /etc/opendkim.conf -u opendkim -P /var/run/opendkim/opendkim.pid -p $SOCKET $DAEMON_OPTS

However, when I try to start the service, I kept getting the usage for the command, as if I’d specified an incorrect option. It turns out that when $SOCKET is resolved, the comment as well shows up on the command line. So it looks like this:

/usr/sbin/opendkim -x /etc/opendkim.conf -u opendkim -P /var/run/opendkim/opendkim.pid -p "inet:12345@localhost" # listen on loopback on port 12345

Of course, this fails, but it was hard to track down!