Network Page doesn't work

I can't get the Network Page to work, I keep getting "Error connecting to database". I have read some other things regarding this error which seems to point to the idea that I don't have SQLite installed but according to PHPInfo I have SQLite version 3.26.0 installed.

Any ideas? I'm running Fedora Server Edition inside a VM. By the way, I'm not exactly familiar with Linux; I know just enough to be dangerous. I'm more of a Windows person, I know... go ahead and laugh if you must.

No need for this. We all start learning new things bottom up!

Please provide the most recent line(s) of /var/log/lighttpd/error.log after you triggered this error on the Network Page. You can get the most recent lines by running, for instance,

sudo tail /var/log/lighttpd/error.log

Nothing in that log file that stands out.

The error you're seeing is generated here:

I was assuming that an error would be logged if the database cannot be read.

Please also try

sqlite3 /etc/pihole/pihole-FTL.db "SELECT COUNT(*) FROM network;"

in the terminal on your Pi-hole (without sudo).

[tom@unknown00155d01f100 ~]# sqlite3 /etc/pihole/pihole-FTL.db "SELECT COUNT(*) FROM network;"
6
[tom@unknown00155d01f100 ~]#

This seems fine so the database is intact and it is probably a permission issue.

Please also tell us the output of

ls -lh /etc/pihole/pihole-FTL.db
sudo -u www-data sqlite3 /etc/pihole/pihole-FTL.db "SELECT COUNT(*) FROM network;"

Just FYI, I've extended the error message so users get the error more directly from the next release on.
https://github.com/pi-hole/AdminLTE/pull/1000

[tom@unknown00155d01f100 ~]# ls -lh /etc/pihole/pihole-FTL.db
-rw-rw----. 1 pihole pihole 19M Sep 3 12:02 /etc/pihole/pihole-FTL.db

[tom@unknown00155d01f100 ~]$ sudo -u www-data sqlite3 /etc/pihole/pihole-FTL.db "SELECT COUNT(*) FROM network;"
sudo: unknown user: www-data
sudo: unable to initialize policy plugin

Ah, yeah, sorry, I missed that you're running Fedora. The command should have been

sudo -u lighttpd sqlite3 /etc/pihole/pihole-FTL.db "SELECT COUNT(*) FROM network;"

and also

groups lighttpd

[tom@unknown00155d01f100 ~]$ sudo -u lighttpd sqlite3 /etc/pihole/pihole-FTL.db "SELECT COUNT(*) FROM network;"
[sudo] password for tom: (my password goes here)
Error: unable to open database "/etc/pihole/pihole-FTL.db": unable to open database file

[tom@unknown00155d01f100 ~]$ groups lighttpd
lighttpd : lighttpd

This is the issue. The user lighttpd should be member of the group pihole in order to access the database. This should have been done by the installer for you, but apparently something happened to the membership. Please try

sudo usermod -a -G pihole lighttpd
sudo systemctl restart lighttpd

[tom@unknown00155d01f100 ~]$ sudo useradd -G pihole lighttpd
useradd: user 'lighttpd' already exists

I updated my post above.

OK, I executed "usermod -a -G pihole lighttpd" and still getting the error in the web interface.

How does the sudo -u lighttpd command output look like?

A user has to re-login after a group membership change. I figured restarting lighttpd would have been enough to do this but if you tried that already, you might need to restart the entire VM...

[tom@unknown00155d01f100 ~]$ sudo -u lighttpd sqlite3 /etc/pihole/pihole-FTL.db "SELECT COUNT(*) FROM network;"
[sudo] password for tom: (my password goes here)
Error: unable to open database "/etc/pihole/pihole-FTL.db": unable to open database file

Please reboot and try again afterwards.

If it still doesn't work: Does the command groups lighttpd now show the membership in group pihole?

Already tried rebooting, didn't work.

[tom@unknown00155d01f100 ~]$ groups lighttpd
lighttpd : lighttpd pihole

OK, I changed the permissions from 0600 (rw-------) to 0660 (rw-rw----) for pihole-FTL.db and now the network page works.

[tom@unknown00155d01f100 ~]$ ls -hal /etc/pihole | grep pihole-FTL.db
-rw-rw----. 1 pihole pihole 19M Sep 3 12:57 pihole-FTL.db

But I thought you already had this before?...

Well, whatever, it works now and that's the main point here.

Uh... no, I didn't. I didn't think I needed to. I thought that if the user had access to the file it would work. I forgot that Linux file permissions are setup like this... user.group.everyone.

See? I'm not very familiar with Linux, I know just enough to be dangerous.

Anyways, thank you for your assistance. :smile: