Error connecting to database, cannot repair

Same error. I tried pihole -r, still not working:

1 Like

ran debug but got error uploading?

"Gravity database not available" appears many times in tail of pihole-FTL.log

I ran pihole -r:

 [i] Existing PHP installation detected : PHP version 7.3.11-1~deb10u1                                                                              
  [i] Repair option selected                                                                                                                         
  [✓] Disk space check
  [✓] Update local cache of available packages
                                                                                                                                                     
  [✓] Checking apt-get for upgraded packages... up to date!
                                                                                                                                                     
  [i] Installer Dependency checks...                                                                                                                 
  [✓] Checking for dhcpcd5
  [✓] Checking for git
  [✓] Checking for iproute2
  [✓] Checking for whiptail
                                                                                                                                                     
  [i] SELinux not detected
  [i] Performing reconfiguration, skipping download of local repos                                                                                   
  [✓] Resetting repository within /etc/.pihole...
  [✓] Resetting repository within /var/www/html/admin...
  [i] Main Dependency checks...                                                                                                                      
  [✓] Checking for cron
  [✓] Checking for curl
  [✓] Checking for dnsutils
  [✓] Checking for iputils-ping
  [✓] Checking for lsof
  [✓] Checking for netcat
  [✓] Checking for psmisc
  [✓] Checking for sudo
  [✓] Checking for unzip
  [✓] Checking for wget
  [✓] Checking for idn2
  [✓] Checking for sqlite3
  [✓] Checking for libcap2-bin
  [✓] Checking for dns-root-data
  [✓] Checking for resolvconf
  [✓] Checking for libcap2
  [✓] Checking for lighttpd
  [✓] Checking for php7.3-common
  [✓] Checking for php7.3-cgi
  [✓] Checking for php7.3-sqlite3
  [✓] Checking for php7.3-xml
  [✓] Checking for php7.3-intl
                                                                                                                                                     
  [✓] Enabling lighttpd service to start on reboot...
  [✓] Checking for user 'pihole'
                                                                                                                                                     
  [i] FTL Checks...                                                                                                                                  
                                                                                                                                                     
  [✓] Detected 32bit (i686) architecture
  [i] Checking for existing FTL binary...                                                                                                            
  [i] Checksum of installed binary matches remote. No need to download!                                                                              
/etc/.pihole/automated install/basic-install.sh: line 1937: usermod: command not found                                                               
  [i] Testing if systemd-resolved is enabled                                                                                                         
  [i] Systemd-resolved is not enabled
  [✓] Restarting lighttpd service...
  [✓] Enabling lighttpd service to start on reboot...
  [i] Restarting services...                                                                                                                         
  [✓] Enabling pihole-FTL service to start on reboot...
  [✓] Restarting pihole-FTL service...
  [✓] Deleting existing list cache
  [i] Pi-hole blocking is enabled                                                                                                                    
  [i] Neutrino emissions detected...                                                                                                                 
  [✓] Pulling blocklist source list into range
                                                                                                                                                     
  [i] Target: raw.githubusercontent.com (hosts)                                                                                                      
  [✓] Status: Retrieval successful
                                                                                                                                                     
  [i] Target: mirror1.malwaredomains.com (justdomains)                                                                                               
  [✓] Status: Retrieval successful
                                                                                                                                                     
  [i] Target: sysctl.org (hosts)                                                                                                                     
  [✓] Status: Retrieval successful
                                                                                                                                                     
  [i] Target: s3.amazonaws.com (simple_tracking.txt)                                                                                                 
  [✓] Status: Retrieval successful
                                                                                                                                                     
  [i] Target: s3.amazonaws.com (simple_ad.txt)                                                                                                       
  [✓] Status: Retrieval successful
                                                                                                                                                     
  [i] Target: hosts-file.net (ad_servers.txt)                                                                                                        
  [✓] Status: Retrieval successful
                                                                                                                                                     
  [✓] Consolidating blocklists
  [✓] Extracting domains from blocklists
  [i] Number of domains being pulled in by gravity: 147096                                                                                           
  [✓] Removing duplicate domains
  [i] Number of unique domains trapped in the Event Horizon: 124205                                                                                  
  [i] Nothing to whitelist!                                                                                                                          
  [i] Number of regex filters: 0                                                                                                                     
  [✓] Parsing domains into hosts format
  [✓] Cleaning up stray matter
                                                                                                                                                     
  [✓] Force-reloading DNS service
  [✓] DNS service is running
  [✓] Pi-hole blocking is Enabled
                                                                                                                                                     
  [i] The install log is located at: /etc/pihole/install.log                                                                                         
