This is my Raspberry Pi Zero W hanging from the USB cable that powers it. It runs Pi-hole, which blocks ads and trackers for every device on my home network.
I run uBlock Origin in my browsers (and NoScript and Cookie AutoDelete and so on), but the power of Pi-hole is that it blocks things at the network level: whatever is requesting an ad or sending information you’d rather it didn’t, this will block it, from applications down to the operating system. The change on phones is most noticeable: the CBC News app runs ads, but at home I never see them (and they can’t track me). I don’t play any games with built-in ads, but I bet the effect on them is wonderful.
Pi-hole runs silently, magically and reliably, but it’s nontrivial to set up. It worked for over two years without any trouble, but a couple of days ago I noticed I was seeing ads in the CBC News app: something was wrong!
I logged in and ran pihole -up
(to update) and some other things, but there was some kind of networking problem, and the machine couldn’t resolve any hostnames. pihole -r
(to repair) said this:
[✗] Retrieval of supported OS list failed. dig failed with return code 10.
Unable to determine if the detected OS (Raspbian 10) is supported
Possible causes for this include:
- Firewall blocking certain DNS lookups from Pi-hole device
- ns1.pi-hole.net being blocked (required to obtain TXT record from versions.pi-hole.net containing supported operating systems)
- Other internet connectivity issues
https://docs.pi-hole.net/main/prerequesites/#supported-operating-systems
If you wish to attempt to continue anyway, you can try one of the following commands to skip this check:
e.g: If you are seeing this message on a fresh install, you can run:
curl -sSL https://install.pi-hole.net | PIHOLE_SKIP_OS_CHECK=true sudo -E bash
If you are seeing this message after having run pihole -up:
PIHOLE_SKIP_OS_CHECK=true sudo -E pihole -r
(In this case, your previous run of pihole -up will have already updated the local repository)
It is possible that the installation will still fail at this stage due to an unsupported configuration.
If that is the case, you can feel free to ask the community on Discourse with the Community Help category:
https://discourse.pi-hole.net/c/bugs-problems-issues/community-help/
I couldn’t figure out what the problem was. The Pi’s name server was still working, so my laptop and phone could still connect to the internet without any trouble, which was great. (The Pi has a static IP and my router is configured so that when devices connect with DHCP they use it for DNS. I didn’t need to do anything about this for this reinstall, but it is necessary on a first install.) Confusingly, the Pi itself couldn’t. Also, the little green light was flashing, which it had never done before.
The easiest thing to do was reinstall a fresh system on the Pi. Maybe the little microSD card had a problem—it had been working for two years solid, after all. I picked up a 32 gig SanDisk Extreme from Canada Computers and got to work.
The first thing was to put the Raspberry Pi OS on the microSD card. The Raspberry Pi Imager makes this easy … once you get it to work. Following the “Download for Ubuntu for x86” (I’m running Ubuntu and it detected that) lets me download a .deb
file, but there are no instructions about what to do with it. This is a stopper for many people. I happen to know I need to run dpkg --install
at the command line to install it, but then this happened:
$ sudo dpkg --install imager_1.7.1_amd64.deb
(Reading database ... 510890 files and directories currently installed.)
Preparing to unpack imager_1.7.1_amd64.deb ...
Unpacking rpi-imager (1.7.1) over (1.7.1) ...
dpkg: dependency problems prevent configuration of rpi-imager:
rpi-imager depends on qml-module-qtquick2; however:
Package qml-module-qtquick2 is not installed.
rpi-imager depends on qml-module-qtquick-controls2; however:
Package qml-module-qtquick-controls2 is not installed.
rpi-imager depends on qml-module-qtquick-layouts; however:
Package qml-module-qtquick-layouts is not installed.
rpi-imager depends on qml-module-qtquick-templates2; however:
Package qml-module-qtquick-templates2 is not installed.
rpi-imager depends on qml-module-qtquick-window2; however:
Package qml-module-qtquick-window2 is not installed.
rpi-imager depends on qml-module-qtgraphicaleffects; however:
Package qml-module-qtgraphicaleffects is not installed.
dpkg: error processing package rpi-imager (--install):
dependency problems - leaving unconfigured
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Errors were encountered while processing:
rpi-imager
There’s nothing on the Pi page about dependencies. This is a stopper for more people.
I ran this:
sudo apt install qml-module-qtquick2 qml-module-qtquick-controls2 qml-module-qtquick-layouts \
qml-module-qtquick-templates2 qml-module-qtquick-window2 qml-module-qtgraphicaleffects
That worked, but there was some kind of error and the system suggested I run this:
sudo apt --fix-broken install
That worried me, because every time I’ve seen that before there’s been a major problem, but this time it worked and all was well. Phew. Looking at the GitHub repo for the imager, next time I’d run this first to install all the build dependencies (some of which I already have installed, but not everyone would) and avoid any problems:
sudo apt install --no-install-recommends build-essential devscripts debhelper cmake \
git libarchive-dev libcurl4-openssl-dev qtbase5-dev qtbase5-dev-tools \
qtdeclarative5-dev libqt5svg5-dev qttools5-dev libssl-dev \
qml-module-qtquick2 qml-module-qtquick-controls2 qml-module-qtquick-layouts \
qml-module-qtquick-templates2 qml-module-qtquick-window2 qml-module-qtgraphicaleffects
All of that is a lot of work to do just to get the Raspberry Pi OS image installer working, and there’s no help about it on the site. Ideally I guess there would be an Ubuntu package that would handle everything, but that would mean packages for other Linux distros, and that’s work. I’ll submit a bug report with some suggestions about documentation.
Once I could use the image installer I was very impressed. It’s great.
It saw that I had the microSD card plugged in, and let me choose which operating system I wanted to put on it (it would do the downloading for me). And it let me do some basic system configuration! I put in the wifi information, enabled sshd
and set up a password for the user pi (the only user on the system). With all that in place I just unplugged the Pi, took out the old card, put in the new one, plugged it back in, waited a bit … and I could ssh in! No more trouble hooking it up to a monitor and using a wireless keyboard to configure. This is a major improvement, and I congratulate and thank everyone that worked on it.
Now I could configure my account. (This is not necessary to get Pi-hole working, but I do this on all my systems.) To set up the en_CA.UTF-8 locale, there was an extra step: I needed to uncomment that line from /etc/locale.gen
before I could run sudo locale-gen en_CA.UTF-8; sudo update-locale LANG=en_CA.UTF-8
to generate the files. Then I put in all my dot files with Conforguration.
Next was installing Pi-hole. The controversial way is this:
curl -sSL https://install.pi-hole.net | bash
I trust Pi-hole, so I ran it, but then this happened:
E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/s/sqlite3/sqlite3_3.34.1-3_armhf.deb
Cannot initiate the connection to raspbian.raspberrypi.org:80 (2a00:1098:0:80:1000:75:0:3). - connect (101: Network is unreachable)
Cripes, I thought, what’s going on? I’ve got a fresh install here and there’s some sort of networking problem where it can’t connect to a site that is definitely up and working. I ran sudo apt install sqlite3
and that worked without trouble, which was good. I thought I’d try the other installation method:
cd /tmp/
wget -O basic-install.sh https://install.pi-hole.net
sudo bash basic-install.sh
That worked perfectly. Why, when the first attempt didn’t? Who knows. Another one of those fiddly problems that can be confusing. I accepted all the defaults, and when it was done reset the admin password:
pihole -a -p "My fancy new admin password"
Because my network has the Pi-hole as my name server, once it was working everything was back to where it had been (except that I was still seeing some ads on my phone, so I rebooted it and then they went away).
Now I’m back to an ad-free home network.