Bug 254076 - dns/powerdns-recursor: missing configuration for pid file
Summary: dns/powerdns-recursor: missing configuration for pid file
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
Depends on:
Reported: 2021-03-07 00:16 UTC by Max Christian
Modified: 2021-06-12 12:35 UTC (History)
2 users (show)

See Also:
tremere: maintainer-feedback+


Note You need to log in before you can comment on or make changes to this bug.
Description Max Christian 2021-03-07 00:16:26 UTC
Dear tagattie! First of all thank you for the port!

For the problem I want to report I already have a fix for: The powernds-recursor could not be restarted on two of my machines with `service pdns-recursor restart` and produced an error message

Mar 07 00:56:53 Exception: Resolver binding to server socket on port 53 for *.*.*.*: Address already in use
/usr/local/etc/rc.d/pdns-recursor: WARNING: failed to start pdns_recursor

and after reading the terminal output a little further I noticed another line saying:

`pdns_recursor not running? (check /var/run/pdns-recursor/pdns_recursor.pid).`

I found out, that there was no pid-file ever created in that location and was able to fix it by adding `socket-dir=/var/run/pdns-recursor` to the `/usr/local/etc/pdns/recursor.conf`. I now wonder if that should not be its default value ever since bug 244657
Comment 1 Ralf van der Enden 2021-03-08 12:08:07 UTC
Hi Max,

The error you got said 'Address already in use'. So something else was running on port 53 which caused startup to fail. Ofcourse the PID listen in the .pid file wasn't running, which caused the rc.d script to tell you it's not running.

I've tested stopping the recursor, removing the /var/run/pdns-recursor directory, reinstalling the port (which creates the direcvtory again) and then starting it again. Everything works as expected. the socket-dir directive in my configuration is commented out, so it's using the default (which changed some versions back from /var/run to /var/run/pdns-recursor)

IMO no fix is necessary since everything works as expected.
Comment 2 Max Christian 2021-03-12 21:34:37 UTC
Hi Ralf!

I have rechecked my configuration as well and can now further explain what happens: The `socket-dir` in the configuration file is also used to tell pdns-recursor where to store the PID file¹, while the `/usr/local/etc/rc.d/pdns-recursor` init script has this path hard-coded to `/var/run/pdns-recursor/${name}.pid`.

The 'Address already in use' error is a consequence of that, because I used `service pdns-recursor restart` with a manually configured `socket-dir`. Because of that the init script was unable to kill the previous instance before it tried to start another.

¹ https://docs.powerdns.com/recursor/settings.html#socket-dir
Comment 3 Ralf van der Enden 2021-04-11 22:49:11 UTC
Hi Max,

Sorry for my late response. I was struggling to get the rc.d script to behave and fix your issue. With the update to 4.4.3 I also reworked that script so it should always write the pidfile to /var/run (no sub-directory) and since it uses /usr/sbin/daemon now, I chose to use the -r parameter so it will restart the recursor if it dies for any reason.

Hope that helps with the issue you were having.

Comment 4 Ralf van der Enden 2021-06-12 12:22:56 UTC
Please close this PR. Already fixed in PR bug #254865
Comment 5 Mark Linimon freebsd_committer freebsd_triage 2021-06-12 12:35:23 UTC
^Triage: OBE, see PR 256530.