Why do I see "bad address at /etc/pihole/gravity.list line N" in my pihole.log file?

One of the possible reasons is if you are on a version earlier than Pi-hole v3.2, you may notice dnsmasq won't start because of an error, either in your /etc/dnsmasq/01-pihole.conf or /etc/dnsmasq.d/03-wildcard.conf. This may be caused by a bug where the CIDR notation is appended to the IPv6 address within these files, which dnsmasq does not understand.

As of v3.2, this bug is fixed, but if you are on an older version, you may need to run this manual fix:

  1. Edit /etc/pihole/setupVars.conf
  2. Remove the CIDR notation from the value of the variable IPv6_ADDRESS=
  3. Run pihole -g (pihole -r will also work)

For example, before editing the file:

IPV6_ADDRESS=f316:d4bc:7e7d:0:361::447e:b350:21ec/64

and after:

IPV6_ADDRESS=f316:d4bc:7e7d:0:361::447e:b350:21ec

In the example above, you just need to delete the /64 at the end of the IPv6 address and then run pihole -g