[systemd-devel] Restart sequence: "systemctl restart rsyslog.service syslog.socket" often/sometimes fails

Lennart Poettering lennart at poettering.net
Wed Feb 4 07:44:41 PST 2015

On Wed, 04.02.15 15:53, Peter Valdemar Mørch (peter at morch.com) wrote:

> On Wed, Feb 4, 2015 at 2:34 PM, Lennart Poettering
> <lennart at poettering.net> wrote:
> > This is something that can be fixed by adding stricter deps between
> > the service and the socket, so that the socket is always required to
> > be started before the service. Something for the respective package
> > maintainers upstream to fix.
> So have I understood this correctly: That the order matters *is* a
> bug. Either in systemd (that provides
> /lib/systemd/system/syslog.socket) or in syslog-ng and rsyslog that
> provide e.g. /lib/systemd/system/syslog-ng.service ?

The latter.

> I'm worried that we manually have to figure out the correct ordering
> of names to "systemctl restart PATTERN...." and would like to be able
> to rely on systemctl to figure that out for us. Is that a reasonable
> long-term expectation? (And the reason order/sequence isn't mentioned
> in the man page?)

systemd follows the relations expressed via the deps. If you don't
tell systemd the right deps, then things will be executed in any
order, and things might not work.

> I have no idea what they *should* be, but to show what they *are*,
> here i show for syslog-ng. Seems to me that syslog-ng is clear about
> syslog.socket being a dependency:

It would be a good idea to add Requires=syslog.socket here (or even
BindsTo=syslog.socket), as well as After=syslog.socket...

> > cat /lib/systemd/system/syslog-ng.service
> [Unit]
> Description=System Logger Daemon
> Documentation=man:syslog-ng(8)
> [Service]
> Type=notify
> Sockets=syslog.socket
> ExecStart=/usr/sbin/syslog-ng -F
> ExecReload=/bin/kill -HUP $MAINPID
> StandardOutput=null
> Restart=on-failure


Lennart Poettering, Red Hat

More information about the systemd-devel mailing list