Debian Jessie Uses Systemd

Debian Jessie uses systemd, which means some of my programs (daemons) no longer start.

systemd, sysvinit, upstart

In the old days, all your daemon startup scripts were typically in /etc/init.d/.

With the release of Debian Jessie, however, daemon startup scripts are now located in /etc/init.d/, /etc/init/, and /lib/systemd/system.

Unlike upstart and sysvinit, systemd overides the parameters passed to a sysvinit script. For example, spindown no longer shows which disks are in standby state when I type sudo service spindown status or sudo /etc/init.d/spindown status.

Likewise, when I switched from Wheezy to Jessie varnish stopped working properly because it is now a systemd service meaning the sysvinit script pointing at /etc/default/varnish was now being ignored.

In this article I am going to fix these two issues.

Spindown Status

Spindown status is an easy fix. I simply edited /etc/init.d/spindown and changed "status") to "status2") in the switch case code block.

Now when I type sudo service spindown status2 or sudo /etc/init.d/spindown status2 I once again get the status of the watched disks, rather than the systemd status of the service.


Varnish is a bit tougher to solve because it has switched to systemd as well.

The basics, however, are as follows.

sudo su
grep -v "^#" /etc/default/varnish > /etc/varnish/varnish.params
nano /etc/varnish/varnish.params

Delete the DAEMON_OPTS= multi-line parameter, save the file, and close it.

echo VARNISH_USER=varnish >> /etc/varnish/varnish.params
echo VARNISH_GROUP=varnish >> /etc/varnish/varnish.params
nano /lib/systemd/system/varnish.service
Description=Varnish HTTP accelerator

#ExecStartPre=/usr/sbin/varnishd -C -f /etc/varnish/default.vcl
#ExecStart=/usr/sbin/varnishd -a :6081 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
ExecStartPre=/usr/sbin/varnishd -C -f $VARNISH_VCL_CONF
ExecStart=/usr/sbin/varnishd \
        -P /var/run/ \
        -f $VARNISH_VCL_CONF \
        -t $VARNISH_TTL \
        -u $VARNISH_USER \
        -g $VARNISH_GROUP \
        -s $VARNISH_STORAGE \


systemctl daemon-reload
service varnish restart

Varnish should now be working again.


After a bit of maintenance earlier (2015-10-21) I could not access my mail. It turned out that Dovecot was refusing to start.

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

The problem turned out to be due to socket connections and/or a slight misconfiguration.

To disable dovecot using socket connections:

sudo systemctl disable dovecot.socket

To fix the configuration file, open /etc/dovecot/conf.d/10-master.conf and make sure each active inet_listener has an address associated with it.

  inet_listener imaps {
    port = 993
    ssl = yes
  inet_listener imaps {
        address = *
    port = 993
    ssl = yes

Previously I was relying on no address being equal to all IP addresses because my home server has a dynamic IP address. This modification does the same thing (albeit having to be specified rather than assumed).

A restart of dovecot and imapproxyd later and I am able to access my mail again. Because postfix uses dovecot for authentication, I am not yet sure if disabling sockets will have any unintended side-effects.