I have a signal-desktop sqlite database that was running on Ubuntu 22.04. I backed up the entire signal folder (~/.config/Signal) after quitting Signal, upgraded my OS to Ubuntu 24.04 (clean install), restored my backup. When I try to open Signal, it throws the following error:
2024-09-06 15:41:34.201: ERROR CORE sqlcipher_page_cipher: hmac check failed for pgno=1
2024-09-06 15:41:34.201: ERROR CORE sqlite3Codec: error decrypting page 1 data: 1
2024-09-06 15:41:34.201: ERROR CORE sqlcipher_codec_ctx_set_error 1
{"level":40,"time":"2024-09-06T22:41:34.201Z","msg":"MainSQL: Database log code=26: file is not a database in \"PRAGMA journal_mode = WAL\""}
{"level":30,"time":"2024-09-06T22:41:34.201Z","msg":"MainSQL: migrateDatabase: Migration without cipher change failed"}
2024-09-06 15:41:34.235: ERROR CORE sqlcipher_page_cipher: hmac check failed for pgno=1
2024-09-06 15:41:34.235: ERROR CORE sqlite3Codec: error decrypting page 1 data: 1
2024-09-06 15:41:34.235: ERROR CORE sqlcipher_codec_ctx_set_error 1
{"level":40,"time":"2024-09-06T22:41:34.235Z","msg":"MainSQL: Database log code=26: statement aborts at 2: [PRAGMA user_version] file is not a database"}
{"level":50,"time":"2024-09-06T22:41:34.236Z","msg":"MainSQL: Database startup error: SqliteError: file is not a database\n at Database.pragma ([REDACTED]/node_modules/@signalapp/better-sqlite3/lib/methods/pragma.js:11:31)\n at getUserVersion ([REDACTED]/ts/sql/util.js:132:13)\n at migrateSchemaVersion ([REDACTED]/ts/sql/Server.js:397:54)\n at openAndMigrateDatabase ([REDACTED]/ts/sql/Server.js:429:5)\n at openAndSetUpSQLCipher ([REDACTED]/ts/sql/Server.js:451:14)\n at initialize ([REDACTED]/ts/sql/Server.js:489:10)\n at MessagePort.<anonymous> ([REDACTED]/ts/sql/mainWorker.js:69:41)\n at [nodejs.internal.kHybridDispatch] (node:internal/event_target:820:20)\n at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28)"}
{"level":50,"time":"2024-09-06T22:41:34.236Z","msg":"Failed to get zoom factor {\"name\":\"SqliteError\"}"}
{"level":30,"time":"2024-09-06T22:41:34.539Z","msg":"got fast theme-setting value system"}
{"level":50,"time":"2024-09-06T22:41:34.978Z","msg":"sql.initialize was unsuccessful; returning early"}
{"level":30,"time":"2024-09-06T22:41:34.978Z","msg":"close event {\"readyForShutdown\":false,\"shouldQuit\":false}"}
{"level":30,"time":"2024-09-06T22:41:34.979Z","msg":"maybeRequestCloseConfirmation: Checking to see if close confirmation is needed"}
{"level":50,"time":"2024-09-06T22:41:36.515Z","msg":"onDatabaseError: Quitting application"}
{"level":30,"time":"2024-09-06T22:41:36.516Z","msg":"main window closed event"}
{"level":30,"time":"2024-09-06T22:41:36.517Z","msg":"quit event {\"hasEventBeenPrevented\":false,\"windowCount\":0,\"mainWindowExists\":false}"}
{"level":50,"time":"2024-09-06T22:41:36.518Z","msg":"Error occurred in handler for 'sql-channel:read': {\"name\":\"SqliteError\"}"}
I attempted to open the ~/.config/Signal/sql/db.sqlite database using SQLCipher. After specifying the key using PRAGMA key = "x'{very long string of letters and numbers}'"
, if I run .tables, I get the following error:
2024-09-06 15:44:08.714: sqlcipher_page_cipher: hmac check failed for pgno=1
2024-09-06 15:44:08.714: sqlite3Codec: error decrypting page 1 data: 1
2024-09-06 15:44:08.714: sqlcipher_codec_ctx_set_error 1
Error: file is not a database
If I run PRAGMA cipher_integrity_check
, it throws several HMAC verification failed for page nnnn.
Does this mean the database is corrupt? Is there any way I can recover the db? Any advise would very much appreciated.