Bug #3133

handle upgrading cacheword and sqlcipher

Added by hans almost 4 years ago.

Status:NewStart date:03/26/2014
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Component:

Description

https://github.com/guardianproject/notecipher/issues/28

On a Samsung Galaxy Note II running CM10.1, upgrading fails. I made a note store with the version in Google Play, then the current version didn't find it and asked me to set a new passphrase. Then it was crashy, so I think it was partially detecting the old note store. I'm using the latest nightly build from today.

Here's how to reproduce:

1. install NoteCipher from Play
2. set passphrase
3. create a couple notes
4. upgrade to this APK: https://guardianproject.info/builds/release-staging/NoteCipher-release.apk
5. start app, (prompts to set passphrase)

I just tried the process again, when I upgrade the app, then it takes me directly to the "Change Passphrase" screen, so it seems its not seeing the existing notes db. Here's the logcat:

  5383   PackageAddRemoveRe..  D  onReceive() action=android.intent.action.PACKAGE_REMOVED
  5383   PackageAddRemoveRe..  D  PACKAGE_ADDED intent data: package:info.guardianproject.notepadbot
  5398                  Trace  W  error opening trace file: No such file or directory (2)
  5412                  Trace  W  error opening trace file: No such file or directory (2)
  3137   PackageBroadcastSe..  D  Received broadcast action=android.intent.action.PACKAGE_ADDED and uri=info.guardianproject.notepadbot
 18076                 Finsky  D  [1] DetailsFragment.requestData: Using current account [nveGHmb-L0Qijf9pU71x8Q8qRIs] to fetch social details for info.guardianproject.notepadbot
  3137     PeopleContactsSync  I  CP2 sync disabled
  1354   Icing.InternalIcin..  I  Updating corpora: A: info.guardianproject.notepadbot, C: MAYBE
  5366                 FDroid  D  PackageReceiver received info.guardianproject.notepadbot
  5366                 FDroid  D  Invalidating info.guardianproject.notepadbot
 22876            DeepLinking  W  no deep link install data found for info.guardianproject.notepadbot
  5383   PackageAddRemoveRe..  D  onReceive() action=android.intent.action.PACKAGE_ADDED
  5383   PackageAddRemoveRe..  D  PACKAGE_ADDED intent data: package:info.guardianproject.notepadbot
  3137   PackageBroadcastSe..  D  Received broadcast action=android.intent.action.PACKAGE_REPLACED and uri=info.guardianproject.notepadbot
  3137     PeopleContactsSync  I  CP2 sync disabled
  5438                  Trace  W  error opening trace file: No such file or directory (2)
 18076                 Finsky  D  [1] DetailsDataBasedFragment.rebindViews: Page [class=DetailsFragment] loaded in [7096782 ms] (hasDetailsDataLoaded? true)
  5438       AutosyncReceiver  I  [main] got broadcast: Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:info.guardianproject.notepadbot flg=0x8000010 cmp=de.schildbach.wallet/.service.AutosyncReceiver (has extras) }
  5457                  Trace  W  error opening trace file: No such file or directory (2)
  5457               Database  I  JNI_OnLoad called
  5457               Database  I  JNI_OnLoad register methods
  5457                 libEGL  D  loaded /system/lib/egl/libEGL_mali.so
  5457                 libEGL  D  loaded /system/lib/egl/libGLESv1_CM_mali.so
  5457                 libEGL  D  loaded /system/lib/egl/libGLESv2_mali.so
  5457                         E  Device driver API match
  5457                         E  Device driver API version: 17
  5457                         E  User space API version: 17
  5457                         E  mali: REVISION=Linux-r3p1-01rel1 BUILD_DATE=Tue Jul  2 15:06:24 KST 2013
  5457         OpenGLRenderer  D  Enabling debug mode 0
  5457       CacheWordService  D  onCreate
  5457       CacheWordService  D  onStart: null action
  5457       CacheWordHandler  D  onServiceConnected
  5457        CacheWordBinder  D  giving service
  5457       CacheWordService  D  attachSubscriber(): 1
  5457       CacheWordService  D  timeout enabled: true, minutes=5
  5457       CacheWordService  D  mSubscriberCount: 1
  5457       CacheWordService  D  disabled timeout alarm
  5457       CacheWordHandler  D  checkCacheWordState: STATE_UNINITIALIZED
  5457             NoteCipher  D  onCacheWordUninitialized
  5457       CacheWordService  D  detachSubscriber(): 0
  5457       CacheWordService  D  timeout enabled: true, minutes=5
  5457       CacheWordService  D  mSubscriberCount: 0
  5457       CacheWordService  D  starting timeout: 300000
  5457       CacheWordService  D  timeout enabled: true, minutes=5
  5457       CacheWordService  D  mSubscriberCount: 0
  5457       CacheWordService  D  starting timeout: 300000
  5457       CacheWordService  D  onStart: null action
  5457       CacheWordHandler  D  onServiceConnected
  5457        CacheWordBinder  D  giving service
  5457       CacheWordService  D  attachSubscriber(): 1
  5457       CacheWordService  D  timeout enabled: true, minutes=5
  5457       CacheWordService  D  mSubscriberCount: 1
  5457       CacheWordService  D  disabled timeout alarm
  5457       CacheWordHandler  D  checkCacheWordState: STATE_UNINITIALIZED

