[CentOS] Network services start before network is up since migrating to 7.2

Wed Dec 23 16:38:52 UTC 2015
Sylvain CANOINE <sylvain.canoine at tv5monde.org>

----- Mail original -----
> De: "Sylvain CANOINE" <sylvain.canoine at tv5monde.org>
> À: "centos" <centos at centos.org>
> Envoyé: Mercredi 23 Décembre 2015 12:26:39
> Objet: Re: [CentOS] Network services start before network is up since migrating to 7.2

> > # systemctl status network.target
> ● network.target - Network
>   Loaded: loaded (/usr/lib/systemd/system/network.target; static; vendor preset:
>   disabled)
>   Active: inactive (dead)
>     Docs: man:systemd.special(7)
>           http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget
> 
> Dead ? Hmmm...
Ok, I found the difference between the failing servers (I updated one more this morning, and the same symptom came) : the failing ones don't need to mount NFS shares.
So I didn't install nfs-utils, so there's not a rpc-statd-notify.service, which unit file contain "Requires=network.target"... And so there's no service "requiring" network.target at all !

Then I'm wondering :
1/ why "After=foo" does not imply "Requires=foo" for systemd. That's obvious, yet,
2/ why "After=foo" does not imply "Requires=foo" for systemd 219, while it appeared to be in systemd 208. Either it's a regression, or the behaviour of 208, although logical, is buggy.

Anyway, for the NetworkManager-opponents, it may be opportune to add a "Requires=network.target" on an usual network service's unit, such as sshd ou ntpd... Or, better, on network-online.target's unit.

I chose another solution : I made a symlink to /usr/lib/systemd/system/network/target in /etc/systemd/system/multi-user.target.wants/ directory ("systemctl enable network.target" sent me to hell). And voilà.

Sylvain.

Pensez ENVIRONNEMENT : n'imprimer que si ncessaire