Update Complete! 
                                                                                                                                                     
  Current Pi-hole version is v4.3.2-384-gbf01f72                                                                                                     
  Current AdminLTE version is v4.3.2-357-g3cac308                                                                                                    
  Current FTL version is vDev-ecbeb95

Problem resolved?

No sir, looking at the debug, this appear over and over:

 -----tail of pihole-FTL.log------                                                                                                                 
   [2020-01-19 20:30:45.661 4423] domain_in_list(odc-dm2304-meta.onedrive.akadns.net.l-0003.dc-msedge.net.l-0003.l-msedge.net): Gravity database not 
available                                                                                                                                            
   [2020-01-19 20:30:45.661 4423] domain_in_list(odc-dm2304-meta.onedrive.akadns.net.l-0003.dc-msedge.net.l-0003.l-msedge.net): Gravity database not 
available                                                                                                                                            
   [2020-01-19 20:30:45.661 4423] domain_in_list(odc-dm2304-meta.onedrive.akadns.net.l-0003.dc-msedge.net.l-0003.l-msedge.net): Gravity database not 
available                                                                                                                                            
   [2020-01-19 20:30:45.661 4423] domain_in_list(l-0003.l-msedge.net): Gravity database not available                                                
   [2020-01-19 20:30:45.661 4423] domain_in_list(l-0003.l-msedge.net): Gravity database not available                                                
   [2020-01-19 20:30:45.661 4423] domain_in_list(l-0003.l-msedge.net): Gravity database not available                                                
   [2020-01-19 20:30:50.774 4423] domain_in_list(tile-service.weather.microsoft.com): Gravity database not available                                 
   [2020-01-19 20:30:50.774 4423] domain_in_list(tile-service.weather.microsoft.com): Gravity database not available                                 
   [2020-01-19 20:30:50.774 4423] domain_in_list(tile-service.weather.microsoft.com): Gravity database not available                                 
   [2020-01-19 20:30:50.780 4423] domain_in_list(wildcard.weather.microsoft.com.edgekey.net): Gravity database not available                         
   [2020-01-19 20:30:50.780 4423] domain_in_list(wildcard.weather.microsoft.com.edgekey.net): Gravity database not available                         
   [2020-01-19 20:30:50.780 4423] domain_in_list(wildcard.weather.microsoft.com.edgekey.net): Gravity database not available                         
   [2020-01-19 20:30:50.780 4423] domain_in_list(e15275.g.akamaiedge.net): Gravity database not available                                            
   [2020-01-19 20:30:50.780 4423] domain_in_list(e15275.g.akamaiedge.net): Gravity database not available                                            
   [2020-01-19 20:30:50.780 4423] domain_in_list(e15275.g.akamaiedge.net): Gravity database not available                                            
   [2020-01-19 20:31:02.094 4423] domain_in_list(livetileedge.dsx.mp.microsoft.com): Gravity database not available                                  
   [2020-01-19 20:31:02.094 4423] domain_in_list(livetileedge.dsx.mp.microsoft.com): Gravity database not available                                  
   [2020-01-19 20:31:02.094 4423] domain_in_list(livetileedge.dsx.mp.microsoft.com): Gravity database not available                                  
   [2020-01-19 20:31:02.101 4423] domain_in_list(livetileedge.xbetservices.akadns.net): Gravity database not available                               
   [2020-01-19 20:31:02.101 4423] domain_in_list(livetileedge.xbetservices.akadns.net): Gravity database not available                               
   [2020-01-19 20:31:02.101 4423] domain_in_list(livetileedge.xbetservices.akadns.net): Gravity database not available                               
   [2020-01-19 20:31:02.101 4423] domain_in_list(livetileedge.dsx.mp.microsoft.com.edgekey.net): Gravity database not available                      
   [2020-01-19 20:31:02.101 4423] domain_in_list(livetileedge.dsx.mp.microsoft.com.edgekey.net): Gravity database not available                      
   [2020-01-19 20:31:02.101 4423] domain_in_list(livetileedge.dsx.mp.microsoft.com.edgekey.net): Gravity database not available                      
   [2020-01-19 20:31:02.101 4423] domain_in_list(e16646.dspg.akamaiedge.net): Gravity database not available                                         
   [2020-01-19 20:31:02.101 4423] domain_in_list(e16646.dspg.akamaiedge.net): Gravity database not available                                         
   [2020-01-19 20:31:02.101 4423] domain_in_list(e16646.dspg.akamaiedge.net): Gravity database not available                                         
   [2020-01-19 20:31:04.533 4423] domain_in_list(ad.doubleclick.net.58551.9318.302br.net): Gravity database not available                            
   [2020-01-19 20:31:04.533 4423] domain_in_list(ad.doubleclick.net.58551.9318.302br.net): Gravity database not available                            
   [2020-01-19 20:31:04.533 4423] domain_in_list(ad.doubleclick.net.58551.9318.302br.net): Gravity database not available                            
   [2020-01-19 20:31:04.557 4423] get_client_groupids(): Gravity database not available                                                              
   [2020-01-19 20:31:04.557 4423] get_client_groupids(): Gravity database not available                                                              
   [2020-01-19 20:31:04.557 4423] domain_in_list(ad.doubleclick.net.58551.9318.302br.net): Gravity database not available                            
   [2020-01-19 20:31:04.557 4423] domain_in_list(ad.doubleclick.net.58551.9318.302br.net): Gravity database not available                            
   [2020-01-19 20:31:04.557 4423] domain_in_list(ad.doubleclick.net.58551.9318.302br.net): Gravity database not available