Next up, I set a new passphrase, then it says I can't open the notes, even though I set the new passphrase the same as the old (my guess is the actual key is different because cacheword is making a new one). Here's the logcat:

  5457       CacheWordService  D  setCachedSecrets()
  5457       CacheWordService  D  goBackground()
  5457       CacheWordService  D  timeout enabled: true, minutes=5
  5457       CacheWordService  D  mSubscriberCount: 1
  5457       CacheWordService  D  disabled timeout alarm
  5457       CacheWordHandler  D  checkCacheWordState: STATE_UNLOCKED
  2306        ActivityManager  I  START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x34000000 pkg=info.guardianproject.notepadbot cmp=info.guardianproject.notepadbot/.NoteCipher} from pid 5457
  5457       CacheWordService  D  detachSubscriber(): 0
  5457       CacheWordService  D  timeout enabled: true, minutes=5
  5457       CacheWordService  D  mSubscriberCount: 0
  5457       CacheWordService  D  starting timeout: 300000
  5457       CacheWordService  D  onStart: null action
  5457       CacheWordHandler  D  onServiceConnected
  5457        CacheWordBinder  D  giving service
  5457       CacheWordService  D  attachSubscriber(): 1
  5457       CacheWordService  D  timeout enabled: true, minutes=5
  5457       CacheWordService  D  mSubscriberCount: 1
  5457       CacheWordService  D  disabled timeout alarm
  5457       CacheWordHandler  D  checkCacheWordState: STATE_UNLOCKED
  5457             NoteCipher  D  onCacheWordOpened
  5457         NotesDbAdapter  E  opening with cacheword
  5457    SQLCipherOpenHelper  D  sqlcipher uses native method to set key
  5457               Database  I  sqlite returned: error code = 26, msg = statement aborts at 1: [PRAGMA user_version;] file is encrypted or is not a database
  5457               Database  I  sqlite returned: error code = 26, msg = statement aborts at 1: [PRAGMA user_version;] file is encrypted or is not a database
  5457               Database  I  sqlite returned: error code = 26, msg = statement aborts at 1: [PRAGMA user_version;] file is encrypted or is not a database
  5457               Database  I  sqlite returned: error code = 26, msg = file is encrypted or is not a database
  5457               Database  E  CREATE TABLE android_metadata failed
  5457               Database  E  Failed to setLocale() when constructing, closing the database
  5457               Database  E  net.sqlcipher.database.SQLiteException: file is encrypted or is not a database
  5457               Database  E  at net.sqlcipher.database.SQLiteDatabase.native_setLocale(Native Method)
  5457               Database  E  at net.sqlcipher.database.SQLiteDatabase.setLocale(SQLiteDatabase.java:2072)
  5457               Database  E  at net.sqlcipher.database.SQLiteDatabase.<init>(SQLiteDatabase.java:1938)
  5457               Database  E  at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:871)
  5457               Database  E  at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:899)
  5457               Database  E  at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:127)
  5457               Database  E  at info.guardianproject.cacheword.SQLCipherOpenHelper.getWritableDatabase(SQLCipherOpenHelper.java:60)
  5457               Database  E  at info.guardianproject.notepadbot.NotesDbAdapter.open(NotesDbAdapter.java:130)
  5457               Database  E  at info.guardianproject.notepadbot.NoteCipher.unlockDatabase(NoteCipher.java:162)
  5457               Database  E  at info.guardianproject.notepadbot.NoteCipher.onCacheWordOpened(NoteCipher.java:506)
  5457               Database  E  at info.guardianproject.cacheword.CacheWordHandler.checkCacheWordState(CacheWordHandler.java:310)
  5457               Database  E  at info.guardianproject.cacheword.CacheWordHandler.access$100(CacheWordHandler.java:24)
  5457               Database  E  at info.guardianproject.cacheword.CacheWordHandler$2.onServiceConnected(CacheWordHandler.java:361)
  5457               Database  E  at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1101)
  5457               Database  E  at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1118)
  5457               Database  E  at android.os.Handler.handleCallback(Handler.java:725)
  5457               Database  E  at android.os.Handler.dispatchMessage(Handler.java:92)
  5457               Database  E  at android.os.Looper.loop(Looper.java:137)
  5457               Database  E  at android.app.ActivityThread.main(ActivityThread.java:5227)
  5457               Database  E  at java.lang.reflect.Method.invokeNative(Native Method)
  5457               Database  E  at java.lang.reflect.Method.invoke(Method.java:511)
  5457               Database  E  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
  5457               Database  E  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
  5457               Database  E  at dalvik.system.NativeStart.main(Native Method)
  5457             System.err  W  net.sqlcipher.database.SQLiteException: file is encrypted or is not a database
  5457             System.err  W  at net.sqlcipher.database.SQLiteDatabase.native_setLocale(Native Method)
  5457             System.err  W  at net.sqlcipher.database.SQLiteDatabase.setLocale(SQLiteDatabase.java:2072)
  5457             System.err  W  at net.sqlcipher.database.SQLiteDatabase.<init>(SQLiteDatabase.java:1938)
  5457             System.err  W  at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:871)
  5457             System.err  W  at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:899)
  5457             System.err  W  at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:127)
  5457             System.err  W  at info.guardianproject.cacheword.SQLCipherOpenHelper.getWritableDatabase(SQLCipherOpenHelper.java:60)
  5457             System.err  W  at info.guardianproject.notepadbot.NotesDbAdapter.open(NotesDbAdapter.java:130)
  5457             System.err  W  at info.guardianproject.notepadbot.NoteCipher.unlockDatabase(NoteCipher.java:162)
  5457             System.err  W  at info.guardianproject.notepadbot.NoteCipher.onCacheWordOpened(NoteCipher.java:506)
  5457             System.err  W  at info.guardianproject.cacheword.CacheWordHandler.checkCacheWordState(CacheWordHandler.java:310)
  5457             System.err  W  at info.guardianproject.cacheword.CacheWordHandler.access$100(CacheWordHandler.java:24)
  5457             System.err  W  at info.guardianproject.cacheword.CacheWordHandler$2.onServiceConnected(CacheWordHandler.java:361)
  5457             System.err  W  at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1101)
  5457             System.err  W  at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1118)
  5457             System.err  W  at android.os.Handler.handleCallback(Handler.java:725)
  5457             System.err  W  at android.os.Handler.dispatchMessage(Handler.java:92)
  5457             System.err  W  at android.os.Looper.loop(Looper.java:137)
  5457             System.err  W  at android.app.ActivityThread.main(ActivityThread.java:5227)
  5457             System.err  W  at java.lang.reflect.Method.invokeNative(Native Method)
  5457             System.err  W  at java.lang.reflect.Method.invoke(Method.java:511)
  5457             System.err  W  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
  5457             System.err  W  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
  5457             System.err  W  at dalvik.system.NativeStart.main(Native Method)
  5457          Choreographer  I  Skipped 78 frames!  The application may be doing too much work on its main thread.
  2306        ActivityManager  I  Displayed info.guardianproject.notepadbot/.NoteCipher: +1s419ms

Related issues

Related to CacheWord - Task #3132: nail down upgrade support Closed 03/26/2014

Also available in: Atom PDF