"Unable to write to a readonly database" - Pi-Hole 5.x + Manjaro + Apache

Hi, I have been running Pi-Hole + Apache + Manjaro for a time now. It was all fine upto v5.x. After that, I kept getting a message "Unable to write to a readonly database."

I traced it to the user http (the webserver runs as http:http) not being in the group pihole. So I added it in. Yet I kept getting the error. Any help? I tried the forum topics already, no luck.

Directory Permissions on /etc/pihole
❯ ls -lh /etc/pihole                    
total 103M
-rw-r--r-- 1 pihole pihole  242 Jul 16 00:12 adlists.list
-rw-r--r-- 1 pihole pihole  353 Jul 18 15:11 custom.list
-rw-r--r-- 1 pihole pihole  596 Jul 16 00:12 dns-servers.conf
-rw-rw-r-- 1 pihole pihole 5.0M Jul 13 07:47 gravity.db
-rw-r--r-- 1 pihole pihole 1.1M Jun 22 00:00 list.0.raw.githubusercontent.com.domains
-rw-r--r-- 1 pihole pihole 581K May 22 16:28 list.1.mirror1.malwaredomains.com.domains
-rw-r--r-- 1 pihole pihole  521 May 22 16:28 list.2.s3.amazonaws.com.domains
-rw-r--r-- 1 pihole pihole  43K May 22 16:28 list.3.s3.amazonaws.com.domains
-rw-r--r-- 1 pihole pihole   43 Jul 13 07:47 local.list
-rw-r--r-- 1 root   root    240 Jul 16 00:12 logrotate
drwxr-xr-x 1 pihole pihole    0 May 22 16:08 migration_backup
-rw-rw-r-- 1 pihole pihole 2.7K May 22 16:22 pihole-FTL.conf
-rw-r--r-- 1 pihole pihole  25M Jul 18 16:33 pihole-FTL.db
-rw-r--r-- 1 pihole pihole  72M May 22 16:06 pihole-FTL.db.pacsave
-rw-r--r-- 1 pihole pihole   31 Sep  7  2019 regex.list.pacsave
-rw-r--r-- 1 pihole pihole  316 May 22 17:21 setupVars.conf
Group Config
❯ id http
uid=33(http) gid=33(http) groups=33(http),966(pihole)

Did you restart apache/ your system after you added the user to pihole group?

file system permissions
total 304M
drwxrwxr-x  2 pihole pihole 4,0K Jul 18 14:34 .
drwxr-xr-x 94 root   root   4,0K Jul 13 22:32 ..
-rw-r--r--  1 root   root    276 Mai 12 20:02 adlists.list
-rw-r--r--  1 root   root    490 Jul 17 09:34 custom.list
-rw-r--r--  1 root   root    452 Jul  2 16:33 custom.list.bak
-rw-r--r--  1 pihole pihole    0 Jul 17 09:34 dhcp.leases
-rw-r--r--  1 root   root    596 Jul 13 22:32 dns-servers.conf
-rw-r--r--  1 root   root     14 Jul 12 13:53 ftlbranch
-rw-r--r--  1 root   root     16 Jul 17 18:45 GitHubVersions
-rw-rw-r--  1 pihole pihole  37M Jul 17 13:44 gravity.db
-rw-r--r--  1 root   root   4,3M Jan 19 04:30 gravity.list
-rw-r--r--  1 root   root   1,1K Jul 13 22:32 install.log
-rw-r--r--  1 root   root   542K Jul 17 10:59 list.13.raw.githubusercontent.com.domains
-rw-r--r--  1 root   root   1,5M Jul 17 10:59 list.14.gitlab.com.domains
-rw-r--r--  1 root   root   1,1M Jul 17 10:59 list.1.raw.githubusercontent.com.domains
-rw-r--r--  1 root   root    21K Jul 17 10:59 list.24.raw.githubusercontent.com.domains
-rw-r--r--  1 root   root   3,9M Jul 17 09:22 list.26.www.github.developerdan.com.domains
-rw-r--r--  1 root   root   1,1M Jul 17 10:59 list.28.raw.githubusercontent.com.domains
-rw-r--r--  1 root   root    15K Jul 17 09:22 list.40.dehakkelaar.nl.domains
-rw-r--r--  1 root   root   3,3M Jul 17 10:59 list.41.raw.githubusercontent.com.domains
-rw-r--r--  1 root   root   413K Jul 17 10:59 list.43.raw.githubusercontent.com.domains
-rw-r--r--  1 root   root   1,2M Jul 17 10:59 list.45.raw.githubusercontent.com.domains
-rw-r--r--  1 root   root     61 Jul 18 14:30 localbranches
-rw-r--r--  1 root   root     33 Jul 17 10:59 local.list
-rw-r--r--  1 root   root     49 Jul 18 14:30 localversions
-rw-r--r--  1 root   root    234 Jul 13 22:32 logrotate
-rw-r--r--  1 pihole pihole 2,4M Jul 12 13:53 macvendor.db
-rw-rw-r--  1 pihole root    188 Jul 13 22:32 pihole-FTL.conf
-rw-r--r--  1 pihole pihole  54M Jul 18 14:34 pihole-FTL.db
-rw-r--r--  1 pihole pihole 194M Jun  3 22:01 pihole-FTL-new_mac.db
-rw-r--r--  1 root   root    683 Jul 13 22:32 setupVars.conf
-rw-r--r--  1 root   root    669 Jul 13 22:32 setupVars.conf.update.bak

Multiple times. Restarted services, PHP, Apache. Rebooted too. Nothing works.

If it matters, I installed from AUR following the Arch Wiki. If needed, I can post my vhost configuration too.

Yeah.... Actually I already tried that. Didn't work. You can clearly see my group config in my original post.

User http is in group pihole.
User pihole should also been in group http? But why? And I already tried that.

I'm somewhat familiar with the codebase. The error has been traced to not being able to write to /etc/pihole/gravity.db. Even though webserver user http is in group pihole and /etc/pihole/gravity.db has g+w permissions.

Is this an install using the AUR package?

Yes. Installation exactly as per AUR. Only difference is I use Apache.

You'll need to contact the AUR maintainers as they have requested.

https://aur.archlinux.org/packages/pi-hole-server/?O=10&PP=10#pinned-633053

Okay then, I shall do so. Thanks for the help.

I'll try it, thanks.

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