all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH pve-network] SDN: dhcp: add second check for dnsmasq
@ 2026-02-12 15:59 Lukas Sichert
  0 siblings, 0 replies; only message in thread
From: Lukas Sichert @ 2026-02-12 15:59 UTC (permalink / raw)
  To: pve-devel; +Cc: Lukas Sichert

Currently, in a system with
-dnsmasq not installed,
-dnsmasq-base installed,
-a zone configured,
applying a change to '/etc/network/interfaces' returns the error: 'Could
not run before_regenerate for DHCP plugin dnsmasq command 'systemctl
disable dnsmasq@' failed: exit code 1'.
This is due to the system trying to regenerate the dnsmasq-config when a
change is applied.  Before regenerating, it only checks if dnsmasq-base
is present and then tries to disable the dnsmasq systemd service.

It is important to note, that the changes are applied, but the task
exits with an error afterward.

This commit checks if dnsmasq is installed and not just dnsmasq-base by
querying for the file'/lib/systemd/system/dnsmasq.service'.

Signed-off-by: Lukas Sichert <l.sichert@proxmox.com>
---

Notes:
    The file could be removed in future versions or it could be deleted by
    the user.
    Perhaps a more robust way would be to check if both packages
    `dnsmasq` and `dnsmasq-base` are installed?
    I am very thankful for any opinions or suggestions regarding this.

 src/PVE/Network/SDN/Dhcp/Dnsmasq.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm b/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
index fe46cbb..477b700 100644
--- a/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
+++ b/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
@@ -25,7 +25,8 @@ my sub assert_dnsmasq_installed {
     my ($noerr) = @_;
 
     my $bin_path = "/usr/sbin/dnsmasq";
-    if (!-e $bin_path) {
+    my $dnsmasq_service_path = "/lib/systemd/system/dnsmasq.service";
+    if (!-e $bin_path || !-e $dnsmasq_service_path) {
         return if $noerr; # just ignore, e.g., in case zone doesn't use DHCP at all
         log_warn("please install the 'dnsmasq' package in order to use the DHCP feature!");
         die "cannot reload with missing 'dnsmasq' package\n";
-- 
2.47.3




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-02-12 15:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-12 15:59 [PATCH pve-network] SDN: dhcp: add second check for dnsmasq Lukas Sichert

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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal