Open mervyngriffiths opened 2 months ago
Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (homeassistant_sky_connect
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
homeassistant_sky_connect documentation homeassistant_sky_connect source (message by IssueLinks)
Hey there @dmulcahey, @adminiuga, @puddly, @thejulianjes, mind taking a look at this issue as it has been labeled with an integration (zha
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
zha documentation zha source (message by IssueLinks)
sqlite3.DatabaseError: database disk image is malformed
Looks like your zigpy/ZHA database file is corrupted (zigbee.db
).
Hi there,
So what can I do? The thumb drive is not recognised on a Mac. Do I need a new drive? Where do I get that from?
Regards
Charles Griffiths
On 1 May 2024, at 19:55, TheJulianJES @.***> wrote:
sqlite3.DatabaseError: database disk image is malformed
Looks like your zigpy/ZHA database file is corrupted (zigbee.db).
— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/116545#issuecomment-2088842636, or unsubscribe https://github.com/notifications/unsubscribe-auth/A33WXA2GE4ZDHFEEO6KAOVDZAET73AVCNFSM6AAAAABHCKCLPOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBYHA2DENRTGY. You are receiving this because you authored the thread.
Hi there,
I have attached a copy of my Zigbee.db
Regards
CG
On 1 May 2024, at 19:55, TheJulianJES @.***> wrote:
sqlite3.DatabaseError: database disk image is malformed
Looks like your zigpy/ZHA database file is corrupted (zigbee.db).
— Reply to this email directly, view it on GitHubhttps://github.com/home-assistant/core/issues/116545#issuecomment-2088842636, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A33WXA2GE4ZDHFEEO6KAOVDZAET73AVCNFSM6AAAAABHCKCLPOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBYHA2DENRTGY. You are receiving this because you authored the thread.Message ID: @.***>
@mervyngriffiths GitHub doesn't accept file uploads over email. Can you attach it to a comment?
I have attached the Zigbee.db. It looks ok structurally as it can be read by a Sqlite app, so I guess there is a problem with the data. Changed the extension to .pdf so GitHub will accept it.
I have got past the problem by deleting and recreating the Zigbee.db as follows
The database has a few issues:
sqlite> pragma integrity_check;
*** in database main ***
Tree 29 page 29: btreeInitPage() returns error code 11
Tree 28 page 28: btreeInitPage() returns error code 11
Runtime error: database disk image is malformed (11)
You can try to recover it with zigpy-cli, which seems to run without errors:
pip install zigpy-cli
zigpy db recover zigbee.db zigbee.db.recovered
The database initialisation seemed to work OK. I don't have many Zigbee devices attached so they were easily recovered. The corruption occurred when I was implementing new stuff on HAOS and was restarting a lot. Could this have caused a possible corruption?
SQLite should be very immune to corruption. Like it shouldn't even be possible under normal conditions.
How are you running Home Assistant OS? In a VM?
It's on a Raspberry Pi running HAOS. Don't know enough about the PI to see if there were any possible hardware glitches, or Linux related errors.
I have a VM based install via Virtualbox, it is seeing the skyconnect in the hardware list but the ZHA, Matter and Thread integrations are stuck in a failed to setup loop with the following build installed:
Core 2024.5.0 Supervisor 2024.04.4 Operating System 12.3.rc2 Frontend 20240501.0
Issue only started since Core 2024.5.0 and OS 12.3.rc2 was installed. Database issue may be related but not sure how to access to test the possible fix listed in the above thread.
edit: Reverting back to the following build has restored ZHA and Thread integrations from being stuck in the failed to setup loop, now just waiting for the fix to Matter integration to start working again.
Core 2024.5.0 Supervisor 2024.04.4 Operating System 12.2 Frontend 20240501.0
edit2; So far with the following version instances everything is running as it should be, I had to remove via list without pairing them again and let ZHA auto discover and readd the devices for them to start working again after reverting to an older snapshot.
Core 2024.5.1 Supervisor 2024.04.4 Operating System 12.2 Frontend 20240501.0
If we discount the SQLite software, the Linux kernel and the hardware from causing the error then that pretty much leave the HAOS Core or the Zigbee handler as the possible culprit.
As I said earlier the problem occurred during a period of multiple restarts of HAOS. Could this possibly point to deficiencies in any SQL INSERTS, UPDATE, RELEASE implementations possibly running without START TRANSACTION/COMMIT functionality?
Only the developers of the code can speak on what may of been missing or if there was a typo between these releases; but as stated its all working now.
It's akin to needing to go into the hass agent intergration and adding some missing items in the script as per https://github.com/hass-agent/HASS.Agent-Integration/issues/2 to get the media playback control working for the client install again.
There really shouldn't be a way to corrupt an SQLite database without something going seriously wrong: https://www.sqlite.org/howtocorrupt.html. Interrupting, crashing, restarting, and bad SQL should not leave the database in a corrupted state.
The problem
I want to reinstall SkyConnect. I connect the SkyConnect Thumb Drive and press Submit. the message: 'Unknown error occurred' is returned.
I have attached the Log file entry.
What version of Home Assistant Core has the issue?
2024.4.4
What was the last working version of Home Assistant Core?
2024.4.4
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Home Assistant SkyConnect
Link to integration documentation on our website
https://www.home-assistant.io/integrations/homeassistant_sky_connect/
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
No response