Disk full error during gravity rebuild

The issue I am facing:
Updating to V. 5.0 caused gravity.db building error - and finally no blocking behaviour at all.
Error message upon 'pihole -g':

"Unable to build build build gravity tree in /etc/pihole/gravity_temp.db
  Error: database or disk is full"

Details about my system:
Raspi 4, 4GB; Kernel 4.19.97-v7l+;
Pi-hole Version** v5.0 Web Interface Version v5.0 FTL Version** v5.0

What I have changed since installing Pi-hole:
Switching from 4.x to V. 5

** Results of 1st own investigations:
Looks like the change in gravity.sh in function gravity_swap_databases() introduced via PR #3100 is causing the problem. By disabling lines 95 up to 101, the gravity DB could be created and blocking seems to work again.

Please post the entire output of that gravity update run, if you still have it.

Also, please post the token generated by

pihole -d

or do it through the Web interface:

Tools > Generate Debug Log

the token: https://tricorder.pi-hole.net/qnpdm5ksk3

Were these the local code changes you were making to troubleshoot?

*** [ DIAGNOSING ]: Core version
[i] Core: v5.0 (https://discourse.pi-hole.net/t/how-do-i-update-pi-hole/249)
[i] Branch: master
[i] Commit: v5.0-0-g4d25f69-dirty
[i] Status:  M gravity.sh
[i] Diff: diff --git a/gravity.sh b/gravity.sh
          index a28aea2..efbfb34 100755
          --- a/gravity.sh
          +++ b/gravity.sh
          @@ -96,7 +96,7 @@ gravity_swap_databases() {
             status="$?"
           
             if [[ "${status}" -ne 0 ]]; then
          -    echo -e "\n  ${CROSS} Unable to build gravity tree in ${gravityTEMPfile}\n  ${output}"
          +    echo -e "\n  ${CROSS} Unable to build build gravity tree in ${gravityTEMPfile}\n  ${output}"
               return 1
             fi
             echo -e "${OVER}  ${TICK} ${str}"

What is the output from df -h?

yes and no; the diff you have was just to narrow down the place, where the error is thrown; the actual temporary change I did was in /opt/pihole/gravity.sh (code lines starting w/ #):

  # The index is intentionally not UNIQUE as prro quality adlists may contain domains more than once
#  output=$( { sqlite3 "${gravityTEMPfile}" "CREATE INDEX idx_gravity ON gravity (domain, adlist_id);"; } 2>&1 )
#  status="$?"

#  if [[ "${status}" -ne 0 ]]; then
#    echo -e "\\n  ${CROSS} Unable to build build build gravity tree in ${gravityTEMPfile}\\n  ${output}"
#    return 1
#  fi
  echo -e "${OVER}  ${TICK} ${str}"

Further analysis shwoed, that my former (i.e. V. 4.x) adlist was shortened by the update process; Trying to add some of the dropped URLs is causing a UNIQUE CONTRAINT error, which points in the direction of some trouble when trying to deal w/ indexing, or?

You can't add duplicate adlists (or domains either, if I recall) to the database in V5. In the previous version V4, you could have duplicates in file /etc/pihole/adlists.list

  [2020-05-14 17:58:47.005 10757] domain_in_list("20.177.168.192.in-addr.arpa", 0x1187208, whitelist): Database is busy, assuming domain is NOT on list
   [2020-05-14 17:58:47.006 10757] domain_in_list("20.177.168.192.in-addr.arpa", 0x1191168, blacklist): Database is busy, assuming domain is NOT on list
   [2020-05-14 17:58:47.006 10757] domain_in_list("20.177.168.192.in-addr.arpa", 0x118e288, gravity): Database is busy, assuming domain is NOT on list

This from your debug log. What were you trying to do here?

that was the moment the system has fooled my;

df -h showed nothing spectacular, like ...
*Dateisystem    Größe Benutzt Verf. Verw% Eingehängt auf*
*/dev/root        59G    2,2G   54G    4% /*
*devtmpfs        1,8G       0  1,8G    0% /dev*
*tmpfs           2,0G    136K  2,0G    1% /dev/shm*
*tmpfs           2,0G    8,5M  1,9G    1% /run*
*tmpfs           5,0M    4,0K  5,0M    1% /run/lock*
*tmpfs           2,0G       0  2,0G    0% /sys/fs/cgroup*
*tmpfs            50M    836K   50M    2% /var/log*
*tmpfs           2,0M    8,0K  2,0M    1% /var/www/html/smarthome*
*tmpfs            10M    252K  9,8M    3% /var/smarthome*
*tmpfs           2,0G       0  2,0G    0% /tmp*
*tmpfs           1,0M       0  1,0M    0% /var/tmp*
*tmpfs            20M    136K   20M    1% /var/log/pihole*
*tmpfs           5,0M    4,0K  5,0M    1% /var/log/apache2*
*/dev/mmcblk0p1  253M     54M  199M   22% /boot*
*tmpfs           391M       0  391M    0% /run/user/999*
*tmpfs           391M       0  391M    0% /run/user/1000*

As I said, nothing, I'd worry about ...

*tmpfs 1,0M 0 1,0M 0% /var/tmp*

1 Like

If I remember right, in that moment it turned out, that some of my adlist URLs do not longer exist. Basically all those coming from "https://hosts-file.net".

Hi Matze,
danke für den Tipp. Hat den Durchbruch gebracht.
VG jake

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.