Pi-hole - fix "While executing: attempt to write a readonly database" error
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.
All links, in order of mention:
- Pi-hole: https://pi-hole.net
- lighttpd: https://www.lighttpd.net
- proxying it behind nginx: https://docs.pi-hole.net/guides/webserver/nginx/
Recent posts:
- Patch for aarch64 (aka arm64) openssl 1.0.2 'relocation R_AARCH64_PREL64 against symbol OPENSSL_armcap_P error'
- TIL: the `NO_COLOR` informal standard to suppress ANSI colour escape codes
- Copy the contents of a branch into an existing git branch without merging
- Adding search to a static Jekyll site using pagefind
- asdf, python and automatically enabling virtual envs