root@tthr-nmsrv83:/etc/.pihole# ls -lh /etc/pihole                                                                                                   
total 82M                                                                                                                                            
-rw-r--r-- 1 root   root      313 Jan 19 20:23 adlists.list                                                                                          
-rw-r--r-- 1 root   root      662 Dec 23 22:52 adlists.list.old                                                                                      
-rw-r--r-- 1 pihole pihole    995 Jan 19 21:13 dhcp.leases                                                                                           
-rw-r--r-- 1 root   root      596 Dec  9 21:00 dns-servers.conf                                                                                      
-rw-r--r-- 1 root   root       13 Jan 19 19:47 ftlbranch                                                                                             
-rw-r--r-- 1 root   root       20 Jan 19 21:05 GitHubVersions                                                                                        
-rw-r--r-- 1 root   root     2.8M Jan 19 21:05 gravity.list                                                                                          
-rw-r--r-- 1 root   root        0 Jan 19 21:05 install.log                                                                                           
-rw------- 1 root   root     1.6M Jan 19 21:05 list.0.raw.githubusercontent.com.domains                                                              
-rw------- 1 root   root     581K Jan 19 21:05 list.1.mirror1.malwaredomains.com.domains                                                             
-rw------- 1 root   root     624K Jan 19 21:05 list.2.sysctl.org.domains                                                                             
-rw------- 1 root   root      613 Jan 19 21:05 list.3.s3.amazonaws.com.domains                                                                       
-rw------- 1 root   root      43K Jan 19 21:05 list.4.s3.amazonaws.com.domains                                                                       
-rw------- 1 root   root     1.7M Jan 19 21:05 list.5.hosts-file.net.domains                                                                         
-rw-r--r-- 1 root   root     2.8M Jan 19 21:05 list.preEventHorizon                                                                                  
-rw-r--r-- 1 root   root       38 Jan 19 21:10 localbranches                                                                                         
-rw-r--r-- 1 root   root       47 Jan 19 21:05 local.list                                                                                            
-rw-r--r-- 1 root   root       52 Jan 19 21:10 localversions                                                                                         
-rw-r--r-- 1 root   root      234 Dec  9 21:00 logrotate                                                                                             
-rw-r--r-- 1 pihole pihole   2.3M Jan 19 19:48 macvendor.db                                                                                          
-rw-rw-r-- 1 pihole root       33 Jan 12 13:25 pihole-FTL.conf                                                                                       
-rw------- 1 root   root       15 Jan 10 21:57 pihole-FTL.conf.save                                                                                  
-rw-rw-r-- 1 pihole root       15 Jan 10 21:57 pihole-FTL.conf.save.1                                                                                
-rw-r--r-- 1 pihole pihole    69M Jan 19 21:13 pihole-FTL.db                                                                                         
-rw-rw-r-- 1 pihole www-data    0 Dec  9 21:06 regex.list                                                                                            
-rw-r--r-- 1 root   root      790 Dec 30 22:26 setupVars.conf                                                                                        
-rw-r--r-- 1 root   root      300 Dec  9 20:55 setupVars.conf.update.bak

