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.

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!

Hey.
I recall that I had this very issue at the first run after installation.
Once I restarted the service once it disappeared.

This is a 6 years old topic, related to a completely different version.

The information above is completely outdated and cannot help you.

Even if you are seeing a similar error message, the cause would be different, since the posts above are related to apache2 and lighttpd web servers, but the current Pi-hole version uses a completely different web server, with different user and permissions.

If you are seeing similar messages, please open a new topic in the Help category.