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 <[email protected]> --- 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
