-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Database startup error: Error: SQLITE_NOTADB: file is not a database #4513
Comments
@eppfel When you see this error, it means that something has gone wrong with your database on disk. It happens most frequently when your computer loses power unexpectedly, or you have to shutdown your computer abruptly. Did anything like that happen recently? |
Thanks for getting back to me. I don't recall it, but the laptop is old so the battery discharges quickly. |
Prior discussion about this error is here: #2609 |
This seems different in the sense, that it fails migrating the databse in my case. Could this be related to an update? |
It's definitely the same thing. We are prepared to migrate a database (encryption ciphers or database schema, as needed) on every database open. |
I'm having the same exact issue (probably due to my computer randomly shutting off during an update). I contacted [email protected] like the previous issues said to do but haven't heard back from them yet |
This just happened to me too after a normal reboot (no crash or anything and a FS corruption seems unlikely):
I'm on GNU/Linux with Signal-Desktop 1.38.2. I'll try to find out more. Updates: This is the log of the last application shutdown:
There seems to be no indication that anything did go wrong. I've created a backup right after closing Signal-Desktop but the DB ( A comparison of the file sizes (last working backup vs. corrupt DB): $ du -h Signal/sql/db.sqlite Signal-corrupt-sqlcipher-db/sql/db.sqlite
56M Signal/sql/db.sqlite
57M Signal-corrupt-sqlcipher-db/sql/db.sqlite
$ du -b Signal/sql/db.sqlite Signal-corrupt-sqlcipher-db/sql/db.sqlite
58351616 Signal/sql/db.sqlite
59084800 Signal-corrupt-sqlcipher-db/sql/db.sqlite But only the first 16 bytes of |
I'm trying to upgrade from v1.37.3 to v1.39.4, and I"m getting this same error (NOTADB). If I manually start v1.37.3, everything still works and all data is still present. |
I've now narrowed this down a bit: I was able to step through versions up to 1.38.2, which runs successfully. Running 1.39.2 (which seems to be the next release after 1.38.2) results in NOTADB.
|
@ryantrinkle It's really surprising that the changes from v1.37 to v1.39 would result in that kind of error, since no low-level database changes are included. How are you installing Signal Desktop? |
+1, please do something about this. Finding and fixing the bug might be a challenge but in any case Signal-Desktop should (IMO) at least:
|
I have been getting network errors in signal today so I looked at issues for my distro (nixos) and found this bug, so I quit signal to backup my signal folder, and upon re-opening it I had a corrupted database... very annoying, my phone is broken right now so its going to be a pain getting access to signal now. |
I have the same problem. So what are my options now? Is there a way repair the corrupted database? Do I have to delete my history? Should I wait for a fix? |
You could check the first 16 bytes of your db file:
You're supposed to see this:
On my broken DB I had this:
I couldn't find any tool able to repair a DB with a bad header... |
Hmm, I have:
😞 |
Same error just happened to me today Database startup error: Error: SQLITE_NOTADB: file is not a database |
Since I wanted to use Signal on my Desktop again, I just deleted my whole chat history. That felt really bad... |
This
Using Process Explorer, I could not find a process that was locking db.sqlite |
This comment has been minimized.
This comment has been minimized.
Now, this is on Hacker News: https://news.ycombinator.com/item?id=26292299 |
@backuitist If Signal is using SQLCipher, as mentioned earlier in this thread, then the header of the encrypted database isn't the standard SQLite header. For example, this is the header from a SQLCipher database with some generated ~random data for testing purposes:
That database file opens fine with any client that can use SQLCipher version 4.x. eg DB Browser for SQLite Note, this is the above test database itself (not a Signal one), just in case it's useful for someone to investigate with. Password is "abc123":
|
That kind of sounds like the newer version(s) of Signal is using different encryption settings than the older version. Would personally kind of expect the newer version to at least try reading in the "old" database using the "old" settings, and then write out the new database using the "new" settings. Maybe something is going wrong with that process? @norpol Sounds like the journalists losing their data should revert to the older Signal version until this problem is resolved. Hopefully that's something they can do. |
@justinclift Thanks, I'll forward this information. Update: Suddenly just asking to re-link, so the archive is thankfully not gone. Regarding SQLCipher At least for the my current version (1.39.6) the header of the database is |
@norpol Yeah, that sounds like the database you're trying there isn't encrypted. At least, not with SQLCipher. |
Thanks @justinclift good to know! I thought there would be some sort of encryption but couldn't find anything in the codebase, and the signal error message was exactly matching that of SQLite. |
I did the same thing a few weeks ago but since this just deactivated encryption i now tried to find a better solution.
I get this wether or not i put the encrypted or not-encrypted file at |
@thrien the linked Stack Overflow example uses a passphrase. For raw keys You also need to manually copy the In case someone's interested: I've wrote the following very hacky script that worked for me (but one needs to replace all of the
Not sure why it has changed but IIRC it changed in Signal-Desktop 5.1.0 (likely affects other error messages as well - probably an intentional change to provide additional context (stack trace) instead of just printing the "file is not a database" error message). |
I already replied to the previous comment via e-Mail, but apparently GitHub has swallowed my reply once again :/ Here it is: The issue was that some newer versions broke sqlcipher support, by downgrading, the sqlcipher support should have been restored. So if you downgraded to the correct, you should have been using an encrypted database. And by upgrading to a recent version, it should continue to work with that encrypted database. However, did you try to encrypt the database using the CLI instead of using the API? I think there's less room for errors if you execute the SQL statements used for encryption directly on the CLI instead of wrapping them in the API. See also https://discuss.zetetic.net/t/how-to-encrypt-a-plaintext-sqlite-database-to-use-sqlcipher-and-avoid-file-is-encrypted-or-is-not-a-database-errors/868. |
I'm going to unsubscribe since the original issue has been resolved, if there's a new issue with the Arch Linux package please create an issue in the Arch Linux issue tracker. This github issue can likely be closed. |
@kpcyrd: I'm curious what the solution was. I can't find any change that indicates solving the static/dynamic linking issue, could you point to it? |
I also haven't experienced this issue in a while on Arch Linux. Don't know if this is just a temporary condition or if the issue has been fixed. Thanks anyway for everyone involved with getting this resolved! |
It's a temporary fix. The gtk3-package wants to enable a feature regarding sqlite that clashes with the sqlcipher-implementation signal-desktop uses. Due to this, this feature in gtk3 was rolled back temporarily, but is still on the roadmap to be enabled again, whenever this will be. Eventually I guess, given the problem with sqlcipher (which is: sqlcipher disguises itself as sqlite, to be a drop-in replacement, but the gtk3-feature will load sqlite early on (i.e. before the application itself comes up) and then sqlcipher's intended place is already occupied by normal sqlite, which then cannot read the database, as it is an sqlcipher-one, hence the error.) |
Holy shit it works again. Thank you very much!
|
Add linker flags to - prevent the dynamic linker from using an external SQLite for this library (`-Bsymbolic`) and - prevent the dynamic linker from using the internal SQLite for other libraries (`--exclude-libs ALL`). This fixes both signalapp/Signal-Desktop#4513 and signalapp/Signal-Desktop#5471 for us.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I mean people lost their signal history, there hasn't been any comment whether this has actually been fixed + the bug of deleting the database when you click the wrong button is likely also not fixed? |
The title describes a symptom and different people joined this issue for different root causes. Arch Linux currently patches one of the Signal-Desktop dependencies for gnome support, the pull request to upstream the change is at signalapp/better-sqlite3#3. The "database deletion when closing the dialog" bug should be tracked in a different github issue in case it's still present. |
Exact same thing happened to me. ~3 years worth of chats gone, and unfortunately my last backup is pretty much 1y old... Ran photorec on my whole disk and recovered a lot of files, but now sieving through them will take ages, with no guarantee I can even recover the database properly. Honestly getting really fed up about this whole anti-backup anti-phone-sync attitude from Signal. |
This comment has been minimized.
This comment has been minimized.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@thrien do you recall doing anything else in order to work with the DB? I've installed sqlcipher and when I connect to the 'db.sqlite' file then execute
I was really hoping I could transfer my conversation history by tweaking a few things in the DB to match my new laptop's Signal key, but it appears that sqlcipher doesn't know what to do with these db files now. |
Related, but outdated: Signal won't show on screen after launch on Windows 10 x64 #2712 Signal won't start after upgrade to 1.15.0 #2609
Bug Description
I just started Signal and receive the error
Database startup error: Error: SQLITE_NOTADB: file is not a database
with the option to delete all data and start new.What is strange is, that I have a
Signal
andSignal-beta
folder in~/Library/Application Support/
. The files in beta however are all created on 2020-01-08 and no changes were made after that. I thought I was using beta but somehow I did not.Also interesting that it tries to migrate the data with each restart.
I have used Signal on and off on that machine, not on a daily basis.
Screenshots
Platform Info
Signal Version:
1.35.2
Operating System:
OS X 10.14
Linked Device Version:
4.71.2
Link to Debug Log
No link, as App did not start, so here the log file.
the config.js holds a key.
The text was updated successfully, but these errors were encountered: