From 3eb45fee7541858d797d6efcadf880fd551c8df1 Mon Sep 17 00:00:00 2001 From: Nick J Lange Date: Fri, 6 Jan 2023 00:36:26 -0500 Subject: [PATCH 1/2] Update unbound.md Per discussion on thread - https://discourse.pi-hole.net/t/warning-raspbian-october-2021-release-bullseye-unbound/51027/45 - Draft PR Signed-off-by: Nick J Lange --- docs/guides/dns/unbound.md | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/docs/guides/dns/unbound.md b/docs/guides/dns/unbound.md index c0293f8..c467656 100644 --- a/docs/guides/dns/unbound.md +++ b/docs/guides/dns/unbound.md @@ -183,13 +183,21 @@ Finally, configure Pi-hole to use your recursive DNS server by specifying `127.0 (don't forget to hit Return or click on `Save`) -### Disable `resolvconf` for `unbound` (optional) +### Disable `resolvconf.conf` entry for `unbound` (Required for Debian Bullsye+ releases) -The `unbound` package can come with a systemd service called `unbound-resolvconf.service` and default enabled. -It instructs `resolvconf` to write `unbound`'s own DNS service at `nameserver 127.0.0.1` , but without the 5335 port, into the file `/etc/resolv.conf`. -That `/etc/resolv.conf` file is used by local services/processes to determine DNS servers configured. -If you configured `/etc/dhcpcd.conf` with a `static domain_name_servers=` line, these DNS server(s) will be ignored/overruled by this service. +Recent Debian-based OS releases auto-install a package called [`openresolv`](https://wiki.archlinux.org/title/Openresolv), which will cause unexpected behaviour for pihole and unbound. Openresolv's service/config instructs `resolvconf` to write `unbound`'s own DNS service at `nameserver 127.0.0.1` , but without the 5335 port, into the file `/etc/resolv.conf`. That `/etc/resolv.conf` file is used by local services/processes to determine DNS servers configured. You need to remove openresolv, or edit the configuration file and disable the service to work-around the misconfiguration. +#### Option 1 - Remove openresolv + +If you are sure you don't need the features of openresolv, then removal of the package is the simplest option. + +```bash +sudo apt purge openresolv +``` + +#### Option 2 - Step 1 - Disable the Service + +openresolv has a systemd service called `unbound-resolvconf.service.` To check if this service is enabled for your distribution, run below one and take note of the `Active` line. It will show either `active` or `inactive` or it might not even be installed resulting in a `could not be found` message: @@ -197,16 +205,26 @@ It will show either `active` or `inactive` or it might not even be installed res sudo systemctl status unbound-resolvconf.service ``` -To disable the service if so desire, run below two: +To disable the service if so desire, run the two statements below: ```bash sudo systemctl disable unbound-resolvconf.service +sudo systemctl stop unbound-resolvconf.service + ``` + +#### Option 2 - Step 2 - Disable the file resolvconf_resolvers.conf + +Disable the file resolvconf_resolvers.conf from being generated when resolvconf is invoked elsewhere. + ```bash -sudo systemctl stop unbound-resolvconf.service +sudo cat /etc/resolvconf.conf | sed -E 's/^unbound_conf=(.*)/#unbound_conf=\1/' > /etc/resolvconf.conf +sudo rm /etc/unbound/unbound.conf.d/resolvconf_resolvers.conf ``` +### Alternative Solution - Step 1 + To have the `domain_name_servers=` in the file `/etc/dhcpcd.conf` activated/propagate, run below one: ```bash From bcce73a47b8a207836fab2af016c993c2edd098a Mon Sep 17 00:00:00 2001 From: Nick J Lange Date: Sun, 22 Jan 2023 15:42:51 -0500 Subject: [PATCH 2/2] Update docs/guides/dns/unbound.md Co-authored-by: MichaIng Signed-off-by: Nick J Lange --- docs/guides/dns/unbound.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/dns/unbound.md b/docs/guides/dns/unbound.md index c467656..0aff8b9 100644 --- a/docs/guides/dns/unbound.md +++ b/docs/guides/dns/unbound.md @@ -219,7 +219,7 @@ sudo systemctl stop unbound-resolvconf.service Disable the file resolvconf_resolvers.conf from being generated when resolvconf is invoked elsewhere. ```bash -sudo cat /etc/resolvconf.conf | sed -E 's/^unbound_conf=(.*)/#unbound_conf=\1/' > /etc/resolvconf.conf +sudo sed -Ei 's/^unbound_conf=/#unbound_conf=/' /etc/resolvconf.conf sudo rm /etc/unbound/unbound.conf.d/resolvconf_resolvers.conf ```