[systemd-devel] Target updating status for dependencies

Martin Pitt martin.pitt at ubuntu.com
Wed Jan 14 00:47:20 PST 2015

Hello all,

I have some trouble to understand how unit dependencies work when
they change status. Suppose I have an ifup-all-auto.target (which will
of course be created by a generator, but for experimentation I tried
with a plain unit):

| [Unit]
| Description=Wait until all "auto" ifupdown interfaces are up
| Before=network-online.target
| Requires=ifup at eth0.service
| After=ifup at eth0.service
| Requires=ifup at eth42.service
| After=ifup at eth42.service
| [Install]
| RequiredBy=network-online.target

After booting, ifup at eth0.service succeeds (active (exited)) as eth0
actually exists and works etc. But eth42 does not exist, thus it's in
state "failed (Result: exit-code)". Consequently,

| $ sudo systemctl status ifup-all-auto.target  -l
| ‚óŹ ifup-all-auto.target - Wait until all "auto" ifupdown interfaces are up
|    Loaded: loaded (/etc/systemd/system/ifup-all-auto.target; enabled; vendor preset: enabled)
|    Active: inactive (dead)
| Jan 14 09:34:58 autopkgtest systemd[1]: Dependency failed for Wait until all "auto" ifupdown interfaces are up.
| Jan 14 09:34:58 autopkgtest systemd[1]: Job ifup-all-auto.target/start failed with result 'dependency'.

(and obviously network-online.target is also in "dependency failed"
state). So we have

   ifup at eth0 (SUCCESS)     ifup at eth42 (FAIL)
            |                 |
            v                 v
          ifup-all-auto.target (DEP FAIL)
          network-online.target (DEP FAIL)

So far so good. But now I make eth42 appear (simulating server
situations where network interfaces just take a while to init) [1].
This causes ifup at eth42.service to get re-triggered via systemd's udev
rules, thus the status changes to "active (exited)", i. e. "success".

However, this doesn't seem to cause re-evaluation of the depending
units: After that, ifup-all-auto.target (and network-online.target)
are still in the same "dependency failed" state.

Calling "systemctl start ifup-all-auto.target" manually updates the
status, but at least in this case this should obviously happen

Is this not how dependencies are supposed to work? If not, I suppose I
rather need some active program in ifup-all-auto.target which waits
for all expected interfaces to appear by itself? Or can I somehow
cause the reverse dependencies of ifup at .service to re-trigger? I
didn't see anything obvious in the manpages.

Thanks in advance for any insights!


[1] ip link add name eth42 type veth peer name veth42

Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150114/c2265516/attachment.sig>

More information about the systemd-devel mailing list