Most likely, your disk is failing, leading to database corruption. You can
check by using the tool sqlite3, although it is not 100% able to find all
errors.

You may have to install it first

*sudo apt install sqlite3*

Then run it on the database

*sqlite3 /var/lib/weewx/weewx.sdb*
sqlite>* PRAGMA integrity_check;*

If you find some errors, the tool DB Browser for SQLite
<https://sqlitebrowser.org> purports to be able to fix some errors,
although I have never tried it. It may be worth giving it a try.

If you can fix the database, copy it over to a safe place.

Personally, unless you've got good reason to think it's OK, I would throw
the disk away and start all over with a fresh disk. Install the OS;
reinstall weewx. If you were able to recover the database, copy it over.
Otherwise, start afresh.

-tk



On Wed, Jan 1, 2020 at 7:26 AM Ian Bell <[email protected]> wrote:

> I am consistently getting the following error
>
> cheetahgenerator: Generated 8 files for report SeasonsReport in 1.22
> seconds
>
> Jan  1 09:20:21 rasp-weewx weewx[515]: reportengine: Caught unrecoverable
> exception in generator 'weewx.imagegenerator.ImageGenerator'
>
> Jan  1 09:20:21 rasp-weewx weewx[515]:         ****  database disk image
> is malformed
>
> Jan  1 09:20:21 rasp-weewx weewx[515]:         ****  Traceback (most
> recent call last):
>
> Jan  1 09:20:21 rasp-weewx weewx[515]:         ****    File
> "/usr/share/weewx/weewx/reportengine.py", line 204, in run
>
> Jan  1 09:20:21 rasp-weewx weewx[515]:         ****      obj.start()
>
> Jan  1 09:20:21 rasp-weewx weewx[515]:         ****    File
> "/usr/share/weewx/weewx/reportengine.py", line 300, in start
>
> Jan  1 09:20:21 rasp-weewx weewx[515]:         ****      self.run()
>
> Jan  1 09:20:21 rasp-weewx weewx[515]:         ****    File
> "/usr/share/weewx/weewx/imagegenerator.py", line 33, in run
>
> Jan  1 09:20:21 rasp-weewx weewx[515]:         ****
> self.genImages(self.gen_ts)
>
> Jan  1 09:20:21 rasp-weewx weewx[515]:         ****    File
> "/usr/share/weewx/weewx/imagegenerator.py", line 170, in genImages
>
> Jan  1 09:20:21 rasp-weewx weewx[515]:         ****
> aggregate_interval=aggregate_interval)
>
> Jan  1 09:20:21 rasp-weewx weewx[515]:         ****    File
> "/usr/share/weewx/weewx/manager.py", line 513, in getSqlVectors
>
> Jan  1 09:20:21 rasp-weewx weewx[515]:         ****      aggregate_type,
> aggregate_interval)
>
> Jan  1 09:20:21 rasp-weewx weewx[515]:         ****    File
> "/usr/share/weewx/weewx/manager.py", line 761, in _getSqlVectors
>
> Jan  1 09:20:21 rasp-weewx weewx[515]:         ****
> _cursor.execute(sql_str, stamp)
>
> Jan  1 09:20:21 rasp-weewx weewx[515]:         ****    File
> "/usr/share/weewx/weedb/sqlite.py", line 29, in guarded_fn
>
> Jan  1 09:20:21 rasp-weewx weewx[515]:         ****      return fn(*args,
> **kwargs)
>
> Jan  1 09:20:21 rasp-weewx weewx[515]:         ****    File
> "/usr/share/weewx/weedb/sqlite.py", line 211, in execute
>
> Jan  1 09:20:21 rasp-weewx weewx[515]:         ****      return
> sqlite3.Cursor.execute(self, *args, **kwargs)
>
> Jan  1 09:20:21 rasp-weewx weewx[515]:         ****  DatabaseError:
> database disk image is malformed
>
> Jan  1 09:20:21 rasp-weewx weewx[515]:         ****  Generator terminated
>
> Jan  1 09:20:21 rasp-weewx weewx[515]: copygenerator: copied 0 files to
> /var/www/html/weewx
>
> Jan  1 09:20:21 rasp-weewx weewx[515]: cheetahgenerator: Generated 1 files
> for report cmon in 0.03 seconds
>
> Jan  1 09:20:22 rasp-weewx weewx[515]: reportengine: Caught unrecoverable
> exception in generator 'weewx.imagegenerator.ImageGenerator'
>
> Jan  1 09:20:22 rasp-weewx weewx[515]:         ****  database disk image
> is malformed
>
> Jan  1 09:20:22 rasp-weewx weewx[515]:         ****  Traceback (most
> recent call last):
>
> Jan  1 09:20:22 rasp-weewx weewx[515]:         ****    File
> "/usr/share/weewx/weewx/reportengine.py", line 204, in run
>
> Jan  1 09:20:22 rasp-weewx weewx[515]:         ****      obj.start()
>
> Jan  1 09:20:22 rasp-weewx weewx[515]:         ****    File
> "/usr/share/weewx/weewx/reportengine.py", line 300, in start
>
> Jan  1 09:20:22 rasp-weewx weewx[515]:         ****      self.run()
>
> Jan  1 09:20:22 rasp-weewx weewx[515]:         ****    File
> "/usr/share/weewx/weewx/imagegenerator.py", line 33, in run
>
> Jan  1 09:20:22 rasp-weewx weewx[515]:         ****
> self.genImages(self.gen_ts)
>
> Jan  1 09:20:22 rasp-weewx weewx[515]:         ****    File
> "/usr/share/weewx/weewx/imagegenerator.py", line 170, in genImages
>
> Jan  1 09:20:22 rasp-weewx weewx[515]:         ****
> aggregate_interval=aggregate_interval)
>
> Jan  1 09:20:22 rasp-weewx weewx[515]:         ****    File
> "/usr/share/weewx/weewx/manager.py", line 513, in getSqlVectors
>
> Jan  1 09:20:22 rasp-weewx weewx[515]:         ****      aggregate_type,
> aggregate_interval)
>
> Jan  1 09:20:22 rasp-weewx weewx[515]:         ****    File
> "/usr/share/weewx/weewx/manager.py", line 790, in _getSqlVectors
>
> Jan  1 09:20:22 rasp-weewx weewx[515]:         ****      for _rec in
> _cursor.execute(sql_str, (startstamp, stopstamp)):
>
> Jan  1 09:20:22 rasp-weewx weewx[515]:         ****  DatabaseError:
> database disk image is malformed
>
> Jan  1 09:20:22 rasp-weewx weewx[515]:         ****  Generator terminated
>  I had my usb stick on my raspberry Pi fail during an update so I had to
> restore my weewx from my backed up files. I am concerned the DB copy I have
> is corrupt. and I will loose all my previous data. If I have to start with
> a new DB what is the best way to do this short of reinstalling weewx, and
> putting back the backed up files minus the DB.
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/5f507c85-2e6d-4072-9659-bc4fef6ca52b%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/5f507c85-2e6d-4072-9659-bc4fef6ca52b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zEBXRn-%3D_Gn%3Dp5%3D8iDgT5dT_kk5chBiVHVLHA3CRzm04EQ%40mail.gmail.com.

Reply via email to