jensstein / oandbackup

backup manager for android
Other
543 stars 198 forks source link

No more working on android 6 marshmallow #111

Open DocSniper opened 8 years ago

DocSniper commented 8 years ago

The backup folder are empty after backing up. There is just only a log in the folders.

The log contains: { "label": "Android system", "versionName": "6.0-70d092ff35", "versionCode": 23, "packageName": "android", "sourceDir": "\/system\/framework\/framework-res.apk", "dataDir": "\/data\/system", "lastBackupMillis": 1448979656174, "isEncrypted": false, "isSystem": true, "backupMode": 3 }

The logcat is: 12-01 15:20:47.974 I/ActivityManager(880): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=dk.jens.backup/.OAndBackup (has extras)} from uid 10009 on display 0 12-01 15:20:48.049 I/ActivityManager(880): Start proc 10355:dk.jens.backup/u0a334 for activity dk.jens.backup/.OAndBackup 12-01 15:20:48.459 I/ActivityManager(880): Displayed dk.jens.backup/.OAndBackup: +421ms 12-01 15:20:51.657 E/oandbackup(10355): .nomedia: error while reading logfile: org.json.JSONException: Value java.io.FileNotFoundException of type java.lang.String cannot be converted to JSONObject 12-01 15:20:56.034 I/oandbackup(10355): backup: Android system 12-01 15:20:56.174 I/oandbackup(10355): return: 0 / success

jensstein commented 8 years ago

are you running the latest release or have you tried the apk linked here:https://github.com/jensstein/oandbackup/issues/108?

could i get you to first verify that the directory listed as dataDir and the apk listed as sourceDir actually exist and comtain the proper files? if they do could you try manually copying them to the backup directory with cp -R as the root user (e.g. cp -R /data/data/dk.jens.backup /storage/emulated/0/oandbackups).

DocSniper commented 8 years ago

Tried your version from issue #108 and it is working fine. The version I had before which wasn't working on marshmallow was 0.2.10 from F-Droid. If you release a new version with the recent changes then I think this issue can be closed as fixed. Thanks a lot :-)

fajabird commented 8 years ago

Today I tried to restore a backup taken in cm12.1 with version 0.2.10 into cm13 (same device, just clean flashed cm13). Everything looked good, i.e. no errors but in fact only apks got restored, but all APP data was missing. Is this the same issue/reason?

jensstein commented 8 years ago

@fajabird is this the released version or the apk from the link in issue 108? @sniperle did you try both backing up and restoring and are both working for you now?

fajabird commented 8 years ago

I'm using the latest released version from f-droid.

jensstein commented 8 years ago

@fajabird okay, please try the newer apk then and see if you have the success as sniperle.

fajabird commented 8 years ago

Ok, basically I tried the same again like described above, but this time I used the version form issue 108, i.e. backup was created with version 0.2.10 on cm12.1 and I tried to restore with issue-108-version on cm13. First of all - it seems to make a difference, for one very basic app and e.g. WLAN-APs it did work - for all other apps: they crash when I try to start them. It seems like the app-data gets restored but is not right (permissions?)

jensstein commented 8 years ago

could i get you to send me a logcat with both a restore operation and a restored app crashing? and please run stat on the data directory of a restored app as the normal user (e.g. stat /data/data/dk.jens.backup). then do the same for a non-restored app (ideally the same app but reinstalled without using oab). also confirm that the files are where they should be by comparing the backed up archive with the restored files.

fajabird commented 8 years ago

restoring "connectbot":

