Percentage Blocked blinking 'Undefined%'

The issue I am facing:

After a reboot or restart (pihole restartdns) everything works normally as expected, however after a period of time when I pull up the admin interface the section that shows the percentage Blocked blinks with 'Undefined%

Details about my system:

I am running the latest version of PiHole on a Raspberry Pi Desktop environment. Debian kernel with Jessie (?) desktop environment.

What I have changed since installing Pi-hole:

Quite literally nothing except system updates and upgrades.

Jessie has been unsupported for several years now.

Please upload a debug log and post just the token that is generated after the log is uploaded by running the following command from the Pi-hole host terminal:

pihole -d

or do it through the Web interface:

Tools > Generate Debug Log

Yeah I didn't think Jessie sounded right either, but it's the latest version of Pi. I'll get that information and post it.

https://tricorder.pi-hole.net/61zh2r2a9e

You are running Buster, not Jessie. Buster is supported.

*** [ DIAGNOSING ]: Operating system
[i] dig return code:  0
[i] dig response:  "Raspbian=9,10 Ubuntu=16,18,20 Debian=9,10 Fedora=32,33 CentOS=7,8"
[✓] Distro:  Debian
[✓] Version: 10

You have some errors/abnormal entries in your logs:

-rw-r--r-- 1 pihole pihole 3022789 May  4 13:04 /var/log/pihole-FTL.log
   -----head of pihole-FTL.log------
   [2021-05-04 00:00:05.242 8625/T8626] Client denied (at max capacity of 255): 321
   [2021-05-04 00:00:05.242 8625/T8626] IPv4 telnet error: Success (0)

 -----tail of pihole-FTL.log------
   [2021-05-04 13:03:42.812 22096M] SQLite3 message: no such table: network in "SELECT hwaddr FROM network WHERE id = (SELECT network_id FROM network_addresses WHERE ip = ? GROUP BY ip HAVING max(lastSeen));" (1)
   [2021-05-04 13:03:42.812 22096M] getMACfromIP("192.168.7.102") - SQL error prepare: SQL logic error
   [2021-05-04 13:03:42.812 22096M] SQLite3 message: no such table: network_addresses in "SELECT name FROM network_addresses WHERE name IS NOT NULL AND ip = ?;" (1)
   [2021-05-04 13:03:42.812 22096M] getNameFromIP("192.168.7.102") - SQL error prepare: SQL logic error
   [2021-05-04 13:03:42.813 22096M] SQLite3 message: no such table: network in "SELECT interface FROM network JOIN network_addresses ON network_addresses.network_id = network.id WHERE network_addresses.ip = ? AND interface != 'N/A' AND interface IS NOT NULL;" (1)
   [2021-05-04 13:03:42.813 22096M] getIfaceFromIP("192.168.7.102") - SQL error prepare: SQL logic error
   [2021-05-04 13:03:42.814 22096M] SQLite3 message: no such table: network in "SELECT hwaddr FROM network WHERE id = (SELECT network_id FROM network_addresses WHERE ip = ? GROUP BY ip HAVING max(lastSeen));" (1)
   [2021-05-04 13:03:42.814 22096M] getMACfromIP("192.168.7.102") - SQL error prepare: SQL logic error
   [2021-05-04 13:03:42.815 22096M] SQLite3 message: no such table: network_addresses in "SELECT name FROM network_addresses WHERE name IS NOT NULL AND ip = ?;" (1)
...
   [2021-05-04 13:03:59.802 22096M] SQLite3 message: no such table: network in "SELECT interface FROM network JOIN network_addresses ON network_addresses.network_id = network.id WHERE network_addresses.ip = ? AND interface != 'N/A' AND interface IS NOT NULL;" (1)
   [2021-05-04 13:03:59.802 22096M] getIfaceFromIP("192.168.7.15") - SQL error prepare: SQL logic error
   [2021-05-04 13:04:00.140 22096/T22100] SQLite3 message: no such table: network_addresses in "DELETE FROM network_addresses WHERE lastSeen < 1588619040;" (1)
   [2021-05-04 13:04:00.140 22096/T22100] ERROR: SQL query "DELETE FROM network_addresses WHERE lastSeen < 1588619040;" failed: SQL logic error
   [2021-05-04 13:04:00.140 22096/T22100] SQLite3 message: API call with invalid database connection pointer (21)
   [2021-05-04 13:04:00.140 22096/T22100] SQLite3 message: misuse at line 165242 of [5d4c65779d] (21)
   [2021-05-04 13:04:00.140 22096/T22100] Error while trying to close database: bad parameter or other API misuse

How much traffic is your Pi-hole seeing on a daily basis? Please post the output of the following run from the Pi terminal:

ls -lha /etc/pihole/pihole-FTL.db

sqlite3 /etc/pihole/pihole-FTL.db "SELECT value FROM counters WHERE id = 0"

echo ">stats >quit" | nc localhost 4711

echo ">top-clients withzero (25) >quit" | nc localhost 4711

We have about 30+ devices in our home network, traffic will vary depending on the user and what they're doing. I'll run those commands and post them.

-rw-r--r-- 1 pihole pihole 0 Dec 20 11:50 /etc/pihole/pihole-FTL.db

Is that script supposed to run on one line? I've tried to copy and paste the SQL line item and it provides me with
Error: no such table: counters

domains_being_blocked 115711
dns_queries_today 8742
ads_blocked_today 865
ads_percentage_today 9.894761
unique_domains 1612
queries_forwarded 4674
queries_cached 2933
clients_ever_seen 21
unique_clients 21
dns_queries_all_types 8742
reply_NODATA 254
reply_NXDOMAIN 1529
reply_CNAME 1126
reply_IP 3609
privacy_level 0
status enabled

Nothing displayed for the line:
echo ">top-clients withzero (25) >quit" | nc localhost 4711

It appears your long term database is corrupted. The filesize is zero, and the database doesn't have information that would be expected. Let's move the existing file and start a new one and see if the problem persists.

sudo service pihole-FTL stop

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

sudo service pihole-FTL start

OK, did that. Now waiting to see if the % Blocked starts blinking again. Fingers crossed.

That looks like it fixed the issue, I let it do its thing during the night and checked this morning, information has populated and its no longer blinking.

Thank you very much!

If we can indulge just a bit further, what do you think caused the issue so that I can be proactive on it? Power loss? Anything like that?

It's hard to say. A sudden power loss can corrupt files, as one possibility.

That's what I was thinking, too. Time to invest in a UPS then.

Again thank you very much for your help, I appreciate you!

A post was split to a new topic: Free space on SD card?

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