On (29/02/16 11:36), Noriko Hosoi wrote:
On 02/29/2016 11:01 AM, Lukas Slebodnik wrote:
>On (29/02/16 18:43), Noriko Hosoi wrote:
>>wrappers/systemd.template.service.in | 2 +-
>>1 file changed, 1 insertion(+), 1 deletion(-)
>>
>>New commits:
>>commit 1e2cfe2ea4ebc7ac31f292bf0076cc1befd15a78
>>Author: Viktor Ashirov <vashirov(a)redhat.com>
>>Date: Mon Feb 29 19:07:12 2016 +0100
>>
>> Ticket 48747 - dirsrv service fails to start when nsslapd-listenhost is
configured
>> Bug Description:
>> In some environments network initialization takes a long time (slow DHCP,
etc).
>> When nsslapd-listenhost is configured, dirsrv systemd service fails to start,
>> because it doesn't wait for the network to be available.
>> Fix Description:
>> Make dirsrv@.service wait for network.service
>>
https://fedorahosted.org/389/ticket/48747
>> Reviewed by nhosoi(a)redhat.com.
>>
>>diff --git a/wrappers/systemd.template.service.in
b/wrappers/systemd.template.service.in
>>index 629c1ad..3eb0789 100644
>>--- a/wrappers/systemd.template.service.in
>>+++ b/wrappers/systemd.template.service.in
>>@@ -15,7 +15,7 @@
>>[Unit]
>>Description=@capbrand@ Directory Server %i.
>>PartOf=@systemdgroupname@
>>-After=chronyd.service
>>+After=chronyd.service network.service
> ^^^^^^^^^^^^^^^
> I'm not sure it is a right solution.
>network.service:
>● network.service - LSB: Bring up/down networking
> Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
> Active: inactive (dead)
> Docs: man:systemd-sysv-generator(8)
>
>I think you should use "network-online.target"
>more details in man 7 systemd.special
>or even better
http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget
>
>@see also ntpdate.service chrony-dnssrv@.service
>
>LS
Thanks for your input, Lukas!
I'm reading the docs you mentioned ...
https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/
> Alternatively, you can change your service that needs the network to be up,
to include After=network-online.target and Wants=network-online.target.
man 7 systemd.special
>network-online.target
> Units that strictly require a configured network connection
>should pull in
> network-online.target (via a Wants= type dependency) and order
>themselves after it. This
> target unit is intended to pull in a service that delays further
>execution until the
> network is sufficiently set up. What precisely this requires is
>left to the implementation
> of the network managing service.
>
> Note the distinction between this unit and network.target. This
>unit is an active unit
> (i.e. pulled in by the consumer rather than the provider of this
>functionality) and pulls
> in a service which possibly adds substantial delays to further
>execution. In contrast,
> network.target is a passive unit (i.e. pulled in by the provider
>of the functionality,
> rather than the consumer) that usually does not delay execution
>much. Usually,
> network.target is part of the boot of most systems, while
>network-online.target is not,
> except when at least one unit requires it. Also see Running
>Services After the Network is
> up[1] for more information.
>
> All mount units for remote network file systems automatically
>pull in this unit, and order
> themselves after it. Note that networking daemons that simply
>provide functionality to
> other hosts generally do not need to pull this in.
So, you think this does not give enough delay for the Directory Server's
start?
I'm not sure about delay but "network.service" is not mentioned
on that
page and it's not used by many services
grep -Rn "network.service" /usr/lib/systemd/
/usr/lib/systemd/system/arp-ethers.service:5:After=network.service
/usr/lib/systemd/system/NetworkManager.service:4:Before=network.target network.service
> +After=chronyd.service network.service
And you suggest we should do
+After=chronyd.service network-online.target
as well as this?
+Wants=network-online.target
I think that this one should be used
because "network.service" is mentioned only in NetworkManager.service on my
machine and IMHO it needn't guarantee that network is online.
network-online.target should be more reliable
/usr/lib/systemd/system/NetworkManager.service:4:Before=network.target network.service
But you my ask systemd guys about difference between "network.service"
and "network-online.target"
{lnykryn,msekleta} at redhat dot com
or on IRC
LS