https://github.com/signalapp/Signal-Desktop/issues/4513 Skip to content Sign up * Why GitHub? Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Project management - + Integrations - + GitHub Sponsors - + Customer stories- + Security - * Team * Enterprise * Explore + Explore GitHub - Learn and contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing Plans - + Compare plans - + Contact Sales - + Nonprofit - + Education - [ ] [search-key] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} signalapp / Signal-Desktop * Sponsor Sponsor signalapp/Signal-Desktop * Notifications * Star 10.5k * Fork 1.9k * Code * Issues 1.2k * Pull requests 32 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights 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. Pick a username [ ] Email Address [ ] Password [ ] [ ] Sign up for GitHub 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 Jump to bottom Database startup error: Error: SQLITE_NOTADB: file is not a database #4513 Open eppfel opened this issue Sep 12, 2020 * 23 comments Open Database startup error: Error: SQLITE_NOTADB: file is not a database #4513 eppfel opened this issue Sep 12, 2020 * 23 comments Labels Need Information Comments @eppfel Copy link Contributor @eppfel eppfel commented Sep 12, 2020 * edited * [*] I have searched open and closed issues for duplicates Related, but outdated: #2712 #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 and Signal-betafolder 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 grafik 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. {"name":"log","hostname":"xBook.home","pid":16348,"level":30,"msg":"app ready","time":"2020-09-12T07:47:54.231Z","v":0} {"name":"log","hostname":"xBook.home","pid":16348,"level":30,"msg":"starting version 1.35.2","time":"2020-09-12T07:47:54.231Z","v":0} {"name":"log","hostname":"xBook.home","pid":16348,"level":30,"msg":"migrateDatabase: Migration without cipher change failed","time":"2020-09-12T07:47:54.261Z","v":0} {"name":"log","hostname":"xBook.home","pid":16348,"level":30,"msg":"Database startup error: Error: SQLITE_NOTADB: file is not a database","time":"2020-09-12T07:47:54.263Z","v":0} {"name":"log","hostname":"xBook.home","pid":16348,"level":30,"msg":"sql.initialize was unsuccessful; returning early","time":"2020-09-12T07:48:24.204Z","v":0} {"name":"log","hostname":"xBook.home","pid":16810,"level":30,"msg":"app ready","time":"2020-09-12T08:45:16.683Z","v":0} {"name":"log","hostname":"xBook.home","pid":16810,"level":30,"msg":"starting version 1.35.2","time":"2020-09-12T08:45:16.684Z","v":0} {"name":"log","hostname":"xBook.home","pid":16810,"level":30,"msg":"migrateDatabase: Migration without cipher change failed","time":"2020-09-12T08:45:16.698Z","v":0} {"name":"log","hostname":"xBook.home","pid":16810,"level":30,"msg":"Database startup error: Error: SQLITE_NOTADB: file is not a database","time":"2020-09-12T08:45:16.700Z","v":0} {"name":"log","hostname":"xBook.home","pid":16810,"level":30,"msg":"sql.initialize was unsuccessful; returning early","time":"2020-09-12T08:45:21.291Z","v":0} the config.js holds a key. The text was updated successfully, but these errors were encountered: 9 @scottnonnenberg-signal Copy link Member @scottnonnenberg-signal scottnonnenberg-signal commented Sep 14, 2020 @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? @scottnonnenberg-signal scottnonnenberg-signal added the Need Information label Sep 14, 2020 @eppfel Copy link Contributor Author @eppfel eppfel commented Sep 16, 2020 Thanks for getting back to me. I don't recall it, but the laptop is old so the battery discharges quickly. @scottnonnenberg-signal scottnonnenberg-signal changed the title [DEL:Database startup error: Error: SQLITE_NOTADB: file is not a database wehn migrating the database.:DEL] [INS:Database startup error: Error: SQLITE_NOTADB: file is not a database:INS] Sep 16, 2020 @scottnonnenberg-signal Copy link Member @scottnonnenberg-signal scottnonnenberg-signal commented Sep 16, 2020 Prior discussion about this error is here: #2609 @eppfel Copy link Contributor Author @eppfel eppfel commented Sep 17, 2020 This seems different in the sense, that it fails migrating the databse in my case. Could this be related to an update? @scottnonnenberg-signal Copy link Member @scottnonnenberg-signal scottnonnenberg-signal commented Sep 17, 2020 It's definitely the same thing. We are prepared to migrate a database (encryption ciphers or database schema, as needed) on every database open. 1 @bjdooi Copy link @bjdooi bjdooi commented Sep 30, 2020 I'm having the same exact issue (probably due to my computer randomly shutting off during an update). I contacted support@signal.org like the previous issues said to do but haven't heard back from them yet @primeos Copy link @primeos primeos commented Dec 8, 2020 * edited This just happened to me too after a normal reboot (no crash or anything and a FS corruption seems unlikely): {"name":"log","hostname":"jarvis","pid":15241,"level":30,"msg":"app ready","time":"2020-12-08T14:25:15.449Z","v":0} {"name":"log","hostname":"jarvis","pid":15241,"level":30,"msg":"starting version 1.38.2","time":"2020-12-08T14:25:15.449Z","v":0} {"name":"log","hostname":"jarvis","pid":15241,"level":30,"msg":"migrateDatabase: Migration without cipher change failed","time":"2020-12-08T14:25:15.478Z","v":0} {"name":"log","hostname":"jarvis","pid":15241,"level":30,"msg":"Database startup error: Error: SQLITE_NOTADB: file is not a database","time":"2020-12-08T14:25:15.481Z","v":0} {"name":"log","hostname":"jarvis","pid":15241,"level":30,"msg":"sql.initialize was unsuccessful; returning early","time":"2020-12-08T14:25:19.715Z","v":0} 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: {"name":"log","hostname":"jarvis","pid":26735,"level":30,"time":"2020-12-07T17:14:51.665Z","msg":"Sending a keepalive message","v":0} {"name":"log","hostname":"jarvis","pid":26735,"level":30,"time":"2020-12-07T17:15:46.961Z","msg":"Sending a keepalive message","v":0} {"name":"log","hostname":"jarvis","pid":26735,"level":30,"time":"2020-12-07T17:16:39.017Z","msg":"Removing notification","v":0} {"name":"log","hostname":"jarvis","pid":26735,"level":30,"time":"2020-12-07T17:16:40.032Z","msg":"SQL channel job 24509 (updateConversations) succeeded in 12ms","v":0} {"name":"log","hostname":"jarvis","pid":26735,"level":30,"msg":"close event {\"shouldQuit\":false}","time":"2020-12-07T17:16:42.391Z","v":0} {"name":"log","hostname":"jarvis","pid":26735,"level":30,"msg":"requestShutdown: Requesting close of mainWindow...","time":"2020-12-07T17:16:42.393Z","v":0} {"name":"log","hostname":"jarvis","pid":26735,"level":30,"time":"2020-12-07T17:16:42.077Z","msg":"Sending a keepalive message","v":0} {"name":"log","hostname":"jarvis","pid":26735,"level":30,"time":"2020-12-07T17:16:42.396Z","msg":"background/shutdown","v":0} {"name":"log","hostname":"jarvis","pid":26735,"level":30,"time":"2020-12-07T17:16:42.396Z","msg":"attachment_downloads/stop: disabling","v":0} {"name":"log","hostname":"jarvis","pid":26735,"level":30,"time":"2020-12-07T17:16:42.396Z","msg":"MessageReceiver: stopProcessing requested","v":0} {"name":"log","hostname":"jarvis","pid":26735,"level":30,"time":"2020-12-07T17:16:42.396Z","msg":"MessageReceiver.close()","v":0} {"name":"log","hostname":"jarvis","pid":26735,"level":30,"time":"2020-12-07T17:16:42.396Z","msg":"WebSocketResource.close()","v":0} {"name":"log","hostname":"jarvis","pid":26735,"level":30,"time":"2020-12-07T17:16:42.396Z","msg":"drained","v":0} {"name":"log","hostname":"jarvis","pid":26735,"level":30,"time":"2020-12-07T17:16:42.397Z","msg":"MessageReceiver: unregister batchers","v":0} {"name":"log","hostname":"jarvis","pid":26735,"level":30,"msg":"requestShutdown: Response received","time":"2020-12-07T17:16:42.449Z","v":0} {"name":"log","hostname":"jarvis","pid":26735,"level":30,"msg":"before-quit event {\"readyForShutdown\":true,\"shouldQuit\":false}","time":"2020-12-07T17:16:42.450Z","v":0} {"name":"log","hostname":"jarvis","pid":26735,"level":30,"msg":"close event {\"readyForShutdown\":true,\"shouldQuit\":true}","time":"2020-12-07T17:16:42.450Z","v":0} There seems to be no indication that anything did go wrong. I've created a backup right after closing Signal-Desktop but the DB (~ /.config/Signal/sql/db.sqlite) from the backup has the same hash and is also corrupt (I cannot open it manually using sqlcipher and since it's encrypted I cannot really investigate why...). 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 db.sqlite seem to be identical in both files (I didn't look at the SQLCipher documentation; not sure if it should look that way or not). @ryantrinkle Copy link @ryantrinkle ryantrinkle commented Dec 24, 2020 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. @ryantrinkle Copy link @ryantrinkle ryantrinkle commented Dec 24, 2020 * edited 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. Set Windows Application User Model ID (AUMID) { appUserModelId: 'org.whispersystems.signal-desktop' } NODE_ENV production NODE_CONFIG_DIR /nix/store/8x3rqj3j9dg2g3f842xwymrhffvi60y6-signal-desktop-1.39.2/lib/Signal/resources/app.asar/config NODE_CONFIG {} ALLOW_CONFIG_MUTATIONS undefined HOSTNAME undefined NODE_APP_INSTANCE undefined SUPPRESS_NO_CONFIG_WARNING undefined SIGNAL_ENABLE_HTTP undefined userData: /home/ryan/.config/Signal config/get: Successfully read user config file x-attr dependency did not load successfully config/get: Successfully read ephemeral config file making app single instance {"name":"log","hostname":"aji","pid":21418,"level":30,"msg":"app ready","time":"2020-12-24T02:33:44.571Z","v":0} {"name":"log","hostname":"aji","pid":21418,"level":30,"msg":"starting version 1.39.2","time":"2020-12-24T02:33:44.571Z","v":0} {"name":"log","hostname":"aji","pid":21418,"level":30,"msg":"media access status undefined undefined","time":"2020-12-24T02:33:44.572Z","v":0} {"name":"log","hostname":"aji","pid":21418,"level":30,"msg":"migrateDatabase: Migration without cipher change failed","time":"2020-12-24T02:33:44.586Z","v":0} {"name":"log","hostname":"aji","pid":21418,"level":30,"msg":"Database startup error: Error: SQLITE_NOTADB: file is not a database","time":"2020-12-24T02:33:44.587Z","v":0} {"name":"log","hostname":"aji","pid":21418,"level":30,"msg":"sql.initialize was unsuccessful; returning early","time":"2020-12-24T02:33:48.441Z","v":0} @scottnonnenberg-signal Copy link Member @scottnonnenberg-signal scottnonnenberg-signal commented Jan 4, 2021 @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? @norpol norpol mentioned this issue Jan 8, 2021 Signal Desktop faulty version potentially causing data loss NixOS/ nixpkgs#108772 Open @primeos Copy link @primeos primeos commented Jan 8, 2021 * edited I hate Signals way of dealing with long term conversations and history archival, it sucks - there are no proper ways of dealing with this. @moxie0 +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: 1. Support making backups and importing them without relying on 3rd party tools: #522 + https://support.signal.org/hc/en-us/articles/ 360007059752-Backup-and-Restore-Messages ("Manually transferring folders is not supported and may result in errors. Signal uses a stateful protocol, meaning that you cannot simply copy files to another instance of Signal or copy files after linking and using Signal.") + 3rd party: NixOS/nixpkgs#106038 2. Support fetching(/importing) older messages from the phone (if the user wants it): #1651 7 [?] 15 @neonfuz Copy link @neonfuz neonfuz commented Jan 15, 2021 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. @fdietze Copy link @fdietze fdietze commented Feb 1, 2021 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? @backuitist Copy link @backuitist backuitist commented Feb 1, 2021 You could check the first 16 bytes of your db file: $ hexdump -C ~/.config/Signal/sql/db.sqlite | head -1 You're supposed to see this: 00000000 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 |SQLite format 3.| On my broken DB I had this: 00000000 f0 fd 28 28 7e 5b 5a d7 8f 3f d1 ea 60 73 1c 47 |..((~[Z..?..`s.G| I couldn't find any tool able to repair a DB with a bad header... @fdietze Copy link @fdietze fdietze commented Feb 1, 2021 Hmm, I have: 00000000 f7 93 95 e1 ef b4 ad ee 98 3b ac 32 54 15 84 10 |.........;.2T...| @mehdibo Copy link @mehdibo mehdibo commented Feb 2, 2021 Same error just happened to me today Database startup error: Error: SQLITE_NOTADB: file is not a database @fdietze Copy link @fdietze fdietze commented Feb 4, 2021 Since I wanted to use Signal on my Desktop again, I just deleted my whole chat history. That felt really bad... 6 [?] 3 @panicfarm Copy link @panicfarm panicfarm commented Feb 27, 2021 * edited This Database startup error: Error: SQLITE_NOTADB: file is not a database on Windows 10 makes the program unusable- it has destroyed my chat history on two occasions. It only happens after the app autoupdate, when I quit and restart the same version of Signal, the DB is opened fine. When I chose "Delete All Data" on the error dialog, it shows Error: EBUSY: resource busy or locked, unlink 'C:\Users\[REDACTED]\AppData\Roaming\Signal\sql\db.sqlite' at Object.unlinkSync (fs.js:930:3) at Function.rimrafSync [as sync] ([REDACTED]\app.asar\node_modules\rimraf\rimraf.js:306:17) at removeDB ([REDACTED]\app.asar\app\sql.js:1150:10) at Object.initialize ([REDACTED]\app.asar\app\sql.js:1123:13) Using Process Explorer, I could not find a process that was locking db.sqlite @norpol This comment has been hidden. Sign in to view @sonergonul Copy link @sonergonul sonergonul commented Feb 28, 2021 Now, this is on Hacker News: https://news.ycombinator.com/item?id= 26292299 32 @justinclift Copy link @justinclift justinclift commented Feb 28, 2021 * edited @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: $ hexdump -C 2.5mb-encrypted-abc123.sqlite | head -1 00000000 ff 3f fc f2 74 1a 61 44 5c c7 44 0e bb 0b a1 42 |.?..t.aD\.D....B| 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": * 2.5mb-encrypted-abc123.zip <-- thrown inside a .zip file, so GitHub would accept the upload @justinclift Copy link @justinclift justinclift commented Feb 28, 2021 @ryantrinkle 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. 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 probably revert to the older Signal version until this problem is resolved. Hopefully that's something they can do. @norpol Copy link @norpol norpol commented Feb 28, 2021 * edited @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 00000000 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 |SQLite format 3. and using sqlite3-cli it allows me to see actual message contents - just by opening the database. If SQLCipher was in use I wouldn't see that header/be able to extract the database I assume. @U-v-U U-v-U mentioned this issue Feb 28, 2021 Signal's TLS Proxy Failed to be Probing Resistant and seems leaky net4people/bbs#60 Open Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment Assignees No one assigned Labels Need Information Projects None yet Milestone No milestone Linked pull requests Successfully merging a pull request may close this issue. None yet 14 participants @justinclift @backuitist @ryantrinkle @fdietze @sonergonul @eppfel @norpol @neonfuz @mehdibo @primeos @panicfarm @bjdooi @scottnonnenberg-signal and others * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.