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

Typing /var/www/html/admin/php/auth.php

I got permission dennied.

I logtin as admin then sudo -i and starting chroot.

You don't have to do anything. My changes have been merged five days ago and are available as an update since a few days. No need to change any files when your web UI is up-to-date (> v2.0)

hmm, I must be missing something. Again, probably user error. The web interface loads now with v2.2 when I'm on a non standard port (8082), but when I try and change pihole settings (ex. enable DHCP server or change upstream DNS) through the GUI, i get the same message again:

Failed CORS: http://x.x.x.x:8082 vs http://x.x.x.x, http://x.x.x.x, http://pi.hole, http://localhost

any ideas?

::: Pi-hole version is v2.10.2 (Latest version is v2.10.2)
::: Web-Admin version is v2.2 (Latest version is v2.2)```

This is probably a bug on our part. We modified one security check to allow custom ports, but didn't change the CORS security check. We'll fix it for the next update.
See here for the code in question: https://github.com/pi-hole/AdminLTE/blob/master/php/auth.php#L50

Edit: You can try out the changes in this PR:

2 Likes

Thanks for the quick reply @Mcat12. Will try the changes and post back.

@johnny2678

Replace you /var/www/html/admin/php/auth.php by this updated file:

https://raw.githubusercontent.com/pi-hole/AdminLTE/devel/php/auth.php

The issue will be fixed in the next release as the corresponding PR has already been merged.

1 Like

Thanks @DL6ER! I had tried pasting in the changes to the file manually but it didn't take for some reason. Replacing the whole file did the trick.

Just to confirm, once the next release is out are these the steps I need to take to roll back my local changes and use the git master?

cd /var/www/html/admin
sudo git reset --hard
sudo git checkout master
sudo git pull

You won't have to do anything. We prepared the updater such that any local changes will be stashed so that the update can be applied straightforwardly.

1 Like

sudo su- should be sudo su - (with a space before the -). Small thing but took me a while to find out (still very novice with linux!)

`shouldn'[quote="DL6ER, post:60, topic:289"]
won't have to do anything
[/quote]

shouldn't have to do anything :wink:

Hello everyone!
I've followed the tutorial on my DS213 and it has worked as expected.

If I go on the Tools > Update List section of the (web-)admin interface I get this error:

:::
::: WARNING: /etc/pihole/setupVars.conf missing. Possible installation failure.
:::          Please run 'pihole -r', and choose the 'reconfigure' option to reconfigure.

What am I doing wrong ?
Thanks

P.S. = I do also have errors if I try to modify the config values from the admin page

We have a pull request under review to fix the issue.

1 Like

The pull request probably will not work with Synology installs. I don't have a device to test with, and there appears to be a problem with the chroot not bringing in the modules for the kernel, or at least the /lib/modules directory doesn't exist. So as soon as we attempt to load the IPTABLES ruleset, the install bails out when the set -e is hit. (Non-geek, the system says "What are you trying to do??" and we expect that it already knows, so the system stops talking and the script just drops out.) We need to either try to grab the IPTables module info, or defensively program the install script to try to detect every instance where there could be a failure and code the response, which will take a while to do. We could also check to see if IPTables is set to INPUT ACCEPT and then pass the whole section, because there's no need to add rulesets to a wide open firewall...

1 Like

what has changed that the install fails after the commits ?

We check to see if the iptables binary is installed, and if we find it, we attempt to add 3 rules to the INPUT chain. Adding a rule for the first time triggers an insmod for the iptables modules, and they aren't in the place the kernel expects them to be, so it errors out. The set -e sees that untrapped error and terminates the script, without any messages, so it looks like the script processed fully, but only half of the Pi-hole was actually installed. So there's 4 or 5 things to cover, but I think we can find a way out of those options to fix this.

I think the issue (setupVars) is with synology configurations that have not enabled the firewall.
iptables is available from chroot when the firewall is enabled.

Unfortunately I cannot edit the post anylonger, don't understand why, must be a discourse thing.

enable the firewall in DSM and reinstall pihole.

Tried to update to Web Admin v2.3 with the manual edits from above to auth.php still in place and couldn't get the update to take unless I did a hard git reset. Posting here in case others run into the same thing.

I'm guessing that now the fix for non-standard ports is part of the master, this won't be an issue going forward.

short version:

cd /var/www/html/admin
sudo git reset --hard
sudo git checkout master
sudo git pull

long version:

root@xxx01:/# pihole -up
::: Checking for updates...
::: Updating Everything
:::
::: Checking for existing repository...
:::     Updating repository in /etc/.pihole... done!
:::
::: You are root.
::: --unattended passed to install script, no whiptail dialogs will be displayed
::: 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 whiptail... installed!
:::
::: Checking for existing repository...
:::    Updating repo in /etc/.pihole... done!
:::
::: Checking for existing repository...
:::    Updating repo in /var/www/html/admin...!!! Unable to clone https://github.com/pi-hole/AdminLTE.git into /var/www/html/admin, unable to continue.
Unable to complete update, contact Pi-hole

root@xxx01:/# pihole -up
::: Checking for updates...
:::
::: Pi-hole Web Admin files out of date
:::
::: Checking for existing repository...
:::     Updating repository in /var/www/html/admin... done!
:::
::: Web Admin version is now at v2.2
::: If you had made any changes in '/var/www/html/admin/', they have been stashed using 'git stash'

root@xxx01:/# cd /var/www/html/admin/

root@xxx01:/var/www/html/admin# sudo git reset --hard
HEAD is now at 83f19bc Merge pull request #291 from pi-hole/devel

root@xxx01:/var/www/html/admin# sudo git checkout master
Already on 'master'
Your branch is behind 'origin/master' by 120 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)

root@xxx01:/var/www/html/admin# sudo git pull
Updating 83f19bc..f76317b
Fast-forward
 .user.php.ini                                                                  |   2 ++
...

{{clipped git pull content}}

...
 rename {css => style/vendor}/skin-blue.min.css (100%)

root@xxx01:/var/www/html/admin# pihole -up
::: Checking for updates...
:::
::: Pi-hole version is v2.11
::: Web Admin version is v2.3
:::
::: Everything is up to date!

edit: minor grammer

1 Like

Update worked smoothly … I had only to search for the procedure to create a new admin password to see the stats.
Thanks to all!