Pi-hole 5.2 Error message: “Attempt to write a readonly database”

So I was also struggling with this error. Pi-hole on Linux Raspberry Pi "Buster" with Apache.

After a lot of searching, I found this: You need to add www-data to the group pihole.

I made this post for some reasons:

  • maybe it helps others
  • I wonder why the installation of pihole did not do this.
  • I wonder if the error-handling could be improved so that people know what could be the case

So in my case, after changing the groupfile and the shadow-groupfile, it looked like this

more /etc/group | grep hole
pihole:x:995:www-data

more /etc/gshadow | grep hole
pihole:!::www-data

Simple reason: apache is not officially supported. Only lighttpd is.

1 Like

Aha, thanks, missed that one.

Well, I assume more people prefer to use Apache (for whatever reason) so this may be helpful any way.
my reason: I am already running Apache and prefer to have only 1 webserver on my machine.

Best!