12-02 22:21:26.726 253 2249 E ACDB-LOADER: Error: ACDB AudProc vol returned = -19 12-02 22:21:26.726 253 2249 E ACDB-LOADER: Error: ACDB AFE returned = -19 12-02 22:21:27.524 8507 8525 E Surface : getSlotFromBufferLocked: unknown buffer: 0xa9f77220 12-02 22:21:29.290 8507 8525 E Surface : getSlotFromBufferLocked: unknown buffer: 0xaee702d0 12-02 22:21:29.394 8664 8664 E su : SU from: u0_a83 12-02 22:21:31.024 1525 3342 E LocSvc_libulp: I/int ulp_msg_process_system_update(const UlpSystemEvent): systemEvent:5 12-02 22:21:31.025 1525 3342 E LocSvc_libulp: I/int ulp_msg_process_start_req(), at ulp state = 1 12-02 22:21:31.025 1525 3069 E LocSvc_api_v02: I/---> locClientSendReq line 1959 QMI_LOC_GET_BEST_AVAILABLE_POSITION_REQ_V02 12-02 22:21:31.029 1525 3218 E LocSvc_ApiV02: I/<--- void globalRespCb(locClientHandleType, uint32_t, const locClientRespIndUnionType, void ) line 114 QMI_LOC_GET_BEST_AVAILABLE_POSITION_REQ_V02 12-02 22:21:31.030 1525 3342 E LocSvc_libulp: I/int ulp_brain_process_zpp_position_report(const enum loc_sess_status, LocPosTechMask, UlpLocation ), report ZPP position to providers,report_position = 1 12-02 22:21:36.703 8698 8698 E su : SU from: u0_a83 12-02 22:21:37.382 3108 3119 E DataBuffer: Internal data leak within a DataBuffer object detected! Be sure to explicitly call release() on all DataBuffer extending objects when you are done with them. (internal object: com.google.android.gms.common.data.DataHolder@c74b9a1) 12-02 22:21:37.989 8729 8729 E su : SU from: u0_a83 12-02 22:21:38.622 8507 8525 E Surface : getSlotFromBufferLocked: unknown buffer: 0xaece7a60 12-02 22:21:40.051 8507 8753 E oandbackup: customlist0: error while reading logfile: org.json.JSONException: Value java.io.FileNotFoundException of type java.lang.String cannot be converted to JSONObject 12-02 22:21:40.166 8507 8525 E Surface : getSlotFromBufferLocked: unknown buffer: 0xa9f77900 12-02 22:21:44.942 8507 8525 E Surface : getSlotFromBufferLocked: unknown buffer: 0x9b24f1d0 12-02 22:21:46.644 253 2249 E ACDB-LOADER: Error: ACDB AudProc vol returned = -19 12-02 22:21:46.644 253 2249 E ACDB-LOADER: Error: ACDB AFE returned = -19

connectbot crashing upon first start:

