Undefined variable: api in /var/www/html/admin/scripts/pi-hole/php/add.php

Expected Behaviour:

lighttpd should start.

Actual Behaviour:

lighttpd is failing with error (mod_fastcgi.c.421) FastCGI-stderr: PHP Notice: Undefined variable: api in /var/www/html/admin/scripts/pi-hole/php/add.php on line 14

Debug Token:

[//tricorder.pi-hole.net/tnrrkgknew]

What is the output of sudo systemctl status --full --no-pager lighttpd

[root@PLEXVM pihole]# systemctl status --full --no-pager lighttpd
● lighttpd.service - Lightning Fast Webserver With Light System Requirements
Loaded: loaded (/usr/lib/systemd/system/lighttpd.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2020-02-25 09:44:47 EST; 21min ago
Process: 27107 ExecStart=/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf (code=exited, status=255)
Main PID: 27107 (code=exited, status=255)

Feb 25 09:44:47 PLEXVM systemd[1]: Started Lightning Fast Webserver With Light System Requirements.
Feb 25 09:44:47 PLEXVM systemd[1]: lighttpd.service: main process exited, code=exited, status=255/n/a
Feb 25 09:44:47 PLEXVM systemd[1]: Unit lighttpd.service entered failed state.
Feb 25 09:44:47 PLEXVM systemd[1]: lighttpd.service failed.

[root@PLEXVM pihole]# tail -n 12 /var/log/lighttpd/error.log
2020-02-25 09:39:17: (server.c.1521) server started (lighttpd/1.4.54)
2020-02-25 09:39:17: (gw_backend.c.468) unlink /tmp/php-fastcgi.socket-0 after connect failed: Connection refused
2020-02-25 09:39:17: (gw_backend.c.468) unlink /tmp/php-fastcgi.socket-1 after connect failed: Permission denied
2020-02-25 09:39:17: (gw_backend.c.499) bind failed for: unix:/tmp/php-fastcgi.socket-1 Address already in use
2020-02-25 09:39:17: (gw_backend.c.1490) [ERROR]: spawning gw failed.
2020-02-25 09:39:17: (server.c.1529) Configuration of plugins failed. Going down.
2020-02-25 09:44:47: (server.c.1521) server started (lighttpd/1.4.54)
2020-02-25 09:44:47: (gw_backend.c.468) unlink /tmp/php-fastcgi.socket-0 after connect failed: Connection refused
2020-02-25 09:44:47: (gw_backend.c.468) unlink /tmp/php-fastcgi.socket-1 after connect failed: Permission denied
2020-02-25 09:44:47: (gw_backend.c.499) bind failed for: unix:/tmp/php-fastcgi.socket-1 Address already in use
2020-02-25 09:44:47: (gw_backend.c.1490) [ERROR]: spawning gw failed.
2020-02-25 09:44:47: (server.c.1529) Configuration of plugins failed. Going down.
[root@PLEXVM pihole]#

Please run sudo /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf and provide the output.

[pranav@PLEXVM ~]$ sudo ps -aux | grep lighttpd
[sudo] password for pranav:
pranav    2366  0.0  0.0 112712   968 pts/0    R+   23:22   0:00 grep --color=auto lighttpd
[pranav@PLEXVM ~]$ sudo /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
[pranav@PLEXVM ~]$ sudo ps -aux | grep lighttpd
lighttpd  2406  0.5  0.1 256016 10936 ?        Ss   23:22   0:00 /usr/bin/php-cgi
lighttpd  2407  0.0  0.0 256016  5264 ?        S    23:22   0:00 /usr/bin/php-cgi
pranav    2412  0.0  0.0 112712   968 pts/0    S+   23:22   0:00 grep --color=auto lighttpd

It looks like something worked but admin UI is still not available.

We can take a look with a new pihole -d token.

https://tricorder.pi-hole.net/bt495s0lk5

lighttpd is still not running.

What is the output from sudo systemctl status --full --no-pager lighttpd?

[pranav@PLEXVM ~]$ sudo systemctl status --full --no-pager lighttpd
[sudo] password for pranav:
● lighttpd.service - Lightning Fast Webserver With Light System Requirements
   Loaded: loaded (/usr/lib/systemd/system/lighttpd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2020-02-26 17:06:51 EST; 44min ago
  Process: 22970 ExecStart=/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf (code=exited, status=255)
 Main PID: 22970 (code=exited, status=255)

[pranav@PLEXVM ~]$ sudo tail -n 6  /var/log/lighttpd/error.log
2020-02-26 17:07:38: (server.c.1521) server started (lighttpd/1.4.54)
2020-02-26 17:07:38: (gw_backend.c.468) unlink /tmp/php-fastcgi.socket-0 after connect failed: Connection refused
2020-02-26 17:07:38: (gw_backend.c.468) unlink /tmp/php-fastcgi.socket-1 after connect failed: Permission denied
2020-02-26 17:07:38: (gw_backend.c.499) bind failed for: unix:/tmp/php-fastcgi.socket-1 Address already in use
2020-02-26 17:07:38: (gw_backend.c.1490) [ERROR]: spawning gw failed.
2020-02-26 17:07:38: (server.c.1529) Configuration of plugins failed. Going down.
[pranav@PLEXVM ~]$

What is the output from sudo lighttpd -tt -f /etc/lighttpd/lighttpd.conf?

It gives no output.

[pranav@PLEXVM ~]$ sudo lighttpd -tt -f /etc/lighttpd/lighttpd.conf
[pranav@PLEXVM ~]$

That’s not good.

Try with just one -t instead of -tt

[pranav@PLEXVM ~]$ sudo lighttpd -t -f /etc/lighttpd/lighttpd.conf
Syntax OK
[pranav@PLEXVM ~]$

That’s better. The configuration is correct and recognized and that’s about as far as we can go on our side.

The errors below are causing the crash. The errors indicate the problem is in an area that we are not using. I suggest a VM dedicated to Pi-hole and not one shared with other heavy services like Plex.

2020-02-26 17:07:38: (server.c.1521) server started (lighttpd/1.4.54)
2020-02-26 17:07:38: (gw_backend.c.468) unlink /tmp/php-fastcgi.socket-0 after connect failed: Connection refused
2020-02-26 17:07:38: (gw_backend.c.468) unlink /tmp/php-fastcgi.socket-1 after connect failed: Permission denied
2020-02-26 17:07:38: (gw_backend.c.499) bind failed for: unix:/tmp/php-fastcgi.socket-1 Address already in use
2020-02-26 17:07:38: (gw_backend.c.1490) [ERROR]: spawning gw failed.
2020-02-26 17:07:38: (server.c.1529) Configuration of plugins failed. Going down.

I understand. I have worked so hard on perfecting blocklist/whitelist on this install over a year. I can build dedicated VM and get it up and running in next 20 mins.
I just don’t know how to migrate current block&white-list to new VM.

If you have script to export and import it, I would appreciate.

If I compare /etc/pi-hole directory on new server with old and sync delta, that should take care of white/block list.

Please correct me if there is risk with above approach.

In version 4 the lists are in /etc/pihole but you’ll have a better go using the teleporter function. That will create an archive for you to export from the old and import in to the new.

If you are writing code for PiHole, please include adlists.list in teleporter function.
Currently, it doesn’t include it.
After building a new dedicated pi-hole VM, I come to learn this hard way.
Also if you could automate command to update gravity, it would be helpful to the next person who needs to migrate their white/blacklist to the new server.

In V4.x, the adlists.list file is included in the teleporter for export, but is not imported without operator action.

image

In V5.0 (currently at beta), the following is included in the teleporter.

image

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.