How do I install Pi-hole on a Synology NAS?

I use "Container station", a piece of software default for qnap. I installed one of available containers - LXC ubuntu-trusty-1, run the script, maybe did some config to have it running after reboot (not sure what I did, something basic) and that's it. It got the IP from DHCP, which I then used. This IP is different from NAS IP.

Thanks I got container station installed and found Pi Hole in a repo. I just don't know how to send it commands. In a VM you open Terminal and SSL into the VM to issue commands. I have no idea how to do this on Docker.

You just go to container station, click on the name of the container, click on arrows next to Console.

Yea...I see that. The one I downloaded won't even start up unless I chance the IP etc. I'll stick w/ my running Pi Hole on my RP for now I guess.

Hi guys, instead of using the rc.script, if you prefer you can use debian chroot web interface to start all the needed services.
Open Debian Chroot, go to services, and add this 4 entries:

  1. sshd
    name: sshd
    launch script: /etc/init.d/ssh
    staus command: ps -p $(cat /var/run/sshd.pid)

  2. lighttpd
    name: lighttpd
    lauch script: /etc/init.d/lighttpd
    status command: ps -p $(cat /var/run/lighttpd.pid)

  3. Cron
    name: cron
    launch script: /etc/init.d/cron
    status command: ps -p $(cat /var/run/crond.pid)

  4. dnsmasq
    name: dnsmasq
    lauch script: /etc/init.d/dnsmasq
    status command: ps -p $(cat /var/run/dnsmasq/dnsmasq.pid)

ciao
ema

Just updated to Pi-hole v3.0.
When I go to the webinterface Pihole-FTL is not loaded. Also on the cli Pihole-FTL is not loaded.
When I start it manually in Chroot with this command: "/usr/bin/pihole-FTL" it does load. The fix is to add 2 new lines to the S99pihole.sh script. It now looks like:

#!/bin/sh

. /etc.defaults/rc.subr

case $1 in
start)
/var/packages/debian-chroot/scripts/start-stop-status start
chroot /volume1/@appstore/debian-chroot/var/chroottarget service cron start
chroot /volume1/@appstore/debian-chroot/var/chroottarget service dnsmasq start
chroot /volume1/@appstore/debian-chroot/var/chroottarget service lighttpd start
chroot /volume1/@appstore/debian-chroot/var/chroottarget service pihole-FTL start
;;
stop)
chroot /volume1/@appstore/debian-chroot/var/chroottarget service cron stop
chroot /volume1/@appstore/debian-chroot/var/chroottarget service dnsmasq stop
chroot /volume1/@appstore/debian-chroot/var/chroottarget service lighttpd stop
chroot /volume1/@appstore/debian-chroot/var/chroottarget service pihole-FTL stop
/var/packages/debian-chroot/scripts/start-stop-status stop
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0 start|stop|restart"
;;
esac

2 Likes

Thanks karel. Can confirm this works.

@DanSchaper - I have a Intel Atom - 64bit and pihole-FTL fails to run.

lscpu states:

Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit

Should be compatible ?
github instructions: "Download some binaries and try which one work." - what does this mean ?

*edit - got it, had to download the 32 bit:

In chroot

cd /usr/bin
wget https://github.com/pi-hole/FTL/releases/download/v2.6/pihole-FTL-linux-x86_32
mv pihole-FTL-linux-x86_32 pihole-FTL
chmod +x pihole-FTL
pihole-FTL

FTL should be automatically installed

It did, but it was the incorrect version.

Since Synology installs run in a chroot environment, the version detection may pick up the wrong linked libraries. This is a situation that we have no way to test for as none of us own Synology equipment to test.

I have a feeling that the FTL will not come up on reboot either as calls to the init system are chrooted and will not operate as in a normal installation.

Followed the instructions and managed to get it mostly working... web interface is up. Got no action on the graphs etc just the spinning icons no traffic appears to be going through it. Worked out from the comments to start FTL manually then added it to the restart script which got the first graph up but still no connections going through it. I've done several full installs and then just did a repair but get the same thing every time. From my log it looks like maybe something to do with dnsmasq?

::: Installing scripts from /etc/.pihole... done.
:::
::: Installing configs from /etc/.pihole...
::: Existing dnsmasq.conf found... it is not a Pi-hole file, leaving alone!
::: Copying 01-pihole.conf to /etc/dnsmasq.d/01-pihole.conf... done.
:::
::: Creating log file and changing owner to dnsmasq... already exists!
:::
::: Installing pihole custom index page...
::: Existing index.php detected, not overwriting
::: Existing index.js detected, not overwriting
::: Existing blockingpage.css detected, not overwriting
:::
::: Installing sudoer file... done!
:::
::: Installing latest Cron script... done!
:::
::: Installing latest logrotate script... done!
:::
::: Downloading latest version of FTL...
::: Detected x86_64 architecture
::: Installing FTL... transferred... done.

