Error message: "Attempt to write a readonly database"

Hi!

I also updated Pi-Hole to last version 5 and after that
Pi-Hole don't block anymore, also I can't write to the database to add groups and clients. :frowning:

"Database read-only error".

I only can login to Pi-Hole with the admin-page.

so,

I tried out to fix that problem.

$ chown www-data:pihole -R /var/www/html
$ chmod 0775 /var/www/html

$ usermod -a -G www-data pihole

Rebooted.

$ su -
$ service lighttpd status = Active: failed

Revert back to:

$ chown www-data:www-data -R /var/www/html

$ service lighttpd status = Active: active (running)

$ groups pihole
pihole : pihole www-data

$ groups www-data
www-data : www-data pihole

$ groups lighttpd
lighttpd : lighttpd

$ ls -lh /etc | grep pihole
drwxrwxr-x 3 pihole pihole 12K Mai 25 17:11 pihole

$ ls -lh /etc/pihole/gravity.db
-rw-rw-r-- 1 pihole pihole 49M Mai 25 12:44 /etc/pihole/gravity.db

$ ls -lh /etc/pihole/macvendor.db
-rw-r--r-- 1 pihole pihole 2,4M Mai 25 12:43 /etc/pihole/macvendor.db

$ ls -lh /etc/pihole/pihole-FTL.db
-rw-r--r-- 1 pihole pihole 233M Jun 4 2019 /etc/pihole/pihole-FTL.db

$ ps -o uid,user,gid,group,pid,cmd -C lighttpd
33 www-data 33 www-data 4220 /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf

Error is still present:
While executing adlist_by_group statement: attempt to write a readonly database

Here's my "pihole-FTL.conf"

SOCKET_LISTENING=all
AAAA_QUERY_ANALYSIS=no
RESOLVE_IPV6=no
RESOLVE_IPV4=yes
MAXDBDAYS=0
DBINTERVAL=0.0
DBFILE=/etc/pihole/pihole-FTL.db
MAXLOGAGE=0
FTLPORT=4711
IGNORE_LOCALHOST=no
BLOCKINGMODE=NULL
CNAME_DEEP_INSPECT=true
REGEX_DEBUGMODE=false
PRIVACYLEVEL=3
DELAY_STARTUP=0
DBIMPORT=no

