Bug#734007: document implicit After= of service on socket

Felipe Sateler fsateler at debian.org
Tue Jun 30 04:44:24 BST 2015


Control: forwarded -1 https://github.com/systemd/systemd/issues/418
Control: tags -1 confirmed upstream

On Thu, 02 Jan 2014 16:52:55 -0800 Russ Allbery <rra at debian.org> wrote:
> Package: systemd
> Version: 204-6
> Severity: minor
>
> As part of the discussion in the tech-ctte bug report, there seemed to
> be general agreement (I haven't checked the source code) that systemd
> automatically adds an implicit After= to a service unit on a socket
> unit with the same name.  I don't think this is currently documented
> in systemd.service(5).

On v220, it is in systemd.socket:

>       Socket units will have a Before= dependency on the service which they trigger added implicitly. No implicit WantedBy= or RequiredBy= dependency from the socket to the
>       service is added. This means that the service may be started without the socket, in which case it must be able to open sockets by itself. To prevent this, an explicit
>       Requires= dependency may be added.


>
> There should probably also be a note under Sockets= saying whether
> this implicit After= also applies to any units listed in Sockets=.

This is indeed not documented. Filed an upstream bug.

>
> It may also be good to note in daemon(7) under Socket-Based Activation
> (maybe, or maybe under Writing Systemd Unit Files) that service units
> written to support socket activation should consider a Requires= on
> the socket unit.  Without this, it's possible to get inconsistent
> behavior if the service is not configured to start at boot and then
> it's started manually, or if the admin disables the socket.  This may
> be intentional flexibility in some cases, where the service unit is
> explicitly written to support either service activation or binding its
> own sockets, but I at least found the behavior without Requires= to be
> surprising and unexpected.

This is already documented in systemd.socket as quoted above.

Saludos



More information about the Pkg-systemd-maintainers mailing list