Is it me, or is gravity.db "missing"?:

root@tthr-nmsrv83:/etc/pihole# ls                                                                                                                    
adlists.list      gravity.list                               list.4.s3.amazonaws.com.domains  logrotate               regex.list                     
adlists.list.old  install.log                                list.5.hosts-file.net.domains    macvendor.db            setupVars.conf                 
dhcp.leases       list.0.raw.githubusercontent.com.domains   list.preEventHorizon             pihole-FTL.conf         setupVars.conf.update.bak      
dns-servers.conf  list.1.mirror1.malwaredomains.com.domains  localbranches                    pihole-FTL.conf.save                                   
ftlbranch         list.2.sysctl.org.domains                  local.list                       pihole-FTL.conf.save.1                                 
GitHubVersions    list.3.s3.amazonaws.com.domains            localversions                    pihole-FTL.db

For what it's worth:

I don't see this line when running pihole -r:

"Adding adlist with id X to database table"

Shouldn't that appear after, "[✓] Status: Retrieval successful"?

What operating system?

*** [ INITIALIZING ]
[i] 2020-01-19:23:02:22 debug log has been initialized.

*** [ INITIALIZING ] Sourcing setup variables
[i] Sourcing /etc/pihole/setupVars.conf...

*** [ DIAGNOSING ]: Core version
[i] Core: v4.3.2 (How do I update Pi-hole?)
[i] Branch: release/v5.0 (The pihole Command With Examples)
[i] Commit: v4.3.2-384-gbf01f72

*** [ DIAGNOSING ]: Web version
[i] Web: v4.3.2 (How do I update Pi-hole?)
[i] Branch: release/v5.0 (The pihole Command With Examples)
[i] Commit: v4.3.2-357-g3cac308

*** [ DIAGNOSING ]: FTL version
[✓] FTL: vDev-ecbeb95 (How do I update Pi-hole?)

*** [ DIAGNOSING ]: lighttpd version
[i] 1.4.53

*** [ DIAGNOSING ]: php version
[i] 7.3.11

*** [ DIAGNOSING ]: Operating system
[✓] Debian GNU/Linux 10 (buster)

*** [ DIAGNOSING ]: SELinux
[i] SELinux not detected

*** [ DIAGNOSING ]: Processor
[i] i686

Debug token mozufgbrm4

Looks like you are missing a default system utility called usermod. We need that to allow the pihole user access to the webserver and the database. That would explain why you have no database, it can't be created.

What is the output from groups pihole? And what user are you running pihole-FTL as?

groups pihole = pihole ; pihole www-data

FTL running under pihole

Resolved.

I googled the error and found this : command usermod not found

Reran “core checkout” and all is well.

FYI I’m running Debian headless and interact with pihole via shellinabox