Settings not saved via web interface

more problems with pi-hole

settings changed on the web interface are not being saved

eg, changing the upstream dns servers?
i can tick / untick boxes, click save and i get the confirmation message, but the boxes are still in their original state

im actually trying to set the dhcp server to on, but see the same behavior.

i have tried on multiple platforms, on multiple devices and still cannot get settings to be saved

i have alos ran sudo puhole -r and selected repair and no joy
i have cleared browser cache, and rebooted my pi.
all with no success

has anyone seen this?

Run pihole -d for a debug token.

token is sfmup0fqjx

thanks

Does this file exist and is it readable by the www-data user? /var/www/html/admin/scripts/pi-hole/php/header.php
There's lots of this in the web interface log:

2017-05-17 22:37:06: (mod_fastcgi.c.2702) FastCGI-stderr: PHP Warning:  require(scripts/pi-hole/php/header.php): failed to open stream: No such file or directory in /var/www/html/pihole/index.php on line 9
2017-05-17 22:37:06: (mod_fastcgi.c.2702) FastCGI-stderr: PHP Fatal error:  require(): Failed opening required 'scripts/pi-hole/php/header.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/pihole/index.php on line 9

Do you notice anything else amiss about the web interface? This error should cause many more things to break.

thanks for taking a look @Mcat12

that file does exist, but im unsure to check if its readable by user www-data ??

using putty whilst ssh'd to my pi i can use nano and read the file as user pi

the only other thing i have noticed in the web interface is when i load it up, i see an enable button on the sidebar, right above the tools button.
ive attached a screenshot

9nw thing I have noticed is I am unable to access the admin page via pi.hole/admin
I see a pi.hole’s server DNS address could not be found error.
I have to use my local pi hole IP address

That means that your device isn't properly using Pi-hole as its DNS server. Run:

ls -al /var/www/html/admin/scripts/pi-hole/php/header.php
pihole status
sudo service dnsmasq status

and share the output.

1 Like

Thanks again

The out put is as follows

pi@raspberrypi:~ $ ls -al /var/www/html/admin/scripts/pi-hole/php/header.php
-rw-r--r-- 1 root root 25K May  4 14:23 /var/www/html/admin/scripts/pi-hole/php/header.php
pi@raspberrypi:~ $ pihole status
[sudo] password for pi:
::: DNS service is running
::: Pi-hole blocking is Enabled
pi@raspberrypi:~ $ sudo service dnsmasq status
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
   Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled)
  Drop-In: /run/systemd/generator/dnsmasq.service.d
           └─50-dnsmasq-$named.conf, 50-insserv.conf-$named.conf
   Active: active (running) since Wed 2017-05-17 22:19:20 BST; 1 day 12h ago
 Main PID: 6941 (dnsmasq)
   CGroup: /system.slice/dnsmasq.service
           └─6941 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -r /run/dnsmasq/resolv.c...
May 17 22:19:19 raspberrypi dnsmasq[6934]: dnsmasq: syntax check OK.
May 17 22:19:20 raspberrypi systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server

What is the output of sudo pihole status web?
Also, does /etc/sudoers.d/pihole exist?

Ive run sudo pihole status web...

pi@raspberrypi:~ $ sudo pihole status web
[sudo] password for pi:
1
pi@raspberrypi:~ $

And the file /etc/sudoers.d/pihole does exist.

It contains

GNU nano 2.2.6                 File: /etc/sudoers.d/pihole                                          
# Pi-hole: A black hole for Internet advertisements
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your own hardware.
#
# Allows the WebUI to use Pi-hole commands
#
# This file is copyright under the latest version of the EUPL.
# Please see LICENSE file for your rights under this license.
  GNU nano 2.2.6                 File: /etc/sudoers.d/pihole                                          
# Pi-hole: A black hole for Internet advertisements
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your own hardware.
#
# Allows the WebUI to use Pi-hole commands
#
# This file is copyright under the latest version of the EUPL.
# Please see LICENSE file for your rights under this license.
#
www-data ALL=NOPASSWD: /usr/local/bin/pihole




























^G Get Help      ^O WriteOut      ^R Read File     ^Y Prev Page     ^K Cut Text      ^C Cur Pos
^X Exit          ^J Justify       ^W Where Is      ^V Next Page     ^U UnCut Text    ^T To Spell

Does the web interface still say that the status is Unknown?

Yes it does.

If I click enable it switches to active.
But if I refresh the page, it reverts back to unknown.

Try restarting the Pi-hole. Make another debug token with pihole -d.

