Is there any way to configure a systemd service (e.g. serviceX) to wait for the connmand service to finish configuring network interfaces prior to serviceX running ? From what I understand of systemd, using or relying on the network.target is pointless because that functionality is horribly broken. The system I'm using (BeagleBone Black with Angstrom Linux) uses connman rather than NetworkManager.
According to systemd documentation, all systemd units that need to wait for a working online connection at boot time need to include the following:
[Unit]
...
Wants=network-online.target
After=network-online.target
If you want to be compatible with older systemd versions, you can also use:
[Unit]
...
Wants=network.target network-online.target
After=network.target network-online.target
That's for systemd. With NetworkManager (for completeness, I'm aware you're not using it), this works since the upstream versions 0.9.10 and some distributions including Fedora also worked with older upstream versions.
https://bugzilla.gnome.org/show_bug.cgi?id=728965
As you are using connman instead, you need to check whether connman implements network-online.target correctly. Checking connman 1.30 source code reveals no appearance of network-online.target at all, so I must assume that connman is lagging behind. You may want to start a feature request in connman and/or your linux distribution. In that case it would be nice if you added a note about it here.
Basically, with newer systemd versions, a network service that implements network-online.target correctly, and services using the correct dependencies, everything should work out of the box for the user.
According to a comment to the other answer, the Unit section of connman.service looks as follows:
[Unit]
Description=Connection service
After=syslog.target
There should really be at Before=network.target, at the least. The After=syslog.target is redundant with current systemd versions. But full implementation of network-online.target would be preferred.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With