Is that the entire install log contents?

Thanks for the quick reply Dan, no here is the full log.

::: You are root.
::: Repair option selected.
::: Verifying free disk space...
:::
::: Updating local cache of available packages... done!
:::
::: Checking apt-get for upgraded packages.... done!
:::
::: Kernel update detected, please reboot your system and try again if your installation fails.
::: Checking for apt-utils... installed!
::: Checking for debconf... installed!
::: Checking for dhcpcd5... installed!
::: Checking for git... installed!
::: Checking for iproute2... installed!
::: Checking for whiptail... installed!
::: --reconfigure passed to install script. Not downloading/updating local repos
::: Checking for bc... installed!
::: Checking for cron... installed!
::: Checking for curl... installed!
::: Checking for dnsmasq... installed!
::: Checking for dnsutils... installed!
::: Checking for iputils-ping... installed!
::: Checking for lsof... installed!
::: Checking for netcat... installed!
::: Checking for sudo... installed!
::: Checking for unzip... installed!
::: Checking for wget... installed!
::: Checking for lighttpd... installed!
::: Checking for php5-common... installed!
::: Checking for php5-cgi... installed!
:::
::: Installing scripts from /etc/.pihole... done.
:::
::: Installing configs from /etc/.pihole...
::: Existing dnsmasq.conf found... it is not a Pi-hole file, leaving alone!
::: Copying 01-pihole.conf to /etc/dnsmasq.d/01-pihole.conf... done.
:::
::: Creating log file and changing owner to dnsmasq... already exists!
:::
::: Installing pihole custom index page...
::: Existing index.php detected, not overwriting
::: Existing index.js detected, not overwriting
::: Existing blockingpage.css detected, not overwriting
:::
::: Installing sudoer file... done!
:::
::: Installing latest Cron script... done!
:::
::: Installing latest logrotate script... done!
:::
::: Downloading latest version of FTL...
::: Detected x86_64 architecture
::: Installing FTL... transferred... done.
::: Restarting services...
:::
::: Starting dnsmasq service... done.
:::
::: Enabling dnsmasq service to start on reboot... done.
:::
::: Starting lighttpd service... done.
:::
::: Enabling lighttpd service to start on reboot... done.
:::
::: Preparing to run gravity.sh to refresh hosts...
::: Cleaning up previous install (preserving whitelist/blacklist)
::: Running gravity.sh
:::
::: Neutrino emissions detected...
:::
::: Pulling source lists into range... done!
:::
::: Getting raw.githubusercontent.com list... done
::: Status: Success (OK)
::: List updated, transport successful!
::: Getting mirror1.malwaredomains.com list... done
::: Status: Success (OK)
::: List updated, transport successful!
::: Getting sysctl.org list... done
::: Status: Success (OK)
::: List updated, transport successful!
::: Getting zeustracker.abuse.ch list... done
::: Status: Success (OK)
::: List updated, transport successful!
::: Getting s3.amazonaws.com list... done
::: Status: Success (OK)
::: List updated, transport successful!
::: Getting s3.amazonaws.com list... done
::: Status: Success (OK)
::: List updated, transport successful!
::: Getting hosts-file.net list... done
::: Status: Success (OK)
::: List updated, transport successful!
:::
::: Aggregating list of domains... done!
::: Formatting list of domains to remove comments.... done!
::: 128379 domains being pulled in by gravity...
::: Removing duplicate domains.... done!
::: 104740 unique domains trapped in the event horizon.
:::
::: Adding adlist sources to the whitelist... done!
::: Whitelisting 6 domains... done!
::: Blacklisting 1 domain... done!
::: No wildcards used!
::: Formatting domains into a HOSTS file... done!
:::
::: Cleaning up un-needed files... done!
:::
::: Refresh lists in dnsmasq...Running in chroot, ignoring request.
done!
::: DNS service is running
::: Pi-hole blocking is Enabled
:::
::: Starting pihole-FTL service... done.
:::
::: Enabling pihole-FTL service to start on reboot... done.
::: done.
:::
::: Update complete!
:::

Yeah, that's showing the chroot problems that we've seen. There is a discussion that we have had on how to account for knowing if the install is rooted, as it is any call to systemctl is ignored since the init inside the jail doesn't handle it fully.

Righto, is this to do with what version of DSM we are running? Seeing as some comments just say "followed the instructions, all working fine"

I don't believe its version related, but more of the chroot environment. I don't have access to a device to fully test out so I'm going by what appears to be happening and what others that have way more knowledge than I have stated.

From your chroot environment try

service dnsmasq restart

Thanks Bakman 2, But tried this (individually) and restarting the script many times.

This is what I get once I log in.