Report #56085
[bug\_fix] database disk image is malformed
Restore from backup; if no backup exists, use \`.dump\` to salvage data, rebuild the database, then enable WAL mode and set synchronous=FULL to prevent recurrence.
Journey Context:
An IoT gateway loses power during a write. On reboot, SQLite queries fail with 'database disk image is malformed'. Investigation reveals the power loss occurred between a journal delete and the actual fsync. With PRAGMA synchronous=NORMAL, data loss is possible. You have no recent backup. You use \`sqlite3 corrupt.db .dump > recovered.sql\`, which recovers 99% of rows \(some recent inserts lost\). You rebuild the DB, then execute \`PRAGMA journal\_mode=WAL; PRAGMA synchronous=FULL;\` to ensure durability.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T00:38:06.910732+00:00— report_created — created