while I tried to change status of whitelist entry I got this error.
my config;
ubuntu 18.04 5.3.0-1021-raspi2 (raspberry 4)
apache 2.4.29
php 7.4.6
ownership of /etc/.pihole = root
ownership of /etc/pihole = pihole
ownership of /var/www/html/admin = www-data
I also add user www-data to pihole group
permission of pihole-FTL.db = 0644
ownership of pihole-FTL.db = pihole all
Recently that happened to me with the v4.3.1. (haven't migrated to V5) Did all the things you tried and then simply copied the urls within adlists.list, deleted it, and recreated the file. You might need to do the same with your whitelist file.
usually happens with a file gets corrupted on the Rpi.
Thats bc things have moved on since version 4.
The version 5 release stores lots of content, like the lists, in database files now.
If you have a fresh clean V5 install, not an upgrade like mine, maybe you can update this thread with how ownership and privies should look like now ?
EDIT: Thinking, if you (or anyone) have an unaltered fresh install, output for below might be helpful for others:
stat -c "sudo chown %U:%G %n" /etc/pihole/* | column -t
stat -c "sudo chmod %a %n" /etc/pihole/* | column -t
If any deviates from the output, folks can just copy paste.