Is this proof that systemd is completely broken?

Corinna Vinschen fedora at cygwin.de
Sat Jul 12 18:26:29 UTC 2014


On Jul 12 12:01, Sam Varshavchik wrote:
> Corinna Vinschen writes:
> [something]
> This is certainly a valid workaround for the bug.
> 
> But this wasn't my point. I am looking for validation, based on the data I
> posted, that systemd's dependency resolution is broken.
> [...]

Hmm, ok.  Let's try.

>>> Problem number one is that all servers specify "After=network.target", when,
>>> according to how I interpret this, they should all really specify
>>> "After=network-online.target".

Yes and no.  The problem is not that network.target is always wrong, but
it's wrong for services which don't use Linux-specific functionality
like rtnetlink or IP_FREEBIND.  OpenSSH's sshd, for instance, doesn't
utilize these Linux-specials so it clearly should depend on
network-online.target.  It really doesn't help to blame OpenSSH and
ignore the server's capabilities when writing the sshd.service file,
IMHO.  For services which are capable of handling network interface
changes, network.target is fine.

>>> [Unit]
>>> Description=Wait for network ports to be initialized
>>> Before=network.target network-online.target
>>> 
>>> [Service]
>>> Type=oneshot
>>> ExecStart=/root/bin/wait-for-network
>>> 
>>> [Install]
>>> WantedBy=multi-user.target

AFAIU Before/After only define the order, not requirements.  From
the man page systemd.unit:

  Before=, After=
     A space-separated list of unit names. Configures ordering
     dependencies between units. If a unit foo.service contains a
     setting Before=bar.service and both units are being started,
     bar.service's start-up is delayed until foo.service is started up. 

Note especially the last line I quoted.  network.target is not
necessarily reached only after the SysV Init network service script has
run to completion as outlined in
http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/
So your service runs as designed, AFAICS.


Corinna


More information about the users mailing list