Home Assistant Community Add-on: Pi-hole

Hi there. Began using Pi-Hole in the past few days and I’m liking it a lot. One thing I’d love to implement is some redundancy in a second instance as I do reboot my HA instance every now and again. Pi-Hole (nor Adguard Home) doesn’t make this easy however it seems like some people have had success running commands via SSH etc. for other install methods.

I suspect the answer is (still) no due to how Hassio works, but is there any way for a Hassio addon instance of Pi-Hole to be interfaced with via SSH or some other means so that we could automate the synchronisation of changes from one instance to another (non Hassio instance), in particular the whitelist and blacklist. Blocklist I’m less fussed about as once the URL is setup those will sync on a schedule anyway with the remote source. Capabilities required to facilitate this would be to pull the (white/black) list, write back to the list and then force Gravity to do a sync. Even if the pull wasn’t timestamped I’m sure a staging file could be used to identify differences between the last sync. The thing I’m not sure about is how we get data in or out to begin with if Hassio is hosting Pi-Hole as an addon.

Any advice is appreciated. Built in support for multi instances seems to be on the Pi-Hole feature request which would negate the need for a more hack solution. AdGuard Home doesn’t seem to have the function either after having a quick look.

Found a solution for this already?
I’m switching to Hass.io but it sems i can’t use unbound.

I use for this reason 2 instances in 2 host, and on my computers as DNS put the IP of the 2 hosts

Are the two instances synchronised in that changes to a whitelist or block list are copied between the instances, or do you just apply changes to both instances separately?

No issue setting up two stand along instances, but it’d be nice to only update one and have configuration replicate to the other. Unsure how to do this when one a hass.io addon.

Right now I think I’ll need to just do seperate installs rather than as an add-on to do this.

No sync, just default install

Just noticed my config for mapping hostnames to IPs doesn’t seem to be working any more so I just get IPs. Only change I have made recently was to add a single extra entry the other day, and I didn’t pay too close of attention to whether the issues happened either side of that, but I have eyeballed the config and nothing stands out as being problematic. Reduced the hostname mapping to a single hostname + IP and that one still didn’t resolve.

Is it just me, or have other had this? I can’t tell if the DNS issues as part of Name resolution problem since 0.97.2 might be the cause. It’d coincide with me noting the problem but it may be completely unrelated.

Update 24/8: Started working again today. Haven’t touched the config in the past week for the add-on, had done multiple restarts etc but. Guessing it’s just something environmental changing. All good now anyway.

Release v4.0.0

Full Changelog

:tada: This is a major release of the add-on, changing and improving a lot!

:sparkles: First of all, this release introduces Ingress support. This means you can now access the interface from Home Assistant, even via the NabuCasa cloud. If you had configured a panel_iframe, you can no go ahead and remove that and check the “Show in Sidebar” toggle on the add-on page. Still, want to access the Pi-Hole web interface directly? You can always do that, by setting a port in the add-on network options.

:closed_lock_with_key: Pi-hole has single password protection (yeah, without username even), which is not really uh… Ok, we’ve improved that by adding Home Assistant authentication. You can now login with your HA username/password. However, when using Ingress, Home Assistant will take care of that for you :tada: (So this only applies to direct access).

:house_with_garden: Integrating the add-on with Home Assistant has always been a pain. We’ve solved that in this release, by adding a special endpoint for Pi-Hole integration of Home Assistant. The example in the add-on documentation is now a “copy, paste, restart & enjoy”-example. There is nothing more to it.

:globe_with_meridians: The add-on has been adjusted to work and play nicely with the new Hass.io DNS services. Should solve a lot of headaches for quite a few people.

