From: Jonas Theisen <j.theisen@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-manager v2] api: nodes: dns: restart postfix after changing name servers
Date: Tue, 10 Nov 2026 10:31:57 +0100 [thread overview]
Message-ID: <20261110093204.101150-1-j.theisen@proxmox.com> (raw)
Postfix runs its SMTP client in a chroot and copies /etc/resolv.conf
into it only when the instance starts. A running postfix therefore
keeps using the old name servers after a DNS settings change,
which can make mail delivery fail until the next restart.
Use try-restart on postfix.service after writing the new settings, so
postfix is only restarted if it is running.
A failed restart only warns, since the DNS settings were already
written.
Came up in: https://forum.proxmox.com/threads/187442
changes since v1:
* use postfix.service instead of postfix@-
* use try-restart instead of an is-active check plus restart
* replaced run_command with PVE::Cmd::run
Signed-off-by: Jonas Theisen <j.theisen@proxmox.com>
---
PVE/API2/Nodes.pm | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index df0b2c2d..1e2a96f1 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -1671,6 +1671,10 @@ __PACKAGE__->register_method({
PVE::INotify::update_file('resolvconf', $param);
+ # postfix copies resolv.conf into its chroot only on start; a reload does not refresh it
+ eval { PVE::Cmd::run(['systemctl', 'try-restart', 'postfix.service']) };
+ warn "failed to restart postfix - $@" if $@;
+
return;
},
});
--
2.47.3
next reply other threads:[~2026-11-10 9:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 9:31 Jonas Theisen [this message]
2026-11-10 19:13 ` applied: [PATCH pve-manager v2] api: nodes: dns: restart postfix after changing name servers Thomas Lamprecht
2026-11-10 19:22 ` Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261110093204.101150-1-j.theisen@proxmox.com \
--to=j.theisen@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.