Quantcast
Channel: Linux Device Hacking
Viewing all articles
Browse latest Browse all 3178

Howto: pi-hole ad-blocker on Seagate Dockstar (1 reply)

$
0
0
In case this is useful for anyone else, here's my notes on

How to install pi-hole 5.0 on Seagate Dockstar running Debian 10
---------------------------------------------------------

This was performed on a fresh install of the standard install ( Debian-5.2.9-kirkwood-tld-1-rootfs-bodhi.tar.bz2 )

install curl:
# apt install curl


Download pi-hole installscript. But first, install latest ca-certificates if you don't have them , otherwise curl refuses to connect to some https sites
# apt install ca-certificates

# curl -sSL https://install.pi-hole.net > pihole-basic-install.sh


Note: had to edit the install script to change 'binary' to 'l_binary' on one line in pihole-basic-install.sh, as otherwise it exited during the 'FTL Checks' section -
...
 	 	printf "%b  %b Detected ARM architecture\\n" "${OVER}" "${TICK}"
     		# set the binary to be used
     -->        l_binary="pihole-FTL-arm-linux-gnueabi"
    ...

# bash pihole-basic-install.sh

The install script runs through lots of checks, asks you some questions, then downloads lighttpd, php, dnsmasq etc
....
...
   FTL Checks...

  [â] Detected ARM architecture
   Checking for existing FTL binary...
  [â] Downloading and Installing FTL
  [â] Installing scripts from /etc/.pihole

   Installing configs from /etc/.pihole...
  [â] No dnsmasq.conf found... restoring default dnsmasq.conf...
...
.....
  [â] Swapping databases
   Number of gravity domains: 87259 (84818 unique domains)
   Number of exact blacklisted domains: 0
   Number of regex blacklist filters: 0
   Number of exact whitelisted domains: 0
   Number of regex whitelist filters: 0
  [â] pihole-FTL: no process found
  [â] Cleaning up stray matter
  [â] Restarting DNS server

  [â] DNS service is NOT running
/opt/pihole/updatecheck.sh: line 77: /usr/bin/pihole-FTL: No such file or directory
/opt/pihole/updatecheck.sh: line 91: /usr/bin/pihole-FTL: No such file or directory
   Web Interface password: xxxx
   This can be changed using 'pihole -a -p'

   View the web interface at http://pi.hole/admin or http://192.168.17.39/admin

   You may now configure your devices to use the Pi-hole as their DNS server
   Pi-hole DNS (IPv4): 192.168.17.39
   If you set a new IP address, please restart the server running the Pi-hole

   The install log is located at: /etc/pihole/install.log
Installation Complete!

Looks good, however looks like there was a problem with getting the pre-compiled pihole-FTL binary ( which is the core part of pi-hole) :

# /usr/bin/pihole-FTL --version
-bash: /usr/bin/pihole-FTL: No such file or directory
# ls -l /usr/bin/pihole-FTL
-rwxr-xr-x 1 root root 6860972  May 27 08:59 /usr/bin/pihole-FTL

How strange : 'No such file' error , but it's clearly there - have we got some weird filesystem corruption or something ?!

# od -c /usr/bin/pihole-FTL |head
0000000 177   E   L   F 001 001 001  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000020 003  \0   (  \0 001  \0  \0  \0 240 356 001  \0   4  \0  \0  \0
0000040 330 375   x  \0 002 004  \0 005   4  \0      \0  \t  \0   (  \0
0000060   (  \0   %  \0 001  \0  \0   p 324   , 033  \0 324   , 033  \0
....

# file /usr/bin/pihole-FTL
/usr/bin/pihole-FTL: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, with debug_info, not stripped
# ldd /usr/bin/pihole-FTL
 not a dynamic executable

So looks like no filesystem corruption, it's probably just compiled for a different ARM architecture than what we have

So we have to build FTL from source :
( taken from instructions at https://docs.pi-hole.net/ftldns/compile/ :

# apt install build-essential libgmp-dev m4

Although libnettle (for DNSSEC) was already installed by the main pihole installer above, we are going to need the header files etc, so best build nettle too :

# wget https://ftp.gnu.org/gnu/nettle/nettle-3.6.tar.gz
# tar -xvzf nettle-3.6.tar.gz
# cd nettle-3.6
# ./configure
# make
# make install


# apt install libsqlite3-dev

# git clone https://github.com/pi-hole/FTL.git
# cd FTL
# make
# make install
# service pihole-FTL restart


NOTE : If it runs out of RAM during the make ( e.g. gcc dies unexpectedly after 10 min with something like
cc: fatal error: Killed signal terminated program cc1
   compilation terminated.
   make: *** [Makefile:146: build/database/sqlite3.o] Error 1

then one way to reduce RAM usage during compile is to reduce the amount of optimisation gcc does by editing the Makefile and changing -O3 to -O1 or even -O0 :

HARDENING_FLAGS=-fstack-protector-strong -Wp,-D_FORTIFY_SOURCE=2 -O1 -Wl,-z,relro,-z,now  .......

-O1 worked for me on a Dockstar with 128MB of RAM.

You should now see pihole-FTL process running, listening on port 53 , and can configure your laptop etc to use it as a DNS resolver.

You can use pi-hole's handy web-admin interface (URL shown above) to view what it's doing, and to whitelist domains/sites if required.

Cheers
Rob

Viewing all articles
Browse latest Browse all 3178

Trending Articles