Database Disk Image Is malformed

88 views
Skip to first unread message

philip....@gmail.com

unread,
Apr 17, 2021, 6:10:14 AM4/17/21
to weewx-user
Hi Guys
I have two RaspPi's  running weewx seperatly with there own console from the same the weather station. 
At 8.40 on one and 08.50 on the other they both failed with the same thing Database Disk Image is malformed. Both have been running for a long time without problems.
They are both at V4.4
Apr 17 10:46:10 raspberrypi systemd[1]: systemd-hostnamed.service: Succeeded.
Apr 17 10:50:20 raspberrypi weewx-weewx[653] INFO weewx.manager: Added record 2021-04-17 10:50:00 BST (1618653000) to database 'weewx.sdb'
Apr 17 10:50:20 raspberrypi weewx-weewx[653] INFO weewx.manager: Added record 2021-04-17 10:50:00 BST (1618653000) to daily summary in 'weewx.sdb'
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: Generate failed with exception '<class 'sqlite3.DatabaseError'>'
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: **** Ignoring template /home/main/skins/Standard/index.html.tmpl
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: **** Reason: database disk image is malformed
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****  Traceback (most recent call last):
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 324, in generate
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****      unicode_string = compiled_template.respond()
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****    File "_home_main_skins_Standard_index_html_tmpl.py", line 1152, in respond
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****    File "/home/weewx/bin/weewx/tags.py", line 415, in __getattr__
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****      vh = self._do_query()
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****    File "/home/weewx/bin/weewx/tags.py", line 397, in _do_query
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****      db_manager = self.db_lookup(self.data_binding)
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****    File "/home/weewx/bin/weewx/manager.py", line 547, in db_lookup
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****      return self.get_manager(data_binding)
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****    File "/home/weewx/bin/weewx/manager.py", line 534, in get_manager
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****      self.manager_cache[data_binding] = open_manager(manager_dict, initialize)
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****    File "/home/weewx/bin/weewx/manager.py", line 687, in open_manager
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****      manager_dict['table_name'])
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****    File "/home/weewx/bin/weewx/manager.py", line 132, in open
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****      dbmanager = cls(connection, table_name)
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****    File "/home/weewx/bin/weewx/manager.py", line 821, in __init__
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****      super(DaySummaryManager, self).__init__(connection, table_name, schema)
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****    File "/home/weewx/bin/weewx/manager.py", line 83, in __init__
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****      self.sqlkeys = self.connection.columnsOf(self.table_name)
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****    File "/home/weewx/bin/weedb/sqlite.py", line 170, in columnsOf
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****      column_list = [row[1] for row in self.genSchemaOf(table)]
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****    File "/home/weewx/bin/weedb/sqlite.py", line 170, in <listcomp>
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****      column_list = [row[1] for row in self.genSchemaOf(table)]
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****    File "/home/weewx/bin/weedb/sqlite.py", line 159, in genSchemaOf
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****      for row in self.connection.execute("""PRAGMA table_info(%s);""" % table):
Apr 17 10:50:22 raspberrypi weewx-weewx[653] ERROR weewx.cheetahgenerator: ****  sqlite3.DatabaseError: database disk image is malformed
Apr 17 10:50:23 raspberrypi weewx-weewx[653] INFO weewx.cheetahgenerator: Generated 6 files for report StandardReport in 3.14 seconds
Apr 17 10:50:23 raspberrypi weewx-weewx[653] INFO weewx.imagegenerator: Generated 1 images for report StandardReport in 0.09 seconds
Apr 17 10:50:23 raspberrypi weewx-weewx[653] INFO weewx.reportengine: Copied 13 files to /home/weewx/public_html
Apr 17 10:50:28 raspberrypi weewx-weewx[653] INFO weewx.cheetahgenerator: Generated 3 files for report forecast in 4.70 seconds
Apr 17 10:50:28 raspberrypi weewx-weewx[653] INFO weewx.reportengine: Copied 116 files to /home/weewx/public_html/forecast
Apr 17 10:50:28 raspberrypi weewx-weewx[653] INFO weewx.reportengine: Copied 7 files to /home/weewx/public_html/ss
Apr 17 10:50:28 raspberrypi weewx-weewx[653] INFO weewx.cheetahgenerator: Generated 1 files for report SteelSeries in 0.08 seconds
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine: Caught unrecoverable exception in generator 'weewx.imagegenerator.ImageGenerator'
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****  database disk image is malformed
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****  Traceback (most recent call last):
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weewx/reportengine.py", line 196, in run
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****      obj.start()
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weewx/reportengine.py", line 281, in start
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****      self.run()
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weewx/imagegenerator.py", line 41, in run
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****      self.genImages(self.gen_ts)
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weewx/imagegenerator.py", line 175, in genImages
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****      db_manager = self.db_binder.get_manager(binding)
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weewx/manager.py", line 534, in get_manager
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****      self.manager_cache[data_binding] = open_manager(manager_dict, initialize)
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weewx/manager.py", line 687, in open_manager
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****      manager_dict['table_name'])
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weewx/manager.py", line 132, in open
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****      dbmanager = cls(connection, table_name)
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weewx/manager.py", line 821, in __init__
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****      super(DaySummaryManager, self).__init__(connection, table_name, schema)
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weewx/manager.py", line 83, in __init__
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****      self.sqlkeys = self.connection.columnsOf(self.table_name)
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weedb/sqlite.py", line 170, in columnsOf
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****      column_list = [row[1] for row in self.genSchemaOf(table)]
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weedb/sqlite.py", line 170, in <listcomp>
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****      column_list = [row[1] for row in self.genSchemaOf(table)]
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weedb/sqlite.py", line 159, in genSchemaOf
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****      for row in self.connection.execute("""PRAGMA table_info(%s);""" % table):
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****  sqlite3.DatabaseError: database disk image is malformed
Apr 17 10:50:28 raspberrypi weewx-weewx[653] ERROR weewx.reportengine:         ****  Generator terminated
Anybody have any ideas as to why they both failed with the same problem
Thanks
Phil

Tom Keffer

unread,
Apr 17, 2021, 8:22:48 AM4/17/21
to weewx-user
I'd say your database disk image is malformed. 

You can try to recover it by using the sqlite3 dot-command ".recover".

cd /home/weewx/archive
echo ".recover" | sqlite3 weewx.sdb > weewx.dump
sqlite3 weewx.new.sdb < weewx.dump

But, really, this is a long shot. Better to replace it with your backup.

-tk


--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/93d5fee3-2ed0-4c91-80e1-a7fd9317dfe7n%40googlegroups.com.

Graham Eddy

unread,
Apr 17, 2021, 8:59:01 AM4/17/21
to weewx...@googlegroups.com
two RPi’s report db failure 10 mins apart. i assume they are SD-based. SD cards are notoriously susceptible to power spikes → must have USB/power conditioning. or you’ve been incredibly unlucky and near-simultaneous failure is coincidence

vince

unread,
Apr 17, 2021, 12:43:59 PM4/17/21
to weewx-user
Wild guess here, but do you have your database(s) remotely mounted on a NAS or some kind of fileserver ?

philip....@gmail.com

unread,
Apr 18, 2021, 6:30:02 AM4/18/21
to weewx-user
Thanks Everybody
It was a database that gets stored on a NAS that had become corrupted luckily I do daily backups.

Reply all
Reply to author
Forward
0 new messages