NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.5k stars 13.68k forks source link

dnsmasq service does not check errors in custom configuration (extraConfig) #41225

Open stefano-m opened 6 years ago

stefano-m commented 6 years ago

Issue description

If services.dnsmasq.extraConfig has errors, these are not checked by the systemd unit before starting, making debugging difficult.

Steps to reproduce

  1. Configure dnsmasq wrongly
services.dnsmasq.enable = true;
services.dnsmasq.extraConfig = "this-is-wrong";
  1. Run nixos-rebuild test
  2. The systemd dnsmasq.service will fail without useful information

Possible solution

Make so that the preStart attribute in dnsmasq.nix tests against dnsmasqConf

https://github.com/NixOS/nixpkgs/blob/fdb5ba4cdf9f61e3cba204cbb5b1f81e49231958/nixos/modules/services/networking/dnsmasq.nix#L10

"dnsmasq --test -C ${dnsmasqConf}"

Note that by running the command manually like /nix/store/.../bin/dnsmasq --test -C /nix/store/.../dnsmasq.conf I was able to nail down the configuration errors quite easily.

Technical details

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.
expipiplus1 commented 3 years ago

Ideally this would check the config at rebuild time, like nginx does

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info