From: Lukas Sichert <l.sichert@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Lukas Sichert <l.sichert@proxmox.com>
Subject: [PATCH pve-network] SDN: dhcp: add second check for dnsmasq
Date: Thu, 12 Feb 2026 16:59:32 +0100 [thread overview]
Message-ID: <20260212155932.44085-1-l.sichert@proxmox.com> (raw)
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
reply other threads:[~2026-02-12 15:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260212155932.44085-1-l.sichert@proxmox.com \
--to=l.sichert@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.