12-02 22:21:50.452 253 2249 E ACDB-LOADER: Error: ACDB AudProc vol returned = -19 12-02 22:21:50.453 253 2249 E ACDB-LOADER: Error: ACDB AFE returned = -19 12-02 22:21:50.560 5637 5689 E Surface : getSlotFromBufferLocked: unknown buffer: 0xa770d9a0 12-02 22:21:50.601 8794 8794 E SQLiteLog: (14) cannot open file at line 31278 of [2ef4f3a5b1] 12-02 22:21:50.601 8794 8794 E SQLiteLog: (14) os_unix.c:31278: (13) open(/data/user/0/org.connectbot/databases/hosts) - 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: Failed to open database '/data/user/0/org.connectbot/databases/hosts'. 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:207) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:191) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:806) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:791) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:583) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:275) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:223) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at org.connectbot.util.HostDatabase.(HostDatabase.java:151) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at org.connectbot.HostListActivity.onCreate(HostListActivity.java:237) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.app.Activity.performCreate(Activity.java:6237) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2403) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2520) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.app.ActivityThread.-wrap11(ActivityThread.java) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.os.Handler.dispatchMessage(Handler.java:102) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.os.Looper.loop(Looper.java:148) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at android.app.ActivityThread.main(ActivityThread.java:5466) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at java.lang.reflect.Method.invoke(Native Method) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 12-02 22:21:50.602 8794 8794 E SQLiteDatabase: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: FATAL EXCEPTION: main 12-02 22:21:50.602 8794 8794 E AndroidRuntime: Process: org.connectbot, PID: 8794 12-02 22:21:50.602 8794 8794 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.connectbot/org.connectbot.HostListActivity}: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2450) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2520) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.app.ActivityThread.-wrap11(ActivityThread.java) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.os.Looper.loop(Looper.java:148) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5466) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: Caused by: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:207) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:191) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:806) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:791) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:583) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:275) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:223) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at org.connectbot.util.HostDatabase.(HostDatabase.java:151) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at org.connectbot.HostListActivity.onCreate(HostListActivity.java:237) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:6237) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2403) 12-02 22:21:50.602 8794 8794 E AndroidRuntime: ... 9 more 12-02 22:21:54.479 253 2249 E ACDB-LOADER: Error: ACDB AudProc vol returned = -19 12-02 22:21:54.479 253 2249 E ACDB-LOADER: Error: ACDB AFE returned = -19 12-02 22:21:54.496 1525 8026 E Surface : getSlotFromBufferLocked: unknown buffer: 0x937b1010 12-02 22:21:54.797 8818 8837 E SharedPreferencesImpl: Couldn't create directory for SharedPreferences file /data/user/0/org.connectbot/shared_prefs/WebViewChromiumPrefs.xml 12-02 22:21:54.808 8818 8818 E SysUtils: ApplicationContext is null in ApplicationStatus 12-02 22:21:54.848 8818 8818 E libEGL : validate_display:255 error 3008 (EGL_BAD_DISPLAY) 12-02 22:21:54.848 8818 8818 E libEGL : validate_display:255 error 3008 (EGL_BAD_DISPLAY) 12-02 22:21:54.940 8818 8842 E chromium: [ERROR:web_database_backend.cc(54)] Cannot initialize the web database: 1 12-02 22:21:54.941 8818 8818 E DataReductionProxySettingListener: No DRP key due to exception:java.lang.ClassNotFoundException: com.android.webview.chromium.Drp 12-02 22:21:55.018 242 242 E SELinux : avc: denied { find } for service=batteryproperties scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:healthd_service:s0 tclass=service_manager 12-02 22:21:55.770 8818 8851 E chromium: [ERROR:connection.cc(1075)] Cookie sqlite error 14, errno -2: unable to open database file, sql: -- sqlite3_open() 12-02 22:21:55.770 8818 8851 E chromium: [ERROR:connection.cc(1075)] Cookie sqlite error 14, errno -2: unable to open database file, sql: -- sqlite3_open() 12-02 22:21:55.773 8818 8846 E chromium: [ERROR:simple_backend_impl.cc(129)] Failed to create directory: /data/user/0/org.connectbot/cache/org.chromium.android_webview 12-02 22:21:55.774 8818 8846 E chromium: [ERROR:simple_backend_impl.cc(574)] Simple Cache Backend: wrong file structure on disk: /data/user/0/org.connectbot/cache/org.chromium.android_webview 12-02 22:21:55.776 8818 8847 E chromium: [ERROR:cache_util.cc(132)] Unable to move cache folder /data/user/0/org.connectbot/cache/org.chromium.android_webview to /data/user/0/org.connectbot/cache/old_org.chromium.android_webview_000 12-02 22:21:55.776 8818 8847 E chromium: [ERROR:cache_creator.cc(132)] Unable to create cache

stat

shell@bacon:/ $ stat /data/data/org.connectbot
File: `/data/data/org.connectbot' Size: 4096 Blocks: 8 IO Blocks: 4096 directory Device: b31ch/100d Inode: 295892 Links: 7 Access: (751/drwxr-x--x) Uid: (10084/ u0_a84) Gid: (10084/ u0_a84) Access: 2015-12-02 22:21:36.092999884 Modify: 2015-12-02 22:21:50.552999877 Change: 2015-12-02 22:21:50.552999877

root@bacon:/ # stat /data/user/0/org.connectbot/databases/hosts File: `/data/user/0/org.connectbot/databases/hosts' Size: 40960 Blocks: 80 IO Blocks: 4096 regular file Device: b31ch/100d Inode: 296601 Links: 1 Access: (600/-rw-------) Uid: (10091/ u0_a91) Gid: (10091/ u0_a91) Access: 2015-12-02 22:42:38.642999402 Modify: 2015-12-02 22:42:38.642999402 Change: 2015-12-02 22:45:06.672999344

root@bacon:/data/data/org.connectbot # ls -la total 56 drwxr-x--x 7 u0_a89 u0_a89 4096 2015-12-02 22:37 . drwxrwx--x 115 system system 4096 2015-12-02 22:37 .. drwxrwx--x 3 u0_a89 u0_a89 4096 2015-12-02 22:37 app_webview drwxrwx--x 2 u0_a89 u0_a89 4096 2015-12-02 22:37 cache drwxrwx--x 2 u0_a89 u0_a89 4096 2015-12-02 22:37 code_cache drwxrwx--x 2 u0_a89 u0_a89 4096 2015-12-02 22:37 databases lrwxrwxrwx 1 root root 34 2015-12-02 22:37 lib -> /data/app/org.connectbot-1/lib/arm drwxrwx--x 2 u0_a89 u0_a89 4096 2015-12-02 22:37 shared_prefs

