/run/pihole-ftl not created at startup, must be done manually

Expected Behaviour:

I installed Pi-hole on a fresh install of Debian 11 x86-64. The only other thing I have installed so far is isc-dhcp-server, which I installed before Pi-hole. I expect it to launch at when the system starts.

Actual Behaviour:

On startup, Pi-hole fails to start. I find this in the system log:

Aug 03 09:42:45 gateway pihole-FTL[17803]: install: cannot create regular file '/run/pihole-ftl/pihole-FTL.pid': No such file or directory
Aug 03 09:42:45 gateway pihole-FTL[17804]: install: cannot create regular file '/run/pihole-ftl/pihole-FTL.port': No such file or directory
Aug 03 09:42:51 gateway pihole-FTL[18385]: install: cannot create regular file '/run/pihole-ftl/pihole-FTL.pid': No such file or directory

I can see that the init script is supposed to create the directory /run/pihole-ftl and those files, as well as /run/log/pihole-ftl, and it assigns ownership to pihole:pihole but this isn't happening. It is my understanding that the script is run as root, so it should have permission to do this. If I manually create those directories and assign ownership as expected, it works. /run/pihole is created by something but doesn't contain any files. It is owned by pihole:pihole.

Debug Token:

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

Why is the IP shown in your debug log for your Pi-hole on interface enp3s0 (I won't post the IP), the public IP of your internet address?

Typically, the IP is on a private IP range within your LAN, but yours does not appear to be.

Interface enp4s0 is on a private LAN range, and this is what Pi-hole is configured for.

What are the permissions in your /run/pihole directories?

ls -lha -R /run/pihole*

/run/pihole:
total 0
drwxr-xr-x 2 pihole pihole 40 Aug 3 10:14 **.**
drwxr-xr-x 30 root root 840 Aug 3 12:15 **..**

/run/pihole-ftl:
total 8.0K
drwxr-xr-x 2 pihole pihole 100 Aug 3 10:54 **.**
drwxr-xr-x 30 root root 840 Aug 3 12:15 **..**
srwxrwxrwx 1 pihole pihole 0 Aug 3 10:54 **FTL.sock**
-rw-r--r-- 1 pihole pihole 5 Aug 3 10:54 pihole-FTL.pid
-rw-r--r-- 1 pihole pihole 4 Aug 3 11:48 pihole-FTL.port

I haven't manually configured anything IP-related within Pi-hole. I looked at that screen and saw that it would automatically bind only to the LAN interface, so I left it alone.

The fact that this interface has your public IP is a concern. There should be no exposure of the Pi to the WAN - it should be completely NAT'd behind your router. No DMZ, no port forward, etc from the router.

Maybe that's an issue of best practices, but this is my edge device. That's where I have it running right now. Maybe I'll move it if I build another machine but for now, it seems unlikely that that could be preventing the init script from creating a directory.

Please run pihole -r and select the repair option. If any errors are produced, please post them here.

[✗] DNS service is NOT running

I've done that before but it brings up another issue that I forgot to mention earlier. This shows up occasionally, yet it actually is running. The dashboard shows it as active and the clients are able to use it.

I see what the issue is: You changed the folder from /run/ to /run/pihole-FTL/ via pihole-FTL.conf

The install command runs without the -D flag.

As the new subdir does not exist, it fails.

This is a bug. I'll write a patch tomorrow.

What is the thought process behind putting your FTL log into a /run directory instead of the /var/log/pihole directory?

Interesting. There was no thought process. I never knowingly changed that manually. I migrated the config files from a previous install on a Manjaro system. I never messed with paths there but if there are differences in what the installer does on different distributions, it might come from that. That's the only way I can imagine it got changed. That seems like a weird place to put that and I would never have done it intentionally. I guess I should have started from scratch instead of trying to reuse my old config.

Thanks! I'll give you some time and do an update.

My advice would be to remove these entries in the configuration file and let Pi-hole put the files in the default locations:

-rw-r--r-- 1 root root 2.7K Aug  3 11:05 /etc/pihole/pihole-FTL.conf
   LOGFILE=/run/log/pihole-ftl/pihole-FTL.log
   PIDFILE=/run/pihole-ftl/pihole-FTL.pid
   PORTFILE=/run/pihole-ftl/pihole-FTL.port
   SOCKETFILE=/run/pihole-ftl/FTL.sock

If you do make these changes, after you do so restart FTL with pihole restartdns

[✓] Restarting DNS server

No error! Thanks!

1 Like

About 10 minutes later, it stopped working, but it started right up again. Lots of errors in FTL.log and error-pihole.log

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

rob@gateway:~$ pihole status
[✗] DNS service is NOT running
[✗] DNS service is NOT running
rob@gateway:~$ pihole restartdns
[✓] Restarting DNS server
rob@gateway:~$ pihole status
[✓] FTL is listening on port 53
[✓] UDP (IPv4)
[✓] TCP (IPv4)
[✓] UDP (IPv6)
[✓] TCP (IPv6)
[✓] Pi-hole blocking is enabled

You appear to have some errors in your query database (about 12 minutes after Pi-hole restart):

-----tail of FTL.log------
   [2022-08-03 16:20:24.744 45689M] SQLite3 message: no such column: aliasclient_id in "SELECT aliasclient_id FROM network WHERE id = (SELECT network_id FROM network_addresses WHERE ip = ? AND aliasclient_id IS NOT NULL GROUP BY ip HAVING max(lastSeen));" (1)
   [2022-08-03 16:20:24.744 45689M] getAliasclientIDfromIP("10.0.1.29") - SQL error prepare: SQL logic error
   [2022-08-03 16:20:25.084 45689M] SQLite3 message: no such column: aliasclient_id in "SELECT aliasclient_id FROM network WHERE id = (SELECT network_id FROM network_addresses WHERE ip = ? AND aliasclient_id IS NOT NULL GROUP BY ip HAVING max(lastSeen));" (1)
   [2022-08-03 16:20:25.084 45689M] getAliasclientIDfromIP("10.0.1.48") - SQL error prepare: SQL logic error

You can run a quick check on this database with the following command:

pihole-FTL sqlite3 pihole-FTL.db "PRAGMA integrity_check"

You can try flushing the network table from the web admin GUI > Settings > System.

If you want to start with a fresh database (and keep the old), these commands will do it:

sudo service pihole-FTL stop

sudo mv /etc/pihole/pihole-FTL.db /etc/pihole/pihole-FTL-old.db

sudo service pihole-FTL start

Our installer does not change any file location based on the distribution. However, Arch (and its derivatives) are not supported distributions, but use their own installer via AUR.

Manjaro is based on Arch, which is not a supported distribution. As Yubi noted, it has its own installer.

You may be chasing artifacts of Manjaro for a while.

It said ok. It hasn't done it again since. I'll try a fresh database if it happens again. Thanks