On Tue, 9 May 2017 11:03:59 +0200 Bernhard Schmidt <be...@debian.org> wrote:
> Am 08.05.2017 um 20:54 schrieb Scott Kitterman:
> 
> Hi Scott,
> 
> 
> > In the postinst, if the debconf configuration is something other than none 
or 
> > local, we create an override file with After=network-online.target, which 
is 
> > what I think is needed in most of these cases.  I did not add it to the 
> > service file because the documentation I read cautioned against using it 
when 
> > not absolutely required.
> > 
> > The big question that's left unanswered for me is do I need it for 
> > postfix@.service too?  Do I need to depend on some other service?
> 
> My proposal for stretch (minimal intrusive) would be to add
> 
> After=postfix.service
> 
> to postfix@.service.
> 
> This would (transitively) order postfix@.service after network.target,
> which means users of ifupdown/systemd-networkd will have networking
> configured at this point. I don't think we'd need network-online.target,
> there is nothing in most postfix configurations that actually needs
> network access to work on startup.
> 
> If I understand this correctly an additional benefit of ordering
> postfix@.service after postfix.service is that "service postfix reload"
> in various hooks will actually work when any instance is running.
> 
> I have tested this on top of 3.1.4-4 and it works for me.
> 
> 
> 
> I don't fully grasp the service override anyway.
> 
>     if [ -f /lib/systemd/systemd-resolved ] && \
>         [ ! -f /etc/systemd/system/postfix.service.d/override.conf ] ; then
>         if [ "$mailer" != "No configuration" ] && [ "$mailer" != "Local
> only" ]; then
>             echo "Adding systemd overrides to ensure network and name
> services available."
>             add_service_override
>         fi
>     fi
> 
> /lib/systemd/systemd-resolved is part of systemd, so the first part
> always evaluates to "true" if systemd is installed. If it wasn't adding
> the override file would have no consequences, so why bother with the
> conditional here?
> 
> Second, the override adds
> 
> [Unit]
> After=network-online.target
> After=systemd-resolved.service
> 
> I think network-online.target is unnecessary, as I'm not aware of any
> common postfix configurations that actually need network access to
> startup. At least the common case of postfix or SQL the connection is

If you specify an IP address in inet_interfaces, postfix will fail to start 
withhout the override to depend on network-online.target.  We can quibble 
about if that qualifies a common or not, but we got bug reports [1], so it's 
common enough in my opinion.

You may well be correct about the systemd-resolved.service.  I tried to work 
on this bug last night, but failed to make useful progress beyond learning 
that NetworkManager and systemd will conspire to restart postfix once 
resolv.conf is available, so the specific problem in this bug isn't an issue 
for an NM based system.  At least on the system with NM installed, nothing I 
tried (your suggestion or others) seemed to make a difference.  I need to rip 
NM out of my test system and see what I can figure out next.

Scott K

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=844277

Reply via email to