* [PATCH pve-manager v2] api: nodes: dns: restart postfix after changing name servers
@ 2026-11-10 9:31 Jonas Theisen
2026-11-10 19:13 ` applied: " Thomas Lamprecht
0 siblings, 1 reply; 3+ messages in thread
From: Jonas Theisen @ 2026-11-10 9:31 UTC (permalink / raw)
To: pve-devel
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
^ permalink raw reply related [flat|nested] 3+ messages in thread* applied: [PATCH pve-manager v2] api: nodes: dns: restart postfix after changing name servers
2026-11-10 9:31 [PATCH pve-manager v2] api: nodes: dns: restart postfix after changing name servers Jonas Theisen
@ 2026-11-10 19:13 ` Thomas Lamprecht
2026-11-10 19:22 ` Thomas Lamprecht
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Lamprecht @ 2026-11-10 19:13 UTC (permalink / raw)
To: pve-devel, Jonas Theisen
On Tue, 10 Nov 2026 10:31:57 +0100, Jonas Theisen wrote:
> 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.
>
> [...]
Applied, thanks!
[1/1] api: nodes: dns: restart postfix after changing name servers
https://git.proxmox.com/?p=pve-manager.git;a=commitdiff;h=47df03e04a471b9041f5217dbe887d9ee890ac0b
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: applied: [PATCH pve-manager v2] api: nodes: dns: restart postfix after changing name servers
2026-11-10 19:13 ` applied: " Thomas Lamprecht
@ 2026-11-10 19:22 ` Thomas Lamprecht
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2026-11-10 19:22 UTC (permalink / raw)
To: pve-devel, Jonas Theisen
Am 10.11.26 um 20:16 schrieb Thomas Lamprecht:
> On Tue, 10 Nov 2026 10:31:57 +0100, Jonas Theisen wrote:
>> 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.
>>
>> [...]
>
> Applied, thanks!
>
> [1/1] api: nodes: dns: restart postfix after changing name servers
> https://git.proxmox.com/?p=pve-manager.git;a=commitdiff;h=47df03e04a471b9041f5217dbe887d9ee890ac0b
what I forgot to mention:
I dropped the patch changelog from the commit message, that doesn't belong
in the permanent git history, it's rather relevant for development and
review of a series – else series with lots of churn and double digits would
consist mostly of changelogs from unrelated versions. If you place these in
the diff-stat section, i.e below "---" like
```
---
changes since v1:
...
PVE/API2/Nodes.pm | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
```
It will be visible on list but ignored by git on apply.
As I was touching this anyway I also merged "nodes dns" into one tag
(the idea is to have a rough subsystem like tag not a direct mapping
of the file or api path with s!/!:! applied) and used a Link trailer
for the forum link – again, only because I touched the commit message
anyway, else I would not had bothered, these are tiny and partially
subjective nits.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-10 19:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-10 9:31 [PATCH pve-manager v2] api: nodes: dns: restart postfix after changing name servers Jonas Theisen
2026-11-10 19:13 ` applied: " Thomas Lamprecht
2026-11-10 19:22 ` Thomas Lamprecht
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.