Wow, it’s been a while! Here’s another post just for me, because I can never remember how I fixed this…

I’ve got a Pi-hole running on our home network, but rather than using the built-in lighttpd server, I’m proxying it behind nginx.

Sometimes after a sudo pihole -up I’m stopped from being able to allow or block domains, and get an angry red error dialog showing While executing: attempt to write a readonly database Added 0 out of 1 domains.

You need to allow the user or group that nginx is running as, to have write permissions on all the .db files under /etc/pihole. In my case, that’s the www-data group, so I do:

sudo chown -R pihole:www-data /etc/pihole
sudo chmod g+w /etc/pihole/*.db

and that fixes it.