Upgrading SQLGrey Debian Wheezy to Jessie

SQLGrey itself will not be updated during the upgrade towards Jessie, however the change to Systemd will result in a stub automatically created by Systemd around the original init. The problem I encountered was, that SQLGrey would start before my database (MySQL). Hence you receive something like the following in /var/log/syslog

sqlgrey: dbaccess: can't connect to DB: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock’

The problem here is, that the generated stub is not obeying the init scripts dependencies and not having any Systemd ones, hence the services are starting in a “wild” order.

So what is the solution

We need to create at least the SQLGrey unit file and add the dependency into it. Create /etc/systemd/system/sqlgrey.service and add:

[Unit]
Description=SQLgrey Postfix Grey-listing Policy service
After=syslog.target network.target mysql.service
[Service]
Type=forking
PIDFile=/var/run/sqlgrey.pid
ExecStart=/usr/sbin/sqlgrey -d
[Install]
WantedBy=multi-user.target

Note the mysql.service in the After line. This is the needed dependency.

As you might have noticed, there is no mysql.service unit file existing, as the package maintainers have deprioritized to create one (there are two bugs #765425 and #742900.

However you can reference the stubs as well. If you need to adapt this for other services: To find the name of the stub you can use systemd-analyze blame. It gives you a list of the services started. Details you can get with systemctl, e.g. systemctl status mysql.service. The details will tell you in the Loaded line if it is a real unit file or just a init script stub.

Full article view...

Upgrading Dovecot Debian Wheezy to Jessie

The automatic upgrade is pretty straight forward and you probably need only to check the configs for changes and merge them. For me dovecot came up after the restart and was doing its work. However I received the following errors in /var/log/mail.err

dovecot: master: Error: systemd listens on port 143, but it's not configured in Dovecot. Closing.
dovecot: master: Error: systemd listens on port 993, but it's not configured in Dovecot. Closing.
dovecot: master: Error: systemd listens on port 993, but it's not configured in Dovecot. Closing.

Looking for this in the net, I could only find a maintainer discussion about socket vs. service configuration and what happens if both is set? What config should have precedence (the config actually).

That pointed me to the socket configuration within Systemd. Indeed within the update the socket unit file was activated (in /etc/systemd/system/sockets.target.wants).

So what is the solution

To get rid of the error, just deactivate the dovecot.socket via systemctl disable dovecot.socket.

Full article view...