Restarted my Pi, still see the same behaviour.

Debug token qn2wgf8wel

What is the output of sudo service lighttpd status?

pi@raspberrypi:~ $ sudo service lighttpd status
[sudo] password for pi:
● lighttpd.service - Lighttpd Daemon
   Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled)
   Active: active (running) since Fri 2017-05-19 18:42:32 BST; 1h 56min ago
  Process: 701 ExecStartPre=/usr/sbin/lighttpd -t -f /etc/lighttpd/lighttpd.conf (code=exited, status=0/SUCCESS)
 Main PID: 1086 (lighttpd)
   CGroup: /system.slice/lighttpd.service
           β”œβ”€1086 /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf                                           β”œβ”€1270 /usr/bin/php-cgi
           β”œβ”€1282 /usr/bin/php-cgi
           β”œβ”€1283 /usr/bin/php-cgi
           β”œβ”€1284 /usr/bin/php-cgi
           └─1285 /usr/bin/php-cgi

May 19 18:54:54 raspberrypi sudo[2323]: pam_unix(sudo:auth): auth could not identify password f...ata]May 19 18:54:54 raspberrypi lighttpd[1086]: sudo: no tty present and no askpass program specified
May 19 18:55:17 raspberrypi lighttpd[1086]: We trust you have received the usual lecture from th...temMay 19 18:55:17 raspberrypi lighttpd[1086]: Administrator. It usually boils down to these three ...gs:May 19 18:55:17 raspberrypi lighttpd[1086]: #1) Respect the privacy of others.
May 19 18:55:17 raspberrypi lighttpd[1086]: #2) Think before you type.
May 19 18:55:17 raspberrypi lighttpd[1086]: #3) With great power comes great responsibility.
May 19 18:55:17 raspberrypi sudo[2430]: pam_unix(sudo:auth): conversation failed
May 19 18:55:17 raspberrypi sudo[2430]: pam_unix(sudo:auth): auth could not identify password f...ata]May 19 18:55:18 raspberrypi lighttpd[1086]: sudo: no tty present and no askpass program specified
Hint: Some lines were ellipsized, use -l to show in full.

Run the command with the -l parameter so we can see the full lines. It looks like lighttpd is unable to use sudo commands, although the sudoers file is installed.

Thank for taking the time to look @Mcat12

 pi@raspberrypi:~ $ sudo service lighttpd status -l
● lighttpd.service - Lighttpd Daemon
   Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled)
   Active: active (running) since Fri 2017-05-19 18:42:32 BST; 2h 17min ago
  Process: 701 ExecStartPre=/usr/sbin/lighttpd -t -f /etc/lighttpd/lighttpd.conf (code=exited, status=0/SUCCESS)
 Main PID: 1086 (lighttpd)
   CGroup: /system.slice/lighttpd.service
           β”œβ”€1086 /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
           β”œβ”€1270 /usr/bin/php-cgi
           β”œβ”€1282 /usr/bin/php-cgi
           β”œβ”€1283 /usr/bin/php-cgi
           β”œβ”€1284 /usr/bin/php-cgi
           └─1285 /usr/bin/php-cgi

May 19 18:54:54 raspberrypi sudo[2323]: pam_unix(sudo:auth): auth could not identify password for [www-data]
May 19 18:54:54 raspberrypi lighttpd[1086]: sudo: no tty present and no askpass program specified
May 19 18:55:17 raspberrypi lighttpd[1086]: We trust you have received the usual lecture from the local System
May 19 18:55:17 raspberrypi lighttpd[1086]: Administrator. It usually boils down to these three things:
May 19 18:55:17 raspberrypi lighttpd[1086]: #1) Respect the privacy of others.
May 19 18:55:17 raspberrypi lighttpd[1086]: #2) Think before you type.
May 19 18:55:17 raspberrypi lighttpd[1086]: #3) With great power comes great responsibility.
May 19 18:55:17 raspberrypi sudo[2430]: pam_unix(sudo:auth): conversation failed
May 19 18:55:17 raspberrypi sudo[2430]: pam_unix(sudo:auth): auth could not identify password for [www-data]
May 19 18:55:18 raspberrypi lighttpd[1086]: sudo: no tty present and no askpass program specified

What is the output of ls -al /etc/sudoers.d/pihole? That file should be letting the www-data user execute pihole commands with sudo...

pi@raspberrypi:~ $ ls -al /etc/sudoers.d/pihole
-r--r----- 1 root root 367 May 17 22:18 /etc/sudoers.d/pihole