In the meantime, you should be able to work around it by creating a dedicated normal unprivileged user for Pi-hole, giving that user sudo access, and deploying Pi-hole under that user rather than root.
I think that would prevent the sqlite3 config file in /root from being accessible and allow both Pi-hole to operate normally and your other sqlite applications to operate with your config on the same system.
What are the steps to move to Pi-hole not being under Root user ?
Does it require a Reinstall of Pi-hole ? ( in which case I am unlikely to do it ).
Is it the recommended way ?
An easier workaround seems to be just to rename /root/.sqliterc before running pihole -g and then to rename it back after that runs.
That new shortcut -ni that you point out, can it be used with the pihole -g command ? If so - how ?
I think you meant that those people who maintain the code should add -ni to every sqlite3 call that is made in the code that is run by pihole -g. That would certainly stop this problem from happening for anyone else in the future... Is that what you meant ?
That's a good question, since Pi-hole installs files and folders with a mixture of ownerships. Technically you could identify all the files and use a number of carefully crafted chown commands. But since they are all installed as root in your case, how could you tell apart a file which needs a normal user but root group?
Does a pihole -r repair check and fix ownership and permissions? If so, running that as the new user with sudo might do it easily. Can Pi-hole folks confirm if that would have worked here please?
That's much easier but I guess it risks breaking other apps that are using sqlite during that time, and it still may cause problems during normal operation, eg the debug log is an example of how it went wrong.
Anyway no need to change your setup, the fix has been done at light speed (which is appropriate!) so it won't be too long before you can try it.
Wait for Pi-hole v6.0
Pi-hole v6.0 massively improves on permissions. Almost everything is running under the unprivileged user pihole. Exceptions are the debug log which still needs sudo to get certain hardware information about your system only root has. But things are certainly a lot improved here.
As to when it comes: We are already pretty advanced in beta testing, however, we will surely not release "tomorrow" as there is still a lot of written code in the reviewing pipelines.
Run Pi-hole in a docker container
This is (almost) the perfect way of isolating Pi-hole from the rest of your system. You won't have to care about interactions with other system parts, can easily upgrade, etc., etc. Running in docker as an end user that does not want to do development is a very nice thing. If you want to do development, that's possible, too, even when a bare metal installation is slightly easier (as in: more convenient) in this case.
Yes your advice and your explanations are spot on and have allow me to understand and solve the problem. Even if , as noted, it is via a workaround at this time.
Thanks again - and a big shutout and thanks to all the developers involved in v6