DD-WRT / entware / Netgear R6300

Hi everyone,

I thought I'd see if anyone else had tried this or had any suggestions...

I checked out this script and knew no way I was going to try installing this on my primary Asus router....now running a "Kong" version of DD-WRT with lighttpd burned into the firmware and running dnsmasq, openvpn and a few other things quite well..

pi-hole-for-asuswrt.sh

..so I installed it on my old Netgear R6300 that has the latest DD-WRT . I manually installed all the entware dependencies and had to create several folders and files where the script couldn't do it.

This is far more complicated than I thought....here's the script feedback:

Using username "root".
DD-WRT v3.0-r33772 giga (c) 2017 NewMedia-NET GmbH
Release: 11/16/17

 ___  ___     _      _____  ______       ____  ___
/ _ \/ _ \___| | /| / / _ \/_  __/ _  __|_  / / _ \

/ // / // // |/ |/ / , / / / | |/ // </ // /
/
// |/|//|| // |/()__/

                   DD-WRT v3.0
               http://www.dd-wrt.com

==========================================================

BusyBox v1.27.2 (2017-11-16 14:19:52 CET) built-in shell (ash)

root@R6300:~# cd /opt/tmp
root@R6300:/opt/tmp# ls
pi-hole-for-asuswrt.sh
root@R6300:/opt/tmp# ./pi-hole-for-asuswrt.sh
::: Install PiHole!
:::
::: Options:
::: -i, install
::: -u, update
root@R6300:/opt/tmp# ./pi-hole-for-asuswrt.sh -i
./pi-hole-for-asuswrt.sh: line 405: installDependencies: not found
:::
::: Creating Bridge Interface
!!! done.
:::
::: Setup php.ini with correct TZ...
!!! done.
:::
::: Creating dnsmasq configuration
!!! done.
:::
::: Creating lighttpd configuration
Shutting down lighttpd... done.
Starting lighttpd... done.
!!! done.
:::
::: Checking for existing base files...
::: Checking /opt/etc/.pihole is a repo... OK!
::: Updating repo in /opt/etc/.pihole... done!
:::
::: Checking for existing web interface...
::: Checking /opt/etc/.pihole_admin is a repo... OK!
::: Updating repo in /opt/etc/.pihole_admin... done!
:::
::: Installing scripts to /opt/pihole...
sed: bad option in substitution expression
sed: bad option in substitution expression
sed: bad option in substitution expression
sed: bad option in substitution expression
sed: bad option in substitution expression
!!! done.
:::
::: Installing Admin to /opt/share/www/admin...find: unrecognized: -exec
find: unrecognized: -exec
sed: unsupported command |
!!! done.
:::
::: Installing pi-hole movie... done.
:::
::: Create PiHole Ip file...
!!! done.
:::
::: Create dummy Host file...
!!! done.
:::
::: Creating log file and changing owner to nobody... already exists!
:::
::: Installing pihole custom index page...
!!! done
:::
::: Installing Cron Jobs
!!! 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: Status 000
::: Download failed and no cached list available (list will not be considered)
::: Getting mirror1.malwaredomains.com list... done
::: Status: Status 000
::: Download failed and no cached list available (list will not be considered)
::: Getting sysctl.org list... done
::: Status: Success (OK)
::: List updated, transport successful!
::: Getting zeustracker.abuse.ch list... done
::: Status: Status 000
::: Download failed and no cached list available (list will not be considered)
::: Getting s3.amazonaws.com list... done
::: Status: Status 000
::: Download failed and no cached list available (list will not be considered)
::: Getting s3.amazonaws.com list... done
::: Status: Status 000
::: Download failed and no cached list available (list will not be considered)
::: Getting hosts-file.net list... done
::: Status: Status 000
::: Download failed and no cached list available (list will not be considered)
:::
::: Aggregating list of domains... done!
::: Formatting list of domains to remove comments.... done!
::: 20629 domains being pulled in by gravity...
::: Removing duplicate domains.... done!
::: 20629 unique domains trapped in the event horizon.
:::
::: Adding adlist sources to the whitelist... done!
/opt/pihole/gravity.sh: line 276: /usr/local/bin/pihole: No such file or directory
::: Nothing to whitelist!
::: Nothing to blacklist!
::: No wildcards used!
::: Formatting domains into a HOSTS file.../opt/pihole/gravity.sh: line 305: /opt/etc/pihole/pihole.2.supernova.txt: No such file or directory
::: Nothing to blacklist!
done!
:::
::: Cleaning up un-needed files... done!
:::
::: Refresh lists in dnsmasq.../opt/pihole/gravity.sh: line 405: /usr/local/bin/pihole: No such file or directory
done!
/opt/pihole/gravity.sh: line 459: /usr/local/bin/pihole: No such file or directory
::: View the web interface at http://pi.hole/admin or http:///admin

....and here's the admin page:

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /opt/share/www/admin/scripts/pi-hole/php/header.php:8) in /opt/share/www/admin/scripts/pi-hole/php/password.php on line 10

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /opt/share/www/admin/scripts/pi-hole/php/header.php:8) in /opt/share/www/admin/scripts/pi-hole/php/password.php on line 10

Warning: parse_ini_file(/etc/pihole/setupVars.conf): failed to open stream: No such file or directory in /opt/share/www/admin/scripts/pi-hole/php/password.php on line 13

Warning: parse_ini_file(/etc/pihole/setupVars.conf): failed to open stream: No such file or directory in /opt/share/www/admin/scripts/pi-hole/php/auth.php on line 25

Fatal error: Uncaught Error: Call to undefined function sys_getloadavg() in /opt/share/www/admin/scripts/pi-hole/php/header.php:74 Stack trace: #0 /opt/share/www/admin/index.php(9): require() #1 {main} thrown in /opt/share/www/admin/scripts/pi-hole/php/header.php on line 74

Is there a problem with installing this as root? Everything needs to be written to /opt or /jffs mounted to the USB drive as the rest of the file-system is read-only....

Thanks
:grinning:

Did you ever follow up and get pihole running on your router? I'd love some guidance on this too.

While the install script handles the installation of Pi-hole, the dependencies (coded in different necessary secondary scripts, built by the Pi-hole Dev team), do not support the environment (and it's variables/locations) as you can see from the example above.

This indeed validates the above statement, as crucial files for Pi-hole's functionality are not available at the path hard coded in the PHP file.

There have been quite a few discussions about ddWRT/OpenWRT support and I don't think that Pi-hole will support that.

There's always the option of forking the Pi-hole git and make the desired changes on your own if you are so inclined ...

Nope. It might be possible, but not really worth the time to re-write the scripts...I've learned more about Linux since then. My routers: Asus running Merlin 384.9 based on kernel 2.6.36 and my Netgear R6300 with DD-WRT 3.0-r37305 is kernel 4.4.159. No bash, just the BusyBox sh shell and a single root user...very stripped-down..so?
These firmwares come with Dnsmasq which does a good enough ad-blocking for my lan.
Enable jffs scripts and configs on router.
Make a file: dnsmasq.conf.add
in dir: /jffs/configs/
with this line:
addn-hosts=/jffs/dnsmasq.badhosts
(don't put anything else in the configs dir, it will screw up your router)
go to: http://winhelp2002.mvps.org/hosts.txt
save that as /jffs/dnsmasq.badhosts
enter: service restart-dnsmasq

That is correct. Never said it's impossible to run it on the router(s).

It's just that Pi-hole was not built with those in mind, and in order to fully get it to work as it does on so many other OS', one needs to alter the existing scripts and adapt them to the OS environment.

Glad you got something working in your case.