According to the weewx documentation, the sqlite databse ( a single file) is located in "SQLITE_ROOT" - see https://weewx.com/docs/5.2/usersguide/where/ In your case, the database file should probably be */var/lib/weewx/weewx.sdb*
Stop weewx, replace the database file with the one of your backup , and restart weewx - assuming that you have a backup with a valid database file.. Le jeudi 1 janvier 2026 à 18:34:54 UTC+1, Tomasz Lewicki a écrit : > Thanks for the advice, but I don't know what to restore. Every night, I > make a copy to a remote server. So downloading the database from the remote > server won't help. Anyway, I don't know when the error occurred and why > this particular day is “broken” in the year-end summary. > > Does anyone have a more constructive suggestion? > > czwartek, 1 stycznia 2026 o 17:29:32 UTC+1 [email protected] napisał(a): > >> Restore the most recent working backup. >> >> Tomasz Lewicki schrieb am Donnerstag, 1. Januar 2026 um 16:56:42 UTC+1: >> >>> I have the following problem. Today, at around 1:30 p.m. local time, >>> Weewx stopped working - the data sent by rsync to the website are not >>> refreshing. After restarting Weewx, I see: >>> >>> pi@pihole-dom:~ $ sudo systemctl status weewx.service >>> × weewx.service - WeeWX >>> Loaded: loaded (/lib/systemd/system/weewx.service; enabled; preset: >>> enabled) >>> Active: failed (Result: signal) since Thu 2026-01-01 16:14:29 CET; >>> 32min ago >>> Duration: 7min 15.568s >>> Docs: https://weewx.com/docs >>> Process: 6937 ExecStart=weewxd /etc/weewx/weewx.conf (code=killed, >>> signal=KILL) >>> Main PID: 6937 (code=killed, signal=KILL) >>> CPU: 2min 29.856s >>> >>> I checked the log, where I only save messages from the ERROR level. The >>> log is about 150 MB in size, which in itself is not normal. Inside, there >>> are lots of messages: >>> >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> Evaluation of template /etc/weewx/skins/neowx-material/year.html.tmpl >>> failed with exception '<class> >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** Ignoring template /etc/weewx/skins/neowx-material/year.html.tmpl >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** Reason: database disk image is malformed >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** Traceback (most recent call last): >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** File "/usr/share/weewx/weewx/cheetahgenerator.py", line 334, in >>> generate >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** unicode_string = compiled_template.respond() >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** ^^^^^^^^^^^^^^^^^^^^^^^^^^^ >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** File "_etc_weewx_skins_neowx_material_year_html_tmpl.py", line >>> 1130, in respond >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** File "/usr/share/weewx/weewx/tags.py", line 508, in __getattr__ >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** vh = self._do_query() >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** ^^^^^^^^^^^^^^^^ >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** File "/usr/share/weewx/weewx/tags.py", line 494, in _do_query >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** result = weewx.xtypes.get_aggregate(self.obs_type, self.timespan, >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** File "/usr/share/weewx/weewx/xtypes.py", line 136, in get_aggregate >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** return xtype.get_aggregate(obs_type, timespan, aggregate_type, >>> db_manager, >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** >>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** File "/usr/share/weewx/weewx/xtypes.py", line 372, in get_aggregate >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** row = db_manager.getSql(select_stmt) >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** File "/usr/share/weewx/weewx/manager.py", line 597, in getSql >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** _cursor.execute(sql, sqlargs) >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** File "/usr/share/weewx/weedb/sqlite.py", line 38, in guarded_fn >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** return fn(*args, **kwargs) >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** ^^^^^^^^^^^^^^^^^^^ >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** File "/usr/share/weewx/weedb/sqlite.py", line 233, in execute >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** return sqlite3.Cursor.execute(self, *args, **kwargs) >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >>> gru 31 14:50:59 pihole-dom weewxd[968]: ERROR weewx.cheetahgenerator: >>> **** sqlite3.DatabaseError: database disk image is malformed >>> >>> This one worried me: >>> >>> sqlite3.DatabaseError: database disk image is malformed >>> >>> I looked at the summary for the year and saw a single, very high peak on >>> the pressure graph with an absurd value of approx. 2e+184 for August 15. >>> All other parameters (temperature, etc.) look normal. The summary for the >>> month also looks normal. I looked at the database, but neither on that day >>> nor on any other day did the pressure values exceed the norm. So I decided >>> to rebuild the summaries. Since Weewx and the database are on Raspberry Pi, >>> I moved the weewx.sdb file to my laptop and, using the instructions from >>> https://www.weewx.com/docs/5.1/utilities/weectl-database/, I first did >>> the following: >>> >>> stalker@e6540:~$ weectl database drop-daily >>> Using configuration file /etc/weewx/weewx.conf >>> Proceeding will delete all your daily summaries from database 'weewx.sdb' >>> Are you sure you want to proceed (y/n)? y >>> Daily summary tables dropped from database 'weewx.sdb' in 0.06 seconds >>> >>> And then: >>> >>> stalker@e6540:~$ weectl database rebuild-daily >>> Using configuration file /etc/weewx/weewx.conf >>> All daily summaries will be rebuilt. >>> Rebuild the daily summaries in the database 'weewx.sdb' (y/n)? y >>> Rebuilding daily summaries in database 'weewx.sdb' ... >>> Traceback (most recent call last):025-08-03 22:30:00 CEST (1754253000) >>> File "/usr/share/weewx/weectl.py", line 75, in <module> >>> main() >>> ~~~~^^ >>> File "/usr/share/weewx/weectl.py", line 67, in main >>> namespace.func(namespace) >>> ~~~~~~~~~~~~~~^^^^^^^^^^^ >>> File "/usr/share/weewx/weectllib/__init__.py", line 90, in dispatch >>> namespace.action_func(config_dict, namespace) >>> ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^ >>> File "/usr/share/weewx/weectllib/database_cmd.py", line 328, in >>> rebuild_daily >>> weectllib.database_actions.rebuild_daily(config_dict, >>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^ >>> date=namespace.date, >>> ^^^^^^^^^^^^^^^^^^^^ >>> ...<3 lines>... >>> dry_run=namespace.dry_run, >>> ^^^^^^^^^^^^^^^^^^^^^^^^^^ >>> no_confirm=namespace.yes) >>> ^^^^^^^^^^^^^^^^^^^^^^^^^ >>> File "/usr/share/weewx/weectllib/database_actions.py", line 139, in >>> rebuild_daily >>> nrecs, ndays = dbm.backfill_day_summary(start_d=from_d, >>> ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^ >>> stop_d=to_d, >>> ^^^^^^^^^^^^ >>> trans_days=20) >>> ^^^^^^^^^^^^^^ >>> File "/usr/share/weewx/weewx/manager.py", line 1331, in >>> backfill_day_summary >>> for rec in self.genBatchRecords(start_batch_ts, stop_batch_ts): >>> ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >>> File "/usr/share/weewx/weewx/manager.py", line 536, in genBatchRecords >>> for row in self.genBatchRows(startstamp, stopstamp): >>> ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^ >>> File "/usr/share/weewx/weewx/manager.py", line 518, in genBatchRows >>> for row in gen: >>> ^^^ >>> sqlite3.DatabaseError: database disk image is malformed >>> >>> Note that in the Traceback message (most recent call last):025-08-03 >>> 22:30:00 CEST (1754253000), the year is written as 025 instead of 2025, but >>> the Julian date converts correctly to 2025-08-03 20:30:00 UT. However, >>> moving along the graph in the year summary, August 3 looks normal, and the >>> peak is August 15. >>> >>> The question is simple: how to fix the database? >>> >> -- 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 visit https://groups.google.com/d/msgid/weewx-user/0fa96576-4b65-41a5-b026-36e9769a019bn%40googlegroups.com.