(disabled pihole-FTL.db because I don't want logs, only Blocking + DNS)

Pi-Hole v4 works great, Pi-Hole v5 at me not. Horrible :wink:

Any idea whats wrong?

Please help, thanks!

1 Like

Pi-Hole is running. DNS is Working with that, Blocking isn't Working anymore.

Must I change also the user/group permission of "/var/www/html/"

to this:

$ chown pihole:www-data -R /var/www/html/
$ chmod 0775 -R /var/www/html/

or

$ chown www-data:www-data -R /var/www/html/
$ chmod 0755 -R /var/www/html/

in Pi-Hole Admin-page.

Error, something went wrong!
While executing: attempt to write a readonly database
Added 0 out of 1 clients

In which database file is Pi-Hole Storing the information of groups/clients/domains?

Is that pihole-FTL.db?

please help to fix it, thanks!

I tried out and edited my pihole-FTL.conf:

SOCKET_LISTENING=all
AAAA_QUERY_ANALYSIS=no
ANALYZE_ONLY_A_AND_AAAA=false
RESOLVE_IPV6=no
RESOLVE_IPV4=yes
MAXDBDAYS=365
DBINTERVAL=1.0
DBFILE=/etc/pihole/pihole-FTL.db
MAXLOGAGE=24.0
FTLPORT=4711
IGNORE_LOCALHOST=no
BLOCKINGMODE=NULL
CNAME_DEEP_INSPECT=true
REGEX_DEBUGMODE=false
PRIVACYLEVEL=3
DELAY_STARTUP=0
DBIMPORT=no

Also, with these Settings, I still cannot save anything to the Pi-Hole database.

$ sudo pihole status
[✓] DNS service is running
[✓] Pi-hole blocking is Enabled

Pi-Hole does not block any website.

My fstab: (/tmp) - 16,8gb left

tmpfs /tmp tmpfs rw,nosuid,nodev,noexec 0 0
tmpfs /var/tmp tmpfs rw,nosuid,nodev,noexec 0 0

File permissions of: "/etc/pihole"

$ ls -lha /etc/pihole

> drwxr-xr-x   3 pihole pihole  12K Mai 26 16:28 .
> drwxr-xr-x 146 root   root    16K Mai 25 18:18 ..
> -rw-r--r--   1 root   root   111K Mai 20 17:08 black.list
> -rw-r--r--   1 pihole pihole    0 Mai 26 16:13 dhcp.leases
> -rw-r--r--   1 root   root    605 Apr 24 10:10 dns-servers.conf
> -rw-r--r--   1 root   root     14 Mai 26 14:01 GitHubVersions
> -rw-r--r--   1 root   root    49M Mai 25 18:13 gravity.db
> -rw-r--r--   1 root   root    12M Apr  4 18:02 gravity.list
> -rw-r--r--   1 root   root   1,1K Mai 25 12:43 install.log
> -rw-------   1 root   root   4,6M Mai 25 13:01 list.0.adblock.mahakala.is.domains
> -rw-------   1 root   root   581K Mai 25 12:43 list.10.mirror1.malwaredomains.com.domains
> -rw-------   1 root   root   403K Mai 25 12:43 list.11.sysctl.org.domains
> -rw-------   1 root   root      0 Mai 25 18:13 list.12.zeustracker.abuse.ch.domains
> -rw-------   1 root   root    54K Mai 25 18:13 list.13.pgl.yoyo.org.domains
> -rw-------   1 root   root    43K Mai 25 18:13 list.14.raw.githubusercontent.com.domains
> -rw-------   1 root   root    79K Mai 25 18:13 list.15.raw.githubusercontent.com.domains
> -rw-------   1 root   root      0 Mai 25 18:13 list.16.raw.githubusercontent.com.domains
> -rw-------   1 root   root    51K Mai 25 18:13 list.17.raw.githubusercontent.com.domains
> -rw-------   1 root   root   281K Mai 25 18:13 list.18.raw.githubusercontent.com.domains
> -rw-------   1 root   root    54K Mai 25 18:13 list.19.raw.githubusercontent.com.domains
> -rw-------   1 root   root   2,0M Mai 25 18:13 list.1.www.dshield.org.domains
> -rw-------   1 root   root    16K Mai 25 18:13 list.20.raw.githubusercontent.com.domains
> -rw-------   1 root   root   1,1M Mai 25 18:13 list.22.raw.githubusercontent.com.domains
> -rw-------   1 root   root   5,6K Mai 25 18:13 list.23.raw.githubusercontent.com.domains
> -rw-------   1 root   root   544K Mai 25 18:13 list.24.raw.githubusercontent.com.domains
> -rw-------   1 root   root   2,3K Mai 25 18:13 list.25.raw.githubusercontent.com.domains
> -rw-------   1 root   root    54K Mai 25 18:13 list.26.raw.githubusercontent.com.domains
> -rw-------   1 root   root   200K Mai 25 18:13 list.27.raw.githubusercontent.com.domains
> -rw-------   1 root   root    38K Mai 25 18:13 list.28.raw.githubusercontent.com.domains
> -rw-------   1 root   root   126K Mai 25 18:13 list.29.raw.githubusercontent.com.domains
> -rw-------   1 root   root    31K Mai 25 18:13 list.2.raw.githubusercontent.com.domains
> -rw-------   1 root   root   252K Mai 25 18:13 list.30.raw.githubusercontent.com.domains
> -rw-------   1 root   root    13K Mai 25 18:13 list.31.raw.githubusercontent.com.domains
> -rw-------   1 root   root   545K Mai 25 18:13 list.32.raw.githubusercontent.com.domains
> -rw-------   1 root   root   1,1M Mai 25 18:13 list.33.raw.githubusercontent.com.domains
> -rw-------   1 root   root    43K Mai 25 18:13 list.34.raw.githubusercontent.com.domains
> -rw-------   1 root   root    44K Mai 25 18:13 list.35.raw.githubusercontent.com.domains
> -rw-------   1 root   root     28 Mai 25 18:13 list.36.raw.githubusercontent.com.domains
> -rw-------   1 root   root    521 Mai 25 18:13 list.37.raw.githubusercontent.com.domains
> -rw-------   1 root   root    39K Mai 25 18:13 list.38.raw.githubusercontent.com.domains
> -rw-------   1 root   root    53K Mai 25 18:13 list.39.raw.githubusercontent.com.domains
> -rw-------   1 root   root    47K Mai 25 18:13 list.3.raw.githubusercontent.com.domains
> -rw-------   1 root   root    20K Mai 25 18:13 list.40.raw.githubusercontent.com.domains
> -rw-------   1 root   root    31K Mai 25 18:13 list.41.raw.githubusercontent.com.domains
> -rw-------   1 root   root    364 Mai 25 18:13 list.42.raw.githubusercontent.com.domains
> -rw-------   1 root   root    47K Mai 25 18:13 list.43.raw.githubusercontent.com.domains
> -rw-------   1 root   root   1,5K Mai 25 18:13 list.44.raw.githubusercontent.com.domains
> -rw-------   1 root   root   200K Mai 25 18:13 list.45.raw.githubusercontent.com.domains
> -rw-------   1 root   root    22K Mai 25 18:13 list.46.raw.githubusercontent.com.domains
> -rw-------   1 root   root    50K Mai 25 18:13 list.47.raw.githubusercontent.com.domains
> -rw-------   1 root   root    30K Mai 25 18:13 list.48.raw.githubusercontent.com.domains
> -rw-------   1 root   root    14K Mai 25 18:13 list.49.raw.githubusercontent.com.domains
> -rw-------   1 root   root   1,5K Mai 25 18:13 list.4.raw.githubusercontent.com.domains
> -rw-------   1 root   root   281K Mai 25 18:13 list.51.raw.githubusercontent.com.domains
> -rw-------   1 root   root   129K Mai 25 18:13 list.52.raw.githubusercontent.com.domains
> -rw-------   1 root   root    62K Mai 25 18:13 list.53.raw.githubusercontent.com.domains
> -rw-------   1 root   root   5,8K Mai 25 18:13 list.54.raw.githubusercontent.com.domains
> -rw-------   1 root   root   240K Mai 25 18:13 list.55.raw.githubusercontent.com.domains
> -rw-------   1 root   root    12K Mai 25 18:13 list.56.raw.githubusercontent.com.domains
> -rw-------   1 root   root   166K Mai 25 18:13 list.57.gitlab.com.domains
> -rw-------   1 root   root   5,6K Mai 25 18:13 list.58.gitlab.com.domains
> -rw-------   1 root   root   244K Mai 25 18:13 list.59.www.stopforumspam.com.domains
> -rw-------   1 root   root   203K Mai 25 18:13 list.5.raw.githubusercontent.com.domains
> -rw-------   1 root   root   9,5K Mai 25 18:13 list.62.raw.githubusercontent.com.domains
> -rw-------   1 root   root   143K Mai 25 18:13 list.6.raw.githubusercontent.com.domains
> -rw-------   1 root   root   210K Mai 25 12:43 list.7.winhelp2002.mvps.org.domains
> -rw-------   1 root   root   1,3M Mai 25 18:13 list.8.www.joewein.net.domains
> -rw-------   1 root   root   1,1M Mai 25 18:13 list.9.raw.githubusercontent.com.domains
> -rw-r--r--   1 root   root     20 Mai 26 16:30 localbranches
> -rw-r--r--   1 root   root     42 Mai 25 18:13 local.list
> -rw-r--r--   1 root   root     43 Mai 26 16:30 localversions
> -rw-r--r--   1 root   root    234 Mai 25 12:43 logrotate
> -rw-r--r--   1 root   root   2,4M Mai 25 12:43 macvendor.db
> -rw-r--r--   1 root   root    565 Mai 26 15:33 pihole-FTL.conf
> -rw-r--r--   1 pihole pihole 233M Jun  4  2019 pihole-FTL.db
> -rw-r--r--   1 root   root    708 Mai 26 16:28 setupVars.conf

File permissions of: "/etc/pihole/migration_backup"

$ ls -lha /etc/pihole/migration_backup

> drwxr-xr-x 2 pihole pihole   4,0K Mai 26 16:20 .
> drwxr-xr-x 3 pihole pihole    12K Mai 26 16:28 ..
> -rw-r--r-- 1 root   root     5,3K Mai 26 16:21 adlists.list
> -rw-r--r-- 1 root   root     111K Mai 20 17:08 blacklist.txt
> -rw-rw-r-- 1 pihole www-data    0 Sep  5  2018 regex.list
> -rw-r--r-- 1 root   root        0 Nov 11  2018 whitelist.txt

Got Pi-Hole Blocking to work and Dashboard is showing stats but
I can't save anything parameters in the admin-panel of Pi-Hole:

Changed again file permissions of: "/etc/pihole"

from here:
[Solved] While executing: attempt to write a readonly database error - #4 by deHakkelaar

> 
> root:root      644  /etc/pihole/adlists.list
> root:root      644  /etc/pihole/adlists.list.old
> pihole:pihole  644  /etc/pihole/dhcp.leases
> root:root      644  /etc/pihole/dns-servers.conf
> root:root      644  /etc/pihole/ftlbranch
> root:root      644  /etc/pihole/GitHubVersions
> pihole:pihole  664  /etc/pihole/gravity.db
> root:root      644  /etc/pihole/gravity.list
> root:root      644  /etc/pihole/install.log
> root:root      644  /etc/pihole/list.0.raw.githubusercontent.com.domains
> root:root      644  /etc/pihole/list.1.mirror1.malwaredomains.com.domains
> root:root      644  /etc/pihole/list.2.sysctl.org.domains
> root:root      644  /etc/pihole/list.3.s3.amazonaws.com.domains
> root:root      644  /etc/pihole/list.4.s3.amazonaws.com.domains
> root:root      644  /etc/pihole/list.6.dehakkelaar.nl.domains
> root:root      644  /etc/pihole/list.7.gitlab.com.domains
> root:root      644  /etc/pihole/list.8.blocklist.cyberthreatcoalition.org.domains
> root:root      644  /etc/pihole/localbranches
> root:root      644  /etc/pihole/local.list
> root:root      644  /etc/pihole/localversions
> root:root      644  /etc/pihole/logrotate
> pihole:pihole  644  /etc/pihole/macvendor.db
> root:root      755  /etc/pihole/migration_backup
> pihole:root    664  /etc/pihole/pihole-FTL.conf
> pihole:pihole  644  /etc/pihole/pihole-FTL.db
> root:root      644  /etc/pihole/setupVars.conf
> root:root      644  /etc/pihole/setupVars.conf.update.bak

My:
$ ls -lha /etc/pihole

drwxr-xr-x   3 pihole pihole  12K Mai 26 17:11 .
drwxr-xr-x 146 root   root    16K Mai 25 18:18 ..
-rw-r--r--   1 root   root   5,3K Mai 26 16:21 adlists.list
-rw-r--r--   1 root   root   111K Mai 20 17:08 black.list
-rw-r--r--   1 pihole pihole    0 Mai 26 16:13 dhcp.leases
-rw-r--r--   1 root   root    605 Apr 24 10:10 dns-servers.conf
-rw-r--r--   1 root   root     14 Mai 26 14:01 GitHubVersions
-rw-rw-r--   1 pihole pihole  49M Mai 25 18:13 gravity.db
-rw-r--r--   1 root   root    12M Apr  4 18:02 gravity.list
-rw-r--r--   1 root   root   1,1K Mai 25 12:43 install.log
-rw-r--r--   1 root   root   4,6M Mai 25 13:01 list.0.adblock.mahakala.is.domains
-rw-r--r--   1 root   root   2,0M Mai 25 18:13 list.1.www.dshield.org.domains
-rw-r--r--   1 root   root    31K Mai 25 18:13 list.2.raw.githubusercontent.com.domains
-rw-r--r--   1 root   root    47K Mai 25 18:13 list.3.raw.githubusercontent.com.domains
-rw-r--r--   1 root   root   1,5K Mai 25 18:13 list.4.raw.githubusercontent.com.domains
-rw-r--r--   1 root   root   203K Mai 25 18:13 list.5.raw.githubusercontent.com.domains
-rw-r--r--   1 root   root   143K Mai 25 18:13 list.6.raw.githubusercontent.com.domains
-rw-r--r--   1 root   root   210K Mai 25 12:43 list.7.winhelp2002.mvps.org.domains
-rw-r--r--   1 root   root   1,3M Mai 25 18:13 list.8.www.joewein.net.domains
-rw-r--r--   1 root   root   1,1M Mai 25 18:13 list.9.raw.githubusercontent.com.domains
-rw-r--r--   1 root   root   581K Mai 25 12:43 list.10.mirror1.malwaredomains.com.domains
-rw-r--r--   1 root   root     20 Mai 26 17:10 localbranches
-rw-r--r--   1 root   root     42 Mai 25 18:13 local.list
-rw-r--r--   1 root   root     43 Mai 26 17:10 localversions
-rw-r--r--   1 root   root    234 Mai 25 12:43 logrotate
-rw-r--r--   1 pihole pihole 2,4M Mai 25 12:43 macvendor.db
drwxr-xr-x   2 root   root   4,0K Mai 26 16:53 migration_backup
-rw-rw-r--   1 pihole root    565 Mai 26 15:33 pihole-FTL.conf
-rw-r--r--   1 pihole pihole 233M Jun  4  2019 pihole-FTL.db
-rw-r--r--   1 root   root    708 Mai 26 17:11 setupVars.conf

Error is still present:

While executing adlist_by_group statement: attempt to write a readonly database

Admin-Panel, Stats, DNS + Blocking are Working, but can't save any parameters in the admin-panel.

What's wrong?

Please post the token generated by

pihole -d

or do it through the Web interface:

Tools > Generate Debug Log

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

Found some errors.

[i] Neutrino emissions detected...
[✓] Pulling blocklist source list into range

[i] Preparing new gravity database...
[✗] Unable to create new database /etc/pihole/gravity_temp.db
Error: unable to open database "/etc/pihole/gravity_temp.db": unable to open database file
[✓] Cleaning up stray matter
[✓] DNS service is running
[✓] Pi-hole blocking is Enabled

2020-05-26 14:02:08: (server.c.1464) server started (lighttpd/1.4.53)
2020-05-26 15:16:19: (mod_fastcgi.c.421) FastCGI-stderr: PHP Warning: fopen(/etc/pihole/custom.list): failed to open stream: No such file or directory in /var/www/html/admin/scripts/pi-hole/php/customdns.php on line 33
2020-05-26 15:16:28: (mod_fastcgi.c.421) FastCGI-stderr: PHP Warning: SQLite3::query(): Unable to prepare statement: 1, no such table: network in /var/www/html/admin/api_db.php on line 61
2020-05-26 15:16:57: (mod_fastcgi.c.421) FastCGI-stderr: PHP Warning: SQLite3Stmt::execute(): Unable to execute statement: attempt to write a readonly database in /var/www/html/admin/scripts/pi-hole/php/groups.php on line 784
2020-05-26 15:28:31: (mod_fastcgi.c.421) FastCGI-stderr: PHP Warning: SQLite3::query(): Unable to prepare statement: 1, no such table: network_addresses in /var/www/html/admin/scripts/pi-hole/php/groups.php on line 211
2020-05-26 15:28:57: (mod_fastcgi.c.421) FastCGI-stderr: PHP Warning: SQLite3Stmt::execute(): Unable to execute statement: attempt to write a readonly database in /var/www/html/admin/scripts/pi-hole/php/groups.php on line 265
2020-05-26 16:54:06: (mod_fastcgi.c.421) FastCGI-stderr: PHP Warning: SQLite3::query(): Unable to prepare statement: 1, no such table: network_addresses in /var/www/html/admin/scripts/pi-hole/php/groups.php on line 211
2020-05-26 16:54:24: (mod_fastcgi.c.421) FastCGI-stderr: PHP Warning: SQLite3Stmt::execute(): Unable to execute statement: attempt to write a readonly database in /var/www/html/admin/scripts/pi-hole/php/groups.php on line 7

** [ DIAGNOSING ]: Web version
[i] Web: v5.0 (https://discourse.pi-hole.net/t/how-do-i-update-pi-hole/249)
[i] Branch: master
[i] Commit: v5.0-0-gb86e4a31-dirty
[i] Status:  M .github/ISSUE_TEMPLATE.md
             M .github/PULL_REQUEST_TEMPLATE.md
             M .github/workflows/test.yml

You have modified local code. We cannot support any problems that arise from local modifications.

What do you mean about it?

I updated from Pihole v4 to v5.

I don't have these files in /etc/pi-hole
custom.list
gravity_temp.db

Should I completly remove Pihole and also folder "/var/www/html/"

and Install Pihole v5 new?

The code you have is not the code we ship.

The file custom.list won't exist until you create Local DNS records from the web admin GUI.

The file gravity_temp.db is a temporary file, and isn't persistent.

This may be your quickest solution.

I installed Pihole V5 via Pi-Hole bash script on pi-hole.net new and many php errors are gone.

But I can't write to the Pihole-database.
Read-only error.

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

Please help, thanks!

in file "/etc/group" is that correct?

www-data:x:33:pihole
pihole:x:999:www-data
lighttpd:x:1002:

on /tmp/ I have no ```
.gravity file.

Start all over, install the package exactly as provided. Make sure it works. Then make your modifications, if the modifications stop it working then you'll know where to fix it.

@ DanSchaper, I re-installed Pi-Hole V5,

Admin-Panel, Dashboard Showing Stats, Blocking Ads are Working.

it still appears:
Error, something went wrong!
While executing: attempt to write a readonly database
Added 0 out of 1 clients

Which file is the Pi-Hole database?

on /tmp I have permissions 0777, not read-only.

sudo service lighttpd status
● lighttpd.service - ####//"lighttpd"
Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2020-05-27 12:24:54 CEST; 8min ago
Process: 4288 ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf (code=exited, status=0/SUCCESS)
Main PID: 4302 (lighttpd)
Tasks: 6 (limit: 4915)
Memory: 29.2M
CGroup: /system.slice/lighttpd.service
├─4302 /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
├─4308 /usr/bin/php-cgi
├─4309 /usr/bin/php-cgi
├─4310 /usr/bin/php-cgi
├─4311 /usr/bin/php-cgi
└─4312 /usr/bin/php-cgi

Mai 27 12:25:54 bla sudo[5102]: pam_unix(sudo:session): session closed for user root
Mai 27 12:26:06 bla sudo[5121]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bi
n/pihole status web
Mai 27 12:26:06 bla sudo[5121]: pam_unix(sudo:session): session opened for user root by (uid=0)
Mai 27 12:26:06 bla sudo[5121]: pam_unix(sudo:session): session closed for user root
Mai 27 12:27:06 bla sudo[5160]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bi
n/pihole status web
Mai 27 12:27:06 bla sudo[5160]: pam_unix(sudo:session): session opened for user root by (uid=0)
Mai 27 12:27:06 bla sudo[5160]: pam_unix(sudo:session): session closed for user root
Mai 27 12:29:45 bla sudo[5465]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bi

that's the error in error.log of "lighttpd" when I want to write something
at Pi-Hole admin-panel to the Pi-Hole database:

2020-05-27 12:35:44: (mod_fastcgi.c.421) FastCGI-stderr: PHP Warning: SQLite3Stmt::execute(): Unable to execute statement: attempt to write a readonly database in /var/www/html/admin/scripts/pi-hole/php/groups.php on line 729
2020-05-27 12:35:47: (mod_fastcgi.c.421) FastCGI-stderr: PHP Warning: SQLite3Stmt::execute(): Unable to execute statement: attempt to write a readonly database in /var/www/html/admin/scripts/pi-hole/php/groups.php on line 729
2020-05-27 12:36:01: (mod_fastcgi.c.421) FastCGI-stderr: PHP Warning: SQLite3Stmt::execute(): Unable to execute statement: attempt to write a readonly database in /var/www/html/admin/scripts/pi-hole/php/groups.php on line 265
2020-05-27 12:44:35: (mod_fastcgi.c.421) FastCGI-stderr: PHP Warning: SQLite3Stmt::execute(): Unable to execute statement: attempt to write a readonly database in /var/www/html/admin/scripts/pi-hole/php/groups.php on line 265

How to fix that, please help, thanks!

File-permissions output:

ls -lha /var/www/html
total 16K
drwxr-xr-x 4 root root 4,0K Mai 26 18:22 .
drwxr-xr-x 3 root root 4,0K Mai 26 18:22 ..
drwxr-xr-x 7 root root 4,0K Mai 26 18:22 admin
drwxr-xr-x 2 root root 4,0K Mai 26 18:22 pihole

ls -lha /var/www/html/pihole
total 40K
drwxr-xr-x 2 root root 4,0K Mai 26 18:22 .
drwxr-xr-x 4 root root 4,0K Mai 26 18:22 ..
-rw-r--r-- 1 root root 13K Mai 26 18:22 blockingpage.css
-rw-r--r-- 1 root root 15K Mai 26 18:22 index.php

ls -lha /var/www/html/admin
total 476K
drwxr-xr-x 7 root root 4,0K Mai 26 18:22 .
drwxr-xr-x 4 root root 4,0K Mai 26 18:22 ..
-rw-r--r-- 1 root root 12K Mai 26 18:22 api_db.php
-rw-r--r-- 1 root root 9,3K Mai 26 18:22 api_FTL.php
-rw-r--r-- 1 root root 3,6K Mai 26 18:22 api.php
-rw-r--r-- 1 root root 2,3K Mai 26 18:22 auditlog.php
-rw-r--r-- 1 root root 2,3K Mai 26 18:22 CONTRIBUTING.md
-rw-r--r-- 1 root root 2,2K Mai 26 18:22 db_graph.php
-rw-r--r-- 1 root root 4,2K Mai 26 18:22 db_lists.php
-rw-r--r-- 1 root root 6,4K Mai 26 18:22 db_queries.php
-rw-r--r-- 1 root root 939 Mai 26 18:22 debug.php
-rw-r--r-- 1 root root 3,9K Mai 26 18:22 dns_records.php
drwxr-xr-x 8 root root 4,0K Mai 27 12:50 .git
drwxr-xr-x 3 root root 4,0K Mai 26 18:22 .github
-rw-r--r-- 1 root root 153 Mai 26 18:22 .gitignore
-rw-r--r-- 1 root root 1,3K Mai 26 18:22 gravity.php
-rw-r--r-- 1 root root 3,0K Mai 26 18:22 groups-adlists.php
-rw-r--r-- 1 root root 3,0K Mai 26 18:22 groups-clients.php
-rw-r--r-- 1 root root 6,8K Mai 26 18:22 groups-domains.php
-rw-r--r-- 1 root root 2,7K Mai 26 18:22 groups.php
-rw-r--r-- 1 root root 9,2K Mai 26 18:22 help.php
drwxr-xr-x 3 root root 4,0K Mai 26 18:22 img
-rw-r--r-- 1 root root 8,9K Mai 26 18:22 index.php
-rw-r--r-- 1 root root 14K Mai 26 18:22 LICENSE
-rw-r--r-- 1 root root 2,9K Mai 26 18:22 network.php
-rw-r--r-- 1 root root 1,5K Mai 26 18:22 package.json
-rw-r--r-- 1 root root 178K Mai 26 18:22 package-lock.json
-rw-r--r-- 1 root root 5,4K Mai 26 18:22 queries.php
-rw-r--r-- 1 root root 1,1K Mai 26 18:22 queryads.php
-rw-r--r-- 1 root root 9,0K Mai 26 18:22 README.md
drwxr-xr-x 4 root root 4,0K Mai 26 18:22 scripts
-rw-r--r-- 1 root root 90K Mai 26 18:22 settings.php
drwxr-xr-x 3 root root 4,0K Mai 26 18:22 style
-rw-r--r-- 1 root root 939 Mai 26 18:22 taillog-FTL.php
-rw-r--r-- 1 root root 931 Mai 26 18:22 taillog.php
-rw-r--r-- 1 root root 45 Mai 26 18:22 .user.php.ini

ls -lha /var/www/html/admin/scripts/pi-hole/php/
total 180K
drwxr-xr-x 2 root root 4,0K Mai 26 18:22 .
drwxr-xr-x 4 root root 4,0K Mai 26 18:22 ..
-rw-r--r-- 1 root root 2,5K Mai 26 18:22 add.php
-rw-r--r-- 1 root root 431 Mai 26 18:22 api_token.php
-rw-r--r-- 1 root root 5,0K Mai 26 18:22 auth.php
-rw-r--r-- 1 root root 3,8K Mai 26 18:22 customdns.php
-rw-r--r-- 1 root root 7,5K Mai 26 18:22 database.php
-rw-r--r-- 1 root root 728 Mai 26 18:22 debug.php
-rw-r--r-- 1 root root 3,8K Mai 26 18:22 footer.php
-rw-r--r-- 1 root root 1,4K Mai 26 18:22 FTL.php
-rw-r--r-- 1 root root 1,5K Mai 26 18:22 func.php
-rw-r--r-- 1 root root 1,8K Mai 26 18:22 gravity.php
-rw-r--r-- 1 root root 1,2K Mai 26 18:22 gravity.sh.php
-rwxr-xr-x 1 root root 32K Mai 26 18:22 groups.php
-rw-r--r-- 1 root root 32K Mai 26 18:22 header.php
-rw-r--r-- 1 root root 3,5K Mai 26 18:22 loginpage.php
-rw-r--r-- 1 root root 3,2K Mai 26 18:22 password.php
-rw-r--r-- 1 root root 1,7K Mai 26 18:22 queryads.php
-rw-r--r-- 1 root root 19K Mai 26 18:22 savesettings.php
-rw-r--r-- 1 root root 1,3K Mai 26 18:22 tailLog.php
-rw-r--r-- 1 root root 15K Mai 26 18:22 teleporter.php
-rw-r--r-- 1 root root 2,5K Mai 26 18:22 update_checker.php

ls -lha /var/www/html/admin/scripts/pi-hole/js/
total 208K
drwxr-xr-x 2 root root 4,0K Mai 26 18:22 .
drwxr-xr-x 4 root root 4,0K Mai 26 18:22 ..
-rw-r--r-- 1 root root 4,6K Mai 26 18:22 auditlog.js
-rw-r--r-- 1 root root 2,8K Mai 26 18:22 customdns.js
-rw-r--r-- 1 root root 11K Mai 26 18:22 db_graph.js
-rw-r--r-- 1 root root 7,2K Mai 26 18:22 db_lists.js
-rw-r--r-- 1 root root 12K Mai 26 18:22 db_queries.js
-rw-r--r-- 1 root root 1,8K Mai 26 18:22 debug.js
-rw-r--r-- 1 root root 5,4K Mai 26 18:22 footer.js
-rw-r--r-- 1 root root 2,0K Mai 26 18:22 gravity.js
-rw-r--r-- 1 root root 11K Mai 26 18:22 groups-adlists.js
-rw-r--r-- 1 root root 12K Mai 26 18:22 groups-clients.js
-rw-r--r-- 1 root root 4,1K Mai 26 18:22 groups-common.js
-rw-r--r-- 1 root root 16K Mai 26 18:22 groups-domains.js
-rw-r--r-- 1 root root 7,7K Mai 26 18:22 groups.js
-rw-r--r-- 1 root root 34K Mai 26 18:22 index.js
-rw-r--r-- 1 root root 2,2K Mai 26 18:22 ip-address-sorting.js
-rw-r--r-- 1 root root 6,2K Mai 26 18:22 network.js
-rw-r--r-- 1 root root 16K Mai 26 18:22 queries.js
-rw-r--r-- 1 root root 3,7K Mai 26 18:22 queryads.js
-rw-r--r-- 1 root root 6,7K Mai 26 18:22 settings.js
-rw-r--r-- 1 root root 1,3K Mai 26 18:22 taillog-FTL.js
-rw-r--r-- 1 root root 1,2K Mai 26 18:22 taillog.js

ls -lha /etc/lighttpd
total 40K
drwxr-xr-x 5 lighttpd lighttpd 4,0K Aug 17 2019 .
drwxr-xr-x 146 root root 16K Mai 27 11:16 ..
drwxr-xr-x 2 lighttpd lighttpd 4,0K Aug 17 2019 conf-available
drwxr-xr-x 2 lighttpd lighttpd 4,0K Jul 18 2019 conf-enabled
-rw-r--r-- 1 lighttpd lighttpd 0 Mai 25 12:43 external.conf
-r-------- 1 lighttpd lighttpd 3,9K Sep 22 2019 lighttpd.conf
drwxr-xr-x 3 lighttpd lighttpd 4,0K Aug 16 2019 .pi-hole

ls -lha /var/run/lighttpd
total 0
drwxr-x--- 2 www-data www-data 60 Mai 27 14:41 .
drwxr-xr-x 32 root root 1,2K Mai 27 13:58 ..
srwxr-xr-x 1 www-data www-data 0 Mai 27 14:41 php.socket-0

Are the file permissions wrong?

Entries in my groups/passwd/gshadow:

/etc/groups

www-data:x:33:pihole
pihole:x:999:www-data
lighttpd:x:1002:

/etc/passwd

www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
pihole:x:999:999::/home/pihole:/usr/sbin/nologin
lighttpd:x:1001:1002::/var/www/html:/sbin/nologin

/etc/gshadow

www-data:*::pihole
pihole:!::www-data
lighttpd:!::

is that set right?
If it is wrong please post correctly

Did a test:

chown www-data:www-data -R /var/www/html

chmod 0775 -R /var/www/html

chmod a+rx /var/www

chmod a+rx /var/www/html

lighty-enable-mod fastcgi fastcgi-php > /dev/null || true

Rebooted, then lighttpd error.log:

2020-05-27 13:57:53: (server.c.1464) server started (lighttpd/1.4.53)
2020-05-27 13:59:45: (mod_fastcgi.c.421) FastCGI-stderr: PHP Warning: SQLite3Stmt::execute(): Unable to execute statement: attempt to write a readonly database in /var/www/html/admin/scripts/pi-hole/php/groups.php on line 265

:-/

also:

chown www-data:www-data -R /etc/lighttpd

chmod 644 -R /etc/lighttpd

lighttpd error.log:

2020-05-27 14:13:23: (mod_fastcgi.c.421) FastCGI-stderr: PHP Warning: SQLite3Stmt::execute(): Unable to execute statement: attempt to write a readonly database in /var/www/html/admin/scripts/pi-hole/php/groups.php on line 265

Debug token please.

@ DanSchaper
https://tricorder.pi-hole.net/ekmz44ufef

Only write to the database isn't Working.

All other is Working of Pi-Hole.