Pi-hole on BeagleBone

Introduction

This project repurposes an unused BeagleBone to act as a Pi-Hole in my home network. The current version of Pi-Hole is 4.3.2 at the time of writing.

Preparation

Flash the BeagleBone’s SD card (on Mac)

The first step is to install an OS on the BeagleBone’s SD card. A 4GB SD card is enough to hold a small Debian image and Pi-Hole. My choice is the official Debian 9.9 IoT image. On Mac, extract the image, and copy it onto the SD card.

$ diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *251.0 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk1         250.8 GB   disk0s2
...

Find the SD card’s ID (/dev/diskX). Then, unmount the partitions on this disk:

$ diskutil unmountdisk /dev/diskX

Then flash the card:

$ dd if=~/Downloads/bone-debian-9.9-iot-armhf-2019-08-03-4gb.img of=/dev/diskX bs=2m

Modify the package setup

Boot the BeagleBone. After logging in, first of all change the password for user debian:

$ passwd

Then, update the packages:

$ sudo apt update
$ sudo apt upgrade

The Debian IoT image contains a couple of things that are either unnecessary, or interfere with Pi-Hole. We don’t need NodeJS, and Cloud 9 IDE. We also will not use nginx; Pi-Hole uses lighttpd. We’ll first fix this:

$ sudo apt remove --purge nodejs
$ sudo apt remove --purge c9-core-installer
$ sudo apt remove --purge nginx nginx-common

Pi-Hole 4.x uses dnsmasq, but uses its own, built-in version (in pihole-FTL). The original one will interfere with Pi-Hole, so we remove that one as well:

$ sudo apt remove --purge dnsmasq

Finally, we remove the SoftAp0 configuration file, and make sure that the SoftAp0 configuration file for dnsmasq is not regenerated each time on boot: the presence of .SoftAp0 in /etc/dnsmasq.d prevents the auto-generation of the SoftAp0 file:

$ sudo rm /etc/dnsmasq.d/SoftAp0
$ sudo touch /etc/dnsmasq.d/.SoftAp0

Installation

Clone the Pi-Hole repository:

$ git clone --depth 1 https://github.com/pi-hole/pi-hole.git pi-hole

Execute installation script:

$ sudo bash pi-hole/automated\ install/basic-install.sh 

You can accept all defaults during installation. If you choose to turn the current IP settings into a static configuration, make sure to set the IP address as a static address on the router’s DHCP server, so that it is not accidentally leased to another device.

Finally, log into the admin console, and update the Gravity blocklists. In the Tools menu on the left, select “Update Gravity”. On the “Update Gravity (list of blocked domains)” screen, press the “Update” button. This will download the blocklists.

References