Tatsh / tatsh-overlay

Personal Gentoo Portage overlay.
https://tatsh.github.io/tatsh-overlay/
GNU General Public License v2.0
35 stars 10 forks source link

net-dns/pihole-ftl: pihole-FTL.db stays empty and is not usable on a fresh install #195

Closed dallenwilson closed 1 year ago

dallenwilson commented 1 year ago

On a fresh install of gentoo and pihole/pihole-FTL, I found that the pihole-FTL.db remained empty and unused, the only errors logged were regarding missing database tables. Eventually I found the cause:

The OpenRC init script installed by the ebuild at /etc/init.d/pihole-FTL performs several sanity-checks before launching the pihole-FTL daemon. The last check uses the checkpath command to verify that /var/lib/pihole/pihole-FTL.db has the correct file permissions. This is the source of the problem.

The result of those three items is that launching pihole-FTL on a new install properly via rc-service leads to a situation where pihole-FTL.db is unusable.

I ran rc-service pihole-FTL stop, deleted /var/lib/pihole/pihole-FTL.db, commented out the last sanity check in /etc/init.d/pihole-FTL, and started it again with rc-service pihole-FTL start and the database was created, initialized and used correctly after that.

Tatsh commented 1 year ago

Can you make a PR for a fix? I think the fix would be like:

    { [ -e /var/lib/pihole/gravity.db ] &&
          [ -e /var/lib/pihole/pihole-FTL.db ]; } &&
          checkpath -m 0664 -f \
        /var/lib/pihole/gravity.db \
        /var/lib/pihole/pihole-FTL.db || ewarn "gravity.db or pihole-FTL.db is not properly installed"
Tatsh commented 1 year ago

Better idea, check the size:

    { [ -s /var/lib/pihole/gravity.db ] &&
          [ -s /var/lib/pihole/pihole-FTL.db ]; } &&
          checkpath -m 0664 -f \
        /var/lib/pihole/gravity.db \
        /var/lib/pihole/pihole-FTL.db || ewarn "gravity.db or pihole-FTL.db is not properly installed"