From: Jonas Theisen <j.theisen@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-manager] api: nodes: dns: restart postfix after changing name servers
Date: Mon, 9 Nov 2026 11:51:20 +0100 [thread overview]
Message-ID: <20261109105127.96814-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.
Restart the postfix service after writing the new settings, but only
if it is currently active.
A failed restart only warns, since the DNS settings were already
written.
Came up in: https://forum.proxmox.com/threads/187442
Signed-off-by: Jonas Theisen <j.theisen@proxmox.com>
---
PVE/API2/Nodes.pm | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index df0b2c2d..35078d3b 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -1671,6 +1671,17 @@ __PACKAGE__->register_method({
PVE::INotify::update_file('resolvconf', $param);
+ # postfix copies resolv.conf into its chroot only on start, so a running instance needs a
+ # restart to use the new name servers
+ eval {
+ my $active = PVE::Tools::run_command(
+ ['systemctl', 'is-active', '--quiet', 'postfix@-'],
+ noerr => 1,
+ );
+ PVE::Tools::run_command(['systemctl', 'restart', 'postfix@-']) if $active == 0;
+ };
+ warn "failed to restart postfix - $@" if $@;
+
return;
},
});
--
2.47.3
next reply other threads:[~2026-11-09 10:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 10:51 Jonas Theisen [this message]
2026-11-10 8:31 ` [PATCH pve-manager] api: nodes: dns: restart postfix after changing name servers Dominik Csapak
2026-11-10 9:28 ` Jonas Theisen
2026-11-10 9:32 ` Jonas Theisen
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=20261109105127.96814-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox