Settings not saved + readonly database issue

The issue I am facing:
Newly installed pihole server on Arch Linux. I have not had it working properly yet. There are two problems.

  1. When I try to save DNS settings from the web interface it says "The DNS settings have been updated (using 2 DNS servers) " but the GUI reverts back to the old settings. And in my nginx log I get the following:

Oct 26 20:38:30 pihole nginx[21994]: 2020/10/26 20:38:30 [error] 21994#21994: *20 FastCGI sent in stderr: "PHP message: PHP Notice: Trying to access array offset on value of type null in /srv/http/pihole/admin/settings.php on line 17PHP message: PHP Notice: Trying to access array offset on value of type null in /srv/http/pihole/admin/settings.php on line 17" while reading upstream, client: 192.168.4.100, server: pihole, request: "GET /pihole/admin/settings.php HTTP/2.0", upstream: "fastcgi://127.0.0.1:9000", host: "pihole", referrer: "https://pihole/pihole/admin/"

  1. If I try to add something to the blacklist I get the following error in the web GUI:
Error, something went wrong!
While executing: attempt to write a readonly database
Added 0 out of 1 domains

And in my nginx log I get the following:

Oct 26 20:42:23 pihole nginx[21994]: 2020/10/26 20:42:23 [error] 21994#21994: *20 FastCGI sent in stderr: "PHP message: PHP Warning:  SQLite3Stmt::execute(): Unable to execute statement: attempt to write a readonly database in /srv/http/pihole/admin/scripts/pi-hole/php/groups.php on line 535" while reading response header from upstream, client: 192.168.4.100, server: pihole, request: "POST /pihole/admin/scripts/pi-hole/php/groups.php HTTP/2.0", upstream: "fastcgi://127.0.0.1:9000", host: "pihole", referrer: "https://pihole/pihole/admin/groups-domains.php?type=black"

Details about my system:
Arch Linux
nginx version: nginx/1.18.0
PHP 7.4.11 (cli) (built: Sep 29 2020 15:28:07) ( NTS )

/etc:

-rw-r--r-- 1 pihole pihole     596 Oct 21 21:45 dns-servers.conf
-rw-rw-r-- 1 pihole pihole 5193728 Oct 26 00:00 gravity.db
-rw-r--r-- 1 pihole pihole 1137892 Oct 26 00:00 list.0.raw.githubusercontent.com.domains
-rw-r--r-- 1 pihole pihole  594616 Oct 21 21:45 list.1.mirror1.malwaredomains.com.domains
-rw-r--r-- 1 pihole pihole     521 Oct 21 21:45 list.2.s3.amazonaws.com.domains
-rw-r--r-- 1 pihole pihole   43529 Oct 21 21:45 list.3.s3.amazonaws.com.domains
-rw-r--r-- 1 pihole pihole      43 Oct 26 00:00 local.list
-rw-r--r-- 1 root   root       240 Oct 21 21:45 logrotate
drwxr-xr-x 2 pihole pihole    4096 Oct 21 21:45 migration_backup
-rw-r--r-- 1 pihole pihole    2719 Oct 24 20:48 pihole-FTL.conf
-rw-r--r-- 1 pihole pihole   57344 Oct 26 21:00 pihole-FTL.db
-rw-r--r-- 1 pihole pihole     207 Oct 21 21:47 setupVars.conf

nginx runs as user/group http and is member of the pihole group:

groups http

pihole http

php open_basedir is not set.

What permissions am I missing or what could be wrong?

You might have better success with an answer at the Arch wiki

Note: Pi-hole on Arch Linux is not officially supported by the Pi-hole project.

Yes, I followed that. But I found that I missed one important note...Before it was enough to just leave out open_basedir in php config. Now this is the case:

Since version 7.4 php-fpm is hardened by default and revokes read/write access on /usr (and sub-directories).

It was an issue with PHP permissions.

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