Error on adding blocklists on admin page

First time using these tools: lighttpd, php, sqlite, pi-hole

Unable to Add List using Admin page

  • running Xubuntu 22.04 installed a week ago
  • installed Pi-Hole using the normal curl command, chose to install lighttpd for Admin Page
  • php-sqlite3 package installed

Expected Behaviour:

Adding a list and update gravity with no errors from the admin page

Actual Behaviour:

When adding any new list I get a warning red rectangle on the top right:

"Fatal error: Uncaught Error: Undefined constant "SQLITE3_OPEN_READWRITE" in /var/www/html/admin/scripts/pi-hole/php/groups.php:27 Stack trace: #0 {main} thrown in /var/www/html/admin/scripts/pi-hole/php/groups.php on line 27"


This machine has been running Pi-Hole for a week with no issues, even adding other blocklists. Then llighttpd service was not starting with a exit code error, I reinstalled and now seems to have issues with permissions(?)

It seems to be a php or sqlite (I'm really new to this) permissions issue, before this I was getting the admin page rendered in plain text that I was able to resolve by running:

$ sudo chmod -R 744 /var/lib/php
$ sudo chown -R www-data:www-data /var/lib/php

Any way to reset these permissions? I'm really trying to avoid a fresh OS install... ah! pi-hole is up and running, it seems to be something with the Admin page

Thank you very much!
Asensio

Debug Token:

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

Apparently you have 2 different issues, but not related to permissions.

1. Missing PHP module:

This usually means php-sqlite3 is not correctly installed or it is misconfigured.

Apparently this issue has been fixed somehow.
Your log shows PHP is able to connect to the database and lighttpd is running.

*** [ DIAGNOSING ]: Pi-hole processes
[✓] lighttpd daemon is active

Note:
I'm not sure what are the consequences of running sudo chmod -R 744 /var/lib/php.
Maybe you will need to purge your PHP installation and reinstall it (or a full system restore).

2. Database file issue:

Your debug log is showing many "no such column" errors, like these:

[2024-04-07 19:53:00.102 8070/T8086] ERROR: SQL query "UPDATE network_addresses SET name = NULL WHERE nameUpdated < 1680979980;" failed: SQL logic error (SQLITE_ERROR)
[2024-04-07 19:54:00.015 8070/T8086] SQLite3 message: no such column: name in "UPDATE network_addresses SET name = NULL WHERE nameUpdated < 1680980040;" (1)
  (...)
[2024-04-07 19:55:13.567 8070M] getNameFromIP("::1") - SQL error prepare: SQL logic error
[2024-04-07 19:55:13.618 8070M] 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)
  (...)

This means the database file is incomplete, missing some fields or tables.
This is confirmed by the database size:

*** [ DIAGNOSING ]: Pi-hole FTL Query Database
-rw-rw-r-- 1 pihole pihole 44K abr  7 19:20 /etc/pihole/pihole-FTL.db

Your file is only 44Kb in size, but an empty database should be 80Kb.

To fix this issue, run these commands to move the broken database to a new file name.
Pi-hole will automatically create a fresh database.

sudo service pihole-FTL stop
sudo mv /etc/pihole/pihole-FTL.db /etc/pihole/pihole-FTL-old.db
sudo service pihole-FTL start

Thank you so much for your answer,

tried the FTL.db commands but same error.

I've been googleing around, testing and trying things and now I dont think this is related to pi-hole as it was installed with no issues and running fine before. I got to a point that it's better just to backup /home and restore the OS

Again, thank you!
Asensio

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