On 2024-12-12 15:57:59 +0300, Michael Tokarev wrote:
> On Tue, 30 Apr 2024 16:33:14 +0200 Vincent Lefevre <vinc...@vinc17.net> wrote:
> > I had to do "cp /etc/resolv.conf /var/spool/postfix/etc/resolv.conf".
> 
> Does it fix itself when you restart postfix?

No, it doesn't, because it seems that it is only
/etc/network/if-up.d/postfix that does the copy, while this script
is not involved when one restarts postfix.

(There's also /etc/ppp/ip-up.d/postfix, but my networks do not use
ppp.)

> Or is only about while the system is running *and* moving between
> different networks?

Not even that either: If I move to a different wiki network, the
wireless interface remains up; it is just the associated IP address
that changes. So /etc/network/if-up.d/postfix is not re-executed.

> There's a note in /usr/share/doc/postfix/README.Debian[.gz] which
> suggests to enable systemd path units for resolv.conf (though I
> do *not* recommend doing this now).

If I understand correctly, when everything is enabled: When
postfix-resolvconf.path detects that /etc/resolv.conf has changed,
it activates the postfix-resolvconf.service unit, which runs
/etc/resolvconf/update-libc.d/postfix, which copies /etc/resolv.conf
to the chroot directory and reloads postfix.

So this could solve the issue, but might yield a race condition
with other scripts like /etc/network/if-up.d/postfix when run
(e.g. postfix might be reloaded while the resolv.conf target is
temporarily empty due to the cp from the other script).

> And there are hooks for NetworkManager which should - in theory -
> update resolv.conf in postfix when things changes.  I wonder why
> they don't run.

I do not see any hook under /etc/NetworkManager. But AFAIK, it
is up to the postfix package to provide hooks (like it does for
/etc/network/if-*.d and ppp).

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Reply via email to