Network manager breaks pi-hole

Purge dhcpcd5 again if want to have NM take over.
But you have to configure a static IP through NM.

EDIT: and probably best to run pihole -r and select reconfigure when all finished/up/running.

The below:

pi@raspberrypi:~ $ sudo netstat -nltup | grep 'Proto|:53 |:67 |:80 |:547 |:471[1-8] '
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1230/lighttpd
tcp 0 0 192.168.0.39:53 0.0.0.0:* LISTEN 596/dnsmasq
tcp6 0 0 :::80 :::* LISTEN 1230/lighttpd
udp 0 0 0.0.0.0:67 0.0.0.0:* 596/dnsmasq
udp 0 0 192.168.0.39:53 0.0.0.0:* 596/dnsmasq

Above is the one conflicting preventing pihole-FTL to bind to socket.
Dont need the dnsmasq binary as dnsmasq is already embedded into Pi-hole's own binary pihole-FTL.
You can purge dnsmasq.

It was already purged and NM has taken indeed over.
And Under IPv4 Settings, under Address (optional) I have placed the Pi's IP/Subnet mask and the gateway of the router. :wink:

Question: I want to bridge this from Wifi to ethernet. Wifi connects fine and I wanna bridge my lan and give the wifi's internet connected to lan to a router. The address stays the internal to the internal network. However the gateway, should now be the IP address of Pi?

Stupid question: Will piVPN play nicely if I do so?

Interestingly, dnsmasq is not installed:

pi@raspberrypi:~ $ sudo netstat -nltup | grep 'Proto|:53 |:67 |:80 |:547 |:471[1-8] '
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1230/lighttpd
tcp 0 0 192.168.0.39:53 0.0.0.0:* LISTEN 596/dnsmasq
tcp6 0 0 :::80 :::* LISTEN 1230/lighttpd
udp 0 0 0.0.0.0:67 0.0.0.0:* 596/dnsmasq
udp 0 0 192.168.0.39:53 0.0.0.0:* 596/dnsmasq
pi@raspberrypi:~ $ sudo apt-get purge dnsmasq
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'dnsmasq' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded.

Bridge pointers below:

I believe folks have gotten piVPN to work with Pi-hole.
Search Discourse here.

1 Like

I tried to purge dnsmasq and it was not installed.

Also:

pi@raspberrypi:~ $ apt policy dnsmasq
dnsmasq:
Installed: (none)
Candidate: 2.80-1+rpt1
Version table:
2.81-4 -1
-1 Index of /raspbian bullseye/main armhf Packages
2.80-1+rpt1 500
500 Index of /debian buster/main armhf Packages
2.80-1 500
500 Index of /raspbian buster/main armhf Packages

Must have come with NM.
Search the net how to disable dnsmasq in combination with NM for your distro.

https://manpages.debian.org/unstable/network-manager/NetworkManager.conf.5.en.html

dns
Set the DNS processing mode.

If the key is unspecified, default is used, unless /etc/resolv.conf is a symlink to /run/systemd/resolve/stub-resolv.conf, /run/systemd/resolve/resolv.conf, /lib/systemd/resolv.conf or /usr/lib/systemd/resolv.conf. In that case, systemd-resolved is chosen automatically.

default: NetworkManager will update /etc/resolv.conf to reflect the nameservers provided by currently active connections.

dnsmasq: NetworkManager will run dnsmasq as a local caching nameserver, using "Conditional Forwarding" if you are connected to a VPN, and then update resolv.conf to point to the local nameserver. It is possible to pass custom options to the dnsmasq instance by adding them to files in the "/etc/NetworkManager/dnsmasq.d/" directory. Note that when multiple upstream servers are available, dnsmasq will initially contact them in parallel and then use the fastest to respond, probing again other servers after some time. This behavior can be modified passing the 'all-servers' or 'strict-order' options to dnsmasq (see the manual page for more details).

Cannot repair my pihole. It states:


  [✓] Update local cache of available packages
  [i] Existing PHP installation detected : PHP version 7.3.19-1~deb10u1
  [i] Repair option selected
  [✓] Disk space check

  [✓] Checking apt-get for upgraded packages... 12 updates available
  [i] It is recommended to update your OS after installing the Pi-hole!

  [i] Installer Dependency checks...
  [i] Checking for dhcpcd5 (will be installed)
  [✓] Checking for git
  [✓] Checking for iproute2
  [✓] Checking for whiptail
  [✓] Checking for dnsutils
  [i] Processing apt-get install(s) for: dhcpcd5, please wait...
------------------------------------------------------------------------------------------------------------------------
E: Package 'dhcpcd5' has no installation candidate

As for dnsmasq, looking at it now

Yeah was afraid of that.
EDIT: at least it wont get installed :wink:
Delete the apt file you've created and run sudo apt update to revert.

but but but, that will reinstall dhcpcd5!

Ok, I am setting

sudo nano /etc/NetworkManager/NetworkManager.conf

[main]
plugins=ifupdown,keyfile
dns=none

Maybe it suffices to just disable dhcpcd5 so it wont conflict with NM:

sudo systemctl disable dhcpcd

EDIT: and also reboot to be sure and check:

sudo systemctl status dhcpcd

It is inactive indeed:

pi@raspberrypi:~ $ sudo systemctl status dhcpcd
● dhcpcd.service - dhcpcd on all interfaces
Loaded: loaded (/lib/systemd/system/dhcpcd.service; disabled; vendor preset:
Active: inactive (dead)
lines 1-3/3 (END)

So NM is still in charge, that is good. But pihole is still relying on dhcpcd?

However, pihole is still not running:
DNS service not running
and
FTL offline

As for dnsmasq and NM, I have added the dns=none in NM's conf and can no longer exit to the internet (because my VNC says that I am in Service mode so it does not resolve) :confused:

Below even more powerfull as disabling:

sudo systemctl mask dhcpcd

Yes but dhcpcd cant interfere anymore.

Check with netstat if dnsmasq is really killed now.

Ok done it ( no idea how to delete the symlink afterwards) :sweat_smile:

Pfff, no:

pi@raspberrypi:~ $ sudo netstat -nltup | grep 'Proto\|:53 \|:67 \|:80 \|:547 \|:471[1-8] '
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1075/lighttpd       
tcp        0      0 192.168.0.39:53         0.0.0.0:*               LISTEN      604/dnsmasq         
tcp6       0      0 :::80                   :::*                    LISTEN      1075/lighttpd       
udp        0      0 192.168.0.39:53         0.0.0.0:*                           604/dnsmasq         
udp        0      0 0.0.0.0:67              0.0.0.0:*                           604/dnsmasq