(Implemented) Pi-Hole

  • No longer a request, a LE addon for Pi-Hole is now available.

    At the moment it only works on X86, ARM (Raspberry Pi 2 & 3 only) and aarm64.

    You’re welcome to try on other systems, but if it doesn’t work, then there is nothing we can do about it, as Pi-Hole relies on Docker builds. Docker

    Because this is a system wide ad blocker it needs a static IP address. So set this first, before installing.

    Installation:

    1) Install LinuxServer.ios repository.

    Add-ons → LibreELEC Add-ons → Add-on repository → LinuxServer.io’s Docker Add-ons

    2) Install Pi-Hole

    Add-ons → LinuxServer.io’s Docker Add-ons → Services →

    (This will take some time, so be patient)

    When finished you will be taken to the Pi-Hole configuration page. All you really need to do is add a password to access the webgui.

    Now wait some more – as the Pi-Hole container needs to be downloaded. (Around 10 minutes on slower machines)

    When all is finished, you’ll be able to log on via the webgui at <IP address>/admin.

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Could it possible to have Pi-Hole as an LE addon?

    Pi-hole®: A black hole for Internet advertisements – curl -sSL https://install.pi-hole.net | bash

    Like many other users, I leave my LE RPi3 on 24/7, I use tvheadend for PVR so having an ad block running at the same time seems to make sense.

    I know it's probably not part of your core USP but I have found it to be incredibly reliable on another RPi3.

    Just a thought.

  • Tried that - didn't seem to make a difference:

    Start up script is:

    ##------------------------------------------------------------------

    #!/bin/bash

    IP_LOOKUP="$(ip route get 8.8.8.8 | awk '{ print $NF; exit }')"

    IPv6_LOOKUP="$(ip -6 route get 2001:4860:4860::8888 | awk '{ print $10; exit }')"

    IP="${IP:-$IP_LOOKUP}" # use $IP, if set, otherwise IP_LOOKUP

    IPv6="${IPv6:-$IPv6_LOOKUP}" # use $IPv6, if set, otherwise IP_LOOKUP

    DOCKER_CONFIGS="$(pwd)" # Default of directory you run this from, update to where ever.

    echo "IP: ${IP} - IPv6: ${IPv6}"

    # Default ports + daemonized docker container

    docker run -d \

    --name pihole \

    -p 53:53/tcp -p 53:53/udp -p 80:80 \

    -v "${DOCKER_CONFIGS}/pihole/:/storage/pihole/" \

    -v "${DOCKER_CONFIGS}/dnsmasq.d/:/storage/dnsmasq.d/" \

    -e ServerIP="${IP:-$(ip route get 8.8.8.8 | awk '{ print $NF; exit }')}" \

    -e ServerIPv6="${IPv6:-$(ip -6 route get 2001:4860:4860::8888 | awk '{ print $10; exit }')}" \

    --restart=always \

    diginc/pi-hole:arm

    docker logs pihole 2> /dev/null | grep 'password:'

    ##--------------------------------------------------------

  • On startup in journalctl I see:

    Nov 11 10:17:42 LibreELEC dockerd[420]: dnsmasq: failed to load names from /etc/pihole/black.list: No such file or directory

    Nov 11 10:17:42 LibreELEC dockerd[420]: dnsmasq: bad address at /etc/pihole/local.list line 2

    Nov 11 10:17:42 LibreELEC dockerd[420]: dnsmasq: bad address at /etc/pihole/local.list line 4

    Nov 11 10:17:42 LibreELEC dockerd[420]: dnsmasq: read /etc/pihole/local.list - 2 addresses

    Nov 11 10:17:42 LibreELEC dockerd[420]: dnsmasq: bad address at /etc/pihole/gravity.list line 2

    Nov 11 10:17:42 LibreELEC dockerd[420]: dnsmasq: bad address at /etc/pihole/gravity.list line 4

    ..... to 57342

    I guess /etc/pihole & /etc/dnsmasq.d are hardcoded.

    • Official Post

    Ok, I now have it running successfully. It's my first real play with docker so a few improvements are definite.

    As far as I know this only works on X86 and Raspberry Pi 2 & 3 only.

    For X86 you’ll need to change a few things – See Here

    1) Install docker

    KODI: Addons → Install from Repository → LibreELEC add-on → Services → Docker

    2) ssh into you machine: SSH

    3) Get the pi-hole docker container

    ## Raspberry Pi

    Code
    docker pull diginc/pi-hole-multiarch:debian_armhf

    4) Create a run-time script:

    docker run -d \

    --name pihole \

    -p 53:53/tcp \

    -p 53:53/udp \

    -p 80:80 \

    -v /etc/localtime:/etc/localtime \

    -v /storage/pihole/:/etc/pihole \

    -v /storage/pihole/dnsmasq.d/:/etc/dnsmasq.d \

    -v /storage/html/:/var/www/html/html/ \

    -h $(cat /etc/hostname) \

    -e ServerIP=$(ip route get 9.9.9.9 | awk '{ print $NF; exit }') \

    -e WEBPASSWORD=libreelec \

    --restart=unless-stopped \

    diginc/pi-hole-multiarch:debian_armhf

    This is set to store pi-hole files locally in /storage and sets a web password of libreelec.

    Run your script.

    Now log in via a web-browser at <IP-address>/admin

    Once you are happy everything is running as it should, change “unless-stopped” to “always”.

    Test to see if pi-hole is working correctly, go to Pi-hole test page

    Don’t worry is you see an error about blacklist.list, to get rid of it just add an entry to blacklist in the web interface.

    Useful commands.

    docker logs -f /pihole # Show docker logs

    docker stop /pihole # Stop pihole

    docker rm /pihole # Remove pihole container

    docker ps -a # Show containers

    docker system prune # Remove ALL containers (VERY DESTRUCTIVE)

    EDIT: 09/06/18.

    It make more sense for LE backups, to store the date in .config so:

    -v /storage/.config/pihole/:/etc/pihole \

    -v /storage/.config/pihole/dnsmasq.d/:/etc/dnsmasq.d \

    -v /storage/.config/pihole/html/:/var/www/html/html/ \

    Also to remove black.list error just

    touch /storage/.config/pihole/black.list

    Also - to protect you further from known threats -, use Quad9 as primary and secondary upstream DNS servers.

    -e DNS1=9.9.9.9

    -e DNS2=149.112.112.112

    EDIT 11/06/18

    LE is now actively incorporating a LE addon for pi-hole. At the moment it is still in testing, but is looking good.

  • Hey could you explain how to create the runtime script? and could you please append the changes to the main commands you posted first?

  • That worked for me on 8.2 Le, but it's not working on CoreELEC, i think there's some problem with saving the config file. The addon/container is installed successfully but the settings show up blank. The container does not show up in Portainer either. Any tips?