:hammer: Changes

  • :arrow_up: Upgrades gcc/g++ to 8.3.0-r0
  • :arrow_up: Upgrades wget to 1.20.3-r0
  • :arrow_up: Upgrades Pi-hole web interface to v4.3
  • :pencil2: Maintaince -> Maintenance
  • :arrow_up: Upgrades libexecinfo-dev to 1.1-r1
  • :arrow_up: Upgrades linux-headers to 4.19.36-r0
  • :arrow_up: Upgrades nettle-dev to 3.4.1-r1
  • :fire: Removes Bash, since the base image provides it
  • :arrow_up: Upgrades bc to 1.07.1-r1
  • :arrow_up: Upgrades bind-tools to 9.14.3-r0
  • :arrow_up: Upgrades coreutils to 8.31-r0
  • :arrow_up: Upgrades git to 2.22.0-r0
  • :arrow_up: Upgrades grep to 3.3-r0
  • :arrow_up: Upgrades libcap to 2.27-r0
  • :arrow_up: Upgrades libxml2 to 2.9.9-r2
  • :arrow_up: Upgrades ncurses to 6.1_p20190518-r0
  • :arrow_up: Upgrades openssl to 1.1.1c-r0
  • :arrow_up: Upgrades perl to 5.28.2-r1
  • :arrow_up: Upgrades sed to 4.7-r0
  • :arrow_up: Upgrades sudo to 1.8.27-r0
  • :arrow_up: Upgrades Pi-hole core to v4.3.1
  • :ambulance: Fixes path handling for SSL certificates
  • :arrow_up: Upgrades add-on base image to v4.1.1
  • :arrow_up: Upgrades musl-dev to 1.1.22-r3
  • :arrow_up: Upgrades php to 7.3.8-r0
  • :arrow_up: Upgrades nginx to 1.16.1-r0
  • :arrow_up: Upgrades Pi-hole FTL to v4.3.1
  • :tractor: :hammer: Complete rewrite of the add-on
  • :books: Updates documentation to match latest changes

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

1 Like

Hi all, I am new to all of this…I keep getting the following message in Pi-hole:

dnsmasq: failed to create listening socket for port 53: Address in use.

Any thoughts on what I have misconfigured?

Maybe you have another add-on running that is using port 53 and creating the conflict. Try changing the port number in the add-on settings.

After updating to 4.0, i get this in the log:

[2019-08-26 20:53:09.496 761] Finished config file parsing
[2019-08-26 20:53:09.503 761] Database version is 3
[2019-08-26 20:53:09.503 761] Database successfully initialized
[2019-08-26 20:53:09.505 761] SQLite3 message: database corruption at line 65183 of [0eca3dd3d3] (11)
[2019-08-26 20:53:09.505 761] SQLite3 message: statement aborts at 4: [SELECT * FROM queries WHERE timestamp >= 1566759189] database disk image is malformed (11)
[2019-08-26 20:53:09.506 761] Imported 0 queries from the long-term database
[2019-08-26 20:53:09.506 761] read_data_from_DB() - SQL error step (11): database disk image is malformed
[2019-08-26 20:53:09.506 761] dbclose() - SQL error (5): unable to close due to unfinalized statements or unfinished backups
[2019-08-26 20:53:09.506 761] check_database(11): Disabling database connection due to error
[20:53:09] INFO: Starting NGinx....
nginx: [alert] detected a LuaJIT version which is not OpenResty's; many optimizations will be disabled and performance will be compromised (see https://github.com/openresty/luajit2 for OpenResty's LuaJIT or, even better, consider using the OpenResty releases from https://openresty.org/en/download.html)

Also, i’m using DuckDNS addon with pi-hole, and i never get to use my duckdns domain to get into pihole, i always have to use the direct ip, else, i get a blank page with only:

“Failed Host Check: xxxxxx.duckdns.org vs 192.168.0.48, , a0d7b954-pi-hole, pi.hole, localhost, xxxxxx, xxxxxx.local”
where xxxxxx is my ducdkns domain

Pi_hole sensor stopped working after the update. Is this a known issue? Do we need to change the config for the update?

I got the same behavior.
Solved it by removing the ssl and verify ssl settings, give it a try

this fixed it, thanks

HI All. First off I want to say how much I love this add on.
I run this add on as well as another pi-hole on an older raspberry pi to block all those dns adds

One thing which occurred after upgrading to 4.0 is that I can no longer temporarily turn off pi-hole as described in this post

Essentially because there is no password, there is no API key, and running the curl commands fails.
Does anyone know of some commands to turn off pi hole without the API key, I have tried it without the key but it says “not authorised”

Thanks all

2 Likes

I have this same setup and I was able to make it work by just removing the API key and making it like in the example since the example doesn’t use the API key either. I can try to help more if you don’t have any luck.

@frenck Is there is a reason that the host UDP port 67 for DHCP is not mapped to the container?

I want to use pi-hole as DHCP server as that means, I will be able to resolve hostnames of my dhcp clients.

For now I edited the hassio addons.json file to allow UDP/67

That makes absolutely no sense, since it runs on the host network. Those aren’t rocker mappings in that config file.

@frenck Ok, I wasn’t aware that it’s run on the host network. I am not sure why this is the case but DHCP was not being offered until I mapped UDP/67

I will remove the mapping and try again. Will update soon.

Apologies! User error!!

I think I might not have had my previous DHCP server stopped when I configured pi-hole addon.

Is This block youtube AD?