root@bacon:/data/user/0/org.connectbot/databases # ls -la total 176 drwxrwx--x 2 u0_a95 u0_a95 4096 2015-12-02 22:57 . drwxr-x--x 6 u0_a95 u0_a95 4096 2015-12-02 22:57 .. -rwxrwx--x 1 u0_a95 u0_a95 40960 2015-12-02 22:57 hosts -rwxrwx--x 1 u0_a95 u0_a95 8720 2015-12-02 22:57 hosts-journal -rwxrwx--x 1 u0_a95 u0_a95 16384 2015-12-02 22:57 pubkeys -rwxrwx--x 1 u0_a95 u0_a95 8720 2015-12-02 22:57 pubkeys-journal

root@bacon:/data/user/0/org.connectbot # find . ./lib ./app_webview ./app_webview/Web Data ./app_webview/Web Data-journal ./app_webview/Cookies ./app_webview/Cookies-journal ./app_webview/Cache ./app_webview/Cache/index ./app_webview/Cache/index-dir ./app_webview/Cache/index-dir/the-real-index ./app_webview/Cache/1c480ca26f14a14a_0 ./app_webview/Cache/ace8b416d3ac07ef_0 ./cache ./cache/com.android.opengl.shaders_cache ./databases ./databases/hosts ./databases/hosts-journal ./databases/pubkeys ./databases/pubkeys-journal ./shared_prefs ./shared_prefs/WebViewChromiumPrefs.xml ./shared_prefs/org.connectbot_preferences.xml

starting connectbot after restore by helium-backup:

12-02 22:32:44.569 253 2249 E ACDB-LOADER: Error: ACDB AudProc vol returned = -19 12-02 22:32:44.569 253 2249 E ACDB-LOADER: Error: ACDB AFE returned = -19 12-02 22:32:46.749 5637 5689 E Surface : getSlotFromBufferLocked: unknown buffer: 0x9c8f8bb0 12-02 22:32:46.821 11976 11976 E MediaPlayer-JNI: JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0 12-02 22:32:46.822 11976 11976 E MediaPlayer-JNI: JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0 12-02 22:32:47.040 3051 3051 E RichInputConnection: Unable to connect to the editor to retrieve text. 12-02 22:32:49.634 3051 7049 E Surface : getSlotFromBufferLocked: unknown buffer: 0xa9f77950 12-02 22:32:51.315 11976 11993 E Surface : getSlotFromBufferLocked: unknown buffer: 0xa81ae570

shell@bacon:/ $ stat /data/data/org.connectbot File: `/data/data/org.connectbot' Size: 4096 Blocks: 8 IO Blocks: 4096 directory Device: b31ch/100d Inode: 295904 Links: 9 Access: (751/drwxr-x--x) Uid: (10088/ u0_a88) Gid: (10088/ u0_a88) Access: 2015-12-02 22:32:34.682999633 Modify: 2015-12-02 22:32:35.202999632 Change: 2015-12-02 22:32:35.202999632

root@bacon:/data/data/org.connectbot # ls -l total 56 drwx------ 4 u0_a88 u0_a88 4096 2015-12-02 22:32 app_webview drwxrwx--x 2 u0_a88 u0_a88 4096 2015-12-02 22:32 cache drwxrwx--x 2 u0_a88 u0_a88 4096 2015-12-02 22:32 code_cache drwx------ 2 u0_a88 u0_a88 4096 2015-12-02 22:32 databases drwxrwx--x 2 u0_a88 u0_a88 4096 2015-12-02 22:32 files lrwxrwxrwx 1 root root 34 2015-12-02 22:32 lib -> /data/app/org.connectbot-1/lib/arm drwxrwx--x 2 u0_a88 u0_a88 4096 2015-12-02 22:32 no_backup drwx------ 2 u0_a88 u0_a88 4096 2015-12-02 22:32 shared_prefs

root@bacon:/data/user/0/org.connectbot/databases # ls -la total 176 drwx------ 2 u0_a92 u0_a92 4096 2015-12-02 22:50 . drwxr-x--x 9 u0_a92 u0_a92 4096 2015-12-02 22:50 .. -rw-rw---- 1 u0_a92 u0_a92 40960 1970-01-17 18:54 hosts -rw------- 1 u0_a92 u0_a92 8720 1970-01-17 18:54 hosts-journal -rw-rw---- 1 u0_a92 u0_a92 16384 1970-01-01 01:00 pubkeys -rw------- 1 u0_a92 u0_a92 8720 1970-01-01 01:00 pubkeys-journal

fajabird commented 8 years ago

I tried to mimic the file permissions in /data/data/org.connectbot which I get form helium-backup - but still was not able to launch the app.

fajabird commented 8 years ago

maybe better as a file: log.txt

jensstein commented 8 years ago

it seems strange that stat reports the permissions of the hosts database as 600 while ls reports it as 771. also with different uid and gid. (unless they have been changed between running the two commands - the timestamps are not quite the same). i'll see if i can get android 6 on one of my own devices soon so i can work on this properly. i the meantime i'll encourage you to experiment and tell me if you have any progress.

fajabird commented 8 years ago

Yes - please ignore the timestamps - I did the tests twice and on the first run I only recorded the stats and on the second run I did ls -l. As you can see from the ls results the permissions are different, but even when I modify them manually to the same of the working version its still does not work.

fajabird commented 8 years ago

I think I found the problem: SElinux! When I disable it via "setenforce 0" than I can restore and start the apps. Some of them are still running after re-enabling SElinux, some of them require SElinux to stay disabled.

fajabird commented 8 years ago

Over at XDA some people noticed the same for Titanium-Backup: http://forum.xda-developers.com/google-nexus-5/help/questions-titanium-backup-t3225002/post63299455#post63299455

fajabird commented 8 years ago

Solution is much simpler than I thought: do a "restorecon -R /data/data/PATH TO APP-DATA" after each app restore, or alternatively (but slower) "restorecon -R /data/data/*" for all apps at once.

DocSniper commented 8 years ago

Yes, for sure the selinux rights.

after restoring: u:object_r:app_data_file:s0 counters.xml u:object_r:app_data_file:s0 me.tsukanov.counter_preferences.xml

as it should be: u:object_r:app_data_file:s0:c512,c768 counters.xml u:object_r:app_data_file:s0 me.tsukanov.counter_preferences.xml

Backing up the selinux rights and restoring them with "chcon" is probably the best way.

jensstein commented 8 years ago

good work you guys :) here is a temporary apk with the restorecon command: https://drive.google.com/file/d/0B0bNUNWd2wPPMUVmMmFTZ2pRcGM/view?usp=sharing (untested, so please report if it doesn't work)

i wonder if restorecon or chcon is the best option. backing up the rights and restoring with chcon would be the most faithful option but it would probably fail when restoring between systems with different selinux settings. with restorecon any custom selinux settings would be lost because it restores the defaults. and then the question is whether there are any conceivable cases where users have custom set the selinux contexts of individual files. the best option would probably be to offer a choice to the user but i think i might go with restorecon at first.

fajabird commented 8 years ago

Works like a charm. Thank you. Time for a new release? I think backing up the selinux contexts is not necessary and too complicated.

Am 5. Dezember 2015 09:20:38 MEZ, schrieb jensstein notifications@github.com:

good work you guys :) here is a temporary apk with the restorecon command: https://drive.google.com/file/d/0B0bNUNWd2wPPMUVmMmFTZ2pRcGM/view?usp=sharing (untested, so please report if it doesn't work)

i wonder if restorecon or chcon is the best option. backing up the rights and restoring with chcon would be the most faithful option but it would probably fail when restoring between systems with different selinux settings. with restorecon any custom selinux settings would be lost because it restores the defaults. and then the question is whether there are any conceivable cases where users have custom set the selinux contexts of individual files. the best option would probably be to offer a choice to the user but i think i might go with restorecon at first.


Reply to this email directly or view it on GitHub: https://github.com/jensstein/oandbackup/issues/111#issuecomment-162160491

Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.

jensstein commented 8 years ago

great :) yes, it probably is time for a release sometime soon. thanks for reporting and testing.

takiainen commented 8 years ago

Need to add here, that this debug version of oandbackup works with Slimsaber MM rom, but not with Darkobas MM rom. Could it be because of selinux state? It is permissive in Slimsaber and enforcing in Darkobas. In the latter the oandbackup app starts, but it remains grey - it doesn't show the list of apps. Clicking "refresh" doesn't do anything. Settings leads to FC.

jensstein commented 8 years ago

@takiainen no, that probably doesn't have anything to do with selinux. at least not in the same way as described here. could i get you to open two new issues for these problems? please give me a logcat for the force closing problem and oab's own error log (oandbackups.log) for the first problem if there is anything in it.

takiainen commented 8 years ago

@jensstein Thanks for your reply. Didn't want to go back to Darkobas anymore, so tried it with another CM13 rom: sultanxda's version. This time oab starts fine, but complains that busybox is missing. After installing it oab-debug works fine. Maybe Darkobas didn't have busybox either? Well just guessing.

Im just slightly worried about this busybox, since I don't really understand what it is, and now it has root access to my device. It's not probably open source either? No way to know if it does something suspicious..

DocSniper commented 8 years ago

That's right busybox is no more included in cyanogenmod they switched to toybox recently.

http://review.cyanogenmod.org/#/c/119819/

We are discussing this problem in issue https://github.com/jensstein/oandbackup/issues/116

jensstein commented 8 years ago

yes, busybox should not be needed if your android version has toybox. the next release of oab will have autodetection of toybox. and you can be absolutely reassured that busybox is not malicious. it is open source and you can compile it yourself if you want to be sure that it does what you can read in the code. its website is here: https://busybox.net/ and oab's readme has instructions for cross-compiling. actually, busybox has famously been the center of a number of lawsuits regarding violations of the gpl license.

but a missing busybox still wouldn't have caused the grey and missing app list or the force close. i rather think it's because the rom developers are doing something strange because there have never been reports of force closing in the settings as far as i remember. it would have been interesting to know the cause.

also, please verify that both backing up and restoring actually work as expected on android 6 - the exit status and message from oab might not reflect the true state of the restored app. it would be very valuable to fix the worst bugs before the next release.

dradux commented 8 years ago

Just a note for others out there who get a "couldn't find busybox" when launching oab on CM13, I fixed this by going to Preferences > busybox and specifying the path to toybox (on my device, the path was /system/bin/toybox) If you dont know the path to toybox you can get it by opening a terminal on your phone and typing which toybox. Put the path returned in the busybox Preferences item in oab and you should be back to a working oab.

mvglasow commented 8 years ago

@dradux There's an even easier way: just enter toybox in Preferences, without a path. No need to mess with a terminal :-)

The next release will default to toybox on API 23 (Marshmallow) and up – this was added in https://github.com/jensstein/oandbackup/commit/32bc079f1e4dc205c82b3de7d4b99d7e1128982d, which was committed after the (current) 0.2.11 release.

fnorf commented 8 years ago

No luck here. I made backups on Android 4.0.2 with the latest F-Droid version of oandbackup, now I am on CM13, Android 6. I can only restore APPs, they do not see their data.

I tried the apk from F-Droid, https://drive.google.com/file/d/0B0bNUNWd2wPPMUVmMmFTZ2pRcGM/view?usp=sharing and https://drive.google.com/file/d/0B0bNUNWd2wPPR2ZYZjcwZmJxNnM/view?usp=sharing . I set selinux to permissive. I enabled "external data" in oandbackup. Also tried manual restorecon after restore.

My backups come from an SD card.

edit: I moved files off my SD card, let CM13 format it as "internal storage" then copied the oandbackup directory back (accidentally all subdirs into /sdcard/). I now restored one app and rebooted immediately after. The app and its data were properly restored! I will test more to find what exactly works and what not. Stay tuned.

edit2: Works fine without rebooting. SELinux is strict btw.

edit3: Works fine with the oandbackup apk from F-Droid!

fnorf commented 8 years ago

Wrapping up my previous comment:

I moved my oandbackup directory off the phone's sdcard. I let CM13/Android6 format the sdcard for use as pretend internal storage. I copied my backup files back using adb push (accidentally with all the subdirectory straight into /sdcard/). I installed oandbackup 0.2.11 from F-Droid. I set it's directory to /sdcard/ and now I can restore things perfectly fine.

Maybe the adb push fixed some permissions?

henrytom1703 commented 6 years ago

Hello all. I'm using restorecon to restore /data/data/com.test.app. But It's not working . Can you help me fix error below:

SELinux:  Could not look up information for package com.test.app, cannot restorecon Operation_2/1530150187700.wa.
SELinux: Could not set context for /data/data/com.test.app/Operation_2/1530150187700.wa:  Success
restorecon: restorecon failed: /data/data/com.test.app

My step backup/restore data on rooted device: Backup

  1. copy data /data/data/com.test.app /data/app/com.test.app-1 -> app.tgz
  2. Uninstall app

Restore data:

  1. unzip app.tgz -> copy data to /data/data/com.test.app /data/app/com.test.app-1
  2. restorecon -FRv /data/data/com.test.app

Thanks,

DocSniper commented 6 years ago

Did you install the APP/APK first ?

Tested it on an already installed App and works here: screenshot_terminal

henrytom1703 commented 6 years ago

Hell0 @sniperle . Thanks for supported. I was tried reinstall base.apk in folder /data/app/com.test.app-1 But It's not working here my error:

adb install D:/backup/data/app/com.test.app-1/base.apk
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]

Can you help me fix this issue? Thanks,

DocSniper commented 6 years ago

Is your app signed ?
Take a look at this and try if it helps. https://stackoverflow.com/questions/15636396/failure-install-parse-failed-no-certificates-when-attempting-to-install-apk-to

henrytom1703 commented 6 years ago

Hello @jensstein
Thanks for supported. I was fixed error above. But I have a new issues with apps has many background process. Here my step: Backup

  1. Kill all process: pm disable
  2. copy data /data/data/ /data/app/-1 -> app.tgz
  3. Uninstall app

Restore data:

  1. install apk /data/app/-1/base.apk
  2. unzip app.tgz -> copy data to /data/data/ /data/app/-1
  3. restorecon -FRvn /data/data/com.test.app
  4. open app -->Crash app

Here log crashed app when open app after restore: 06-30 14:26:57.501 21785-22265/? E/DatabaseUtils: Writing exception to parcel java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/fs_id from pid=15113, uid=10108 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission() at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:610) at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:485) at android.content.ContentProvider$Transport.query(ContentProvider.java:216) at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112) at android.os.Binder.execTransact(Binder.java:461) 06-30 14:26:59.692 1579-1934/? E/ConnectivityService: RemoteException caught trying to send a callback msg for log.txt on Android version 6.0 Can you help me fix this issue. Thanks

henrytom1703 commented 6 years ago

Hello @sniperle Can you try backup/restore with app name in log.txt file? Thanks

DocSniper commented 6 years ago

It can't work as long as you use the -n parameter with restorecon. Use it without -n: restorecon -FRv ...

See here, -n (-v) does a test run and only shows what would be changed: http://man7.org/linux/man-pages/man8/restorecon.8.html

henrytom1703 commented 6 years ago

Hello @jensstein Do you know how to kill all process, services related apps before backup data. I think It can be cause of crashes app after restore?. Because . Sometimes, data backup can be restore successful with rate 10% (1 success, 9 failure)/ 10 backup app times Thanks

ildar commented 6 years ago

You forgot chown

henrytom1703 commented 6 years ago

hello @ildar chown?. how to use chown in backup/restore? Can you describe more details? Thanks

ildar commented 6 years ago

Restoring requires chown folders and files.

Run ls -ln /data/data/ or without n to figure out

henrytom1703 commented 6 years ago

hello all. Do you know why I cannot run a file executable with direct command: adb shell ./data/local/tmp/executable But It's can be working when i do steps bellow:

  1. adb shell
  2. ./data/local/tmp/executable -->working ok Thanks
ildar commented 6 years ago

This is rough offtopic here. Would you contact me privately? I'll try to help you

henrytom1703 commented 6 years ago

Thanks @ildar . I sent an issue to ildar.xxxxxxx@gmail.com email for you. can you help me thanks.