Comment 14 for bug 1466790

Revision history for this message
Stefan Bader (smb) wrote :

I think I may have a clue now what the problem is. Incidentally on my bare-metal servers the network interface seems to be brought up by something else than the ifup@.service. The status there reports it already up when the service runs. The same seems to be happening to MAAS instances after initial deployment. On first login dhclient is not running but after reboot it is, though then again the ifup@.service was not starting the interface.

The problem looks to be that systemd acts differently on ExecStart and ExecStart[Pre|Post] elements. In Vivid we still had only a ExecStart element which was a shell command running two ifup and some conditional ifquery command. In Wily this changed into a ExecStart which is ifup for hotplug and two ExecStartPost which are a second ifup (but this time for auto class) and an ifquery. The interface is brought up by the second ifup (as it is set to auto), but it seems systemd does not check/handle any processes started up in the background of a ExecStartPost.
So one way that fixed the dhclient issue was to exchange the hotplug and auto ifup calls, so auto was done in the ExecStart call. But that would only lead to problems if there was ever an interface in the hotplug class.

What seems to work for me (not sure this is all valid) is to make the service oneshot and have multiple ExecStart elements, like this:

[Service]
Type=oneshot
ExecStart=/sbin/ifup --allow=hotplug %I
ExecStart=/sbin/ifup --allow=auto %I
ExecStart=/sbin/ifquery --state %I
ExecStop=/sbin/ifdown %I
RemainAfterExit=true