mrrfv / open-android-backup

Back up your device without vendor lock-ins, using insecure software or root. Supports encryption and compression out of the box. Works cross-platform.
http://openandroidbackup.me/
GNU General Public License v3.0
751 stars 40 forks source link

Retore totally fails #14

Closed knghtbrd closed 2 years ago

knghtbrd commented 2 years ago

During the restore process I'm getting a wall of errors like…

Extracting archive: ./AndroidManifest.xml
ERROR: ./AndroidManifest.xml
Can not open the file as archive

Extracting archive: ./DebugProbesKt.bin
ERROR: ./DebugProbesKt.bin
Can not open the file as archive

Extracting archive: ./META-INF/CERT.RSA
ERROR: ./META-INF/CERT.RSA
Can not open the file as archive

Extracting archive: ./META-INF/CERT.SF
ERROR: ./META-INF/CERT.SF
Can not open the file as archive

Extracting archive: ./META-INF/MANIFEST.MF
ERROR: ./META-INF/MANIFEST.MF
Can not open the file as archive

Extracting archive: ./META-INF/androidx.activity_activity.version
ERROR: ./META-INF/androidx.activity_activity.version
Can not open the file as archive

Extracting archive: ./META-INF/androidx.annotation_annotation-experimental.version
ERROR: ./META-INF/androidx.annotation_annotation-experimental.version
Can not open the file as archive

Extracting archive: ./META-INF/androidx.arch.core_core-runtime.version
ERROR: ./META-INF/androidx.arch.core_core-runtime.version
Can not open the file as archive

Extracting archive: ./META-INF/androidx.core_core.version
ERROR: ./META-INF/androidx.core_core.version
Can not open the file as archive

Extracting archive: ./META-INF/androidx.customview_customview.version
ERROR: ./META-INF/androidx.customview_customview.version
Can not open the file as archive

Extracting archive: ./META-INF/androidx.fragment_fragment.version
ERROR: ./META-INF/androidx.fragment_fragment.version
Can not open the file as archive

Extracting archive: ./META-INF/androidx.lifecycle_lifecycle-livedata-core.version
ERROR: ./META-INF/androidx.lifecycle_lifecycle-livedata-core.version
Can not open the file as archive

Extracting archive: ./META-INF/androidx.lifecycle_lifecycle-livedata.version
ERROR: ./META-INF/androidx.lifecycle_lifecycle-livedata.version
Can not open the file as archive

Extracting archive: ./META-INF/androidx.lifecycle_lifecycle-runtime.version
ERROR: ./META-INF/androidx.lifecycle_lifecycle-runtime.version
Can not open the file as archive

Extracting archive: ./META-INF/androidx.lifecycle_lifecycle-viewmodel.version
ERROR: ./META-INF/androidx.lifecycle_lifecycle-viewmodel.version
Can not open the file as archive

Extracting archive: ./META-INF/androidx.loader_loader.version
ERROR: ./META-INF/androidx.loader_loader.version
Can not open the file as archive

Extracting archive: ./META-INF/androidx.savedstate_savedstate.version
ERROR: ./META-INF/androidx.savedstate_savedstate.version
Can not open the file as archive

Extracting archive: ./META-INF/androidx.tracing_tracing.version
ERROR: ./META-INF/androidx.tracing_tracing.version
Can not open the file as archive

Extracting archive: ./META-INF/androidx.versionedparcelable_versionedparcelable.version
ERROR: ./META-INF/androidx.versionedparcelable_versionedparcelable.version
Can not open the file as archive

Extracting archive: ./META-INF/androidx.viewpager_viewpager.version
ERROR: ./META-INF/androidx.viewpager_viewpager.version
Can not open the file as archive

Extracting archive: ./META-INF/androidx.window_window-java.version
ERROR: ./META-INF/androidx.window_window-java.version
Can not open the file as archive

Extracting archive: ./META-INF/androidx.window_window.version
ERROR: ./META-INF/androidx.window_window.version
Can not open the file as archive

Extracting archive: ./META-INF/annotation-experimental_release.kotlin_module
--
Path = ./META-INF/annotation-experimental_release.kotlin_module
Type = lzma86

Would you like to replace the existing file:
  Path:     ./annotation-experimental_release
  Size:     10 bytes (1 KiB)
  Modified: 1981-01-01 01:01:02
with the file from archive:
  Path:     annotation-experimental_release
  Size:     4398046511360 bytes (4097 GiB)
? (Y)es / (N)o / (A)lways / (S)kip all / A(u)to rename all / (Q)uit? 
ERROR: Unexpected end of data : annotation-experimental_release

Sub items Errors: 1

Extracting archive: ./META-INF/app_release.kotlin_module
--
Path = ./META-INF/app_release.kotlin_module
Type = lzma86

ERROR: Unexpected end of data : app_release

Sub items Errors: 1

Extracting archive: ./META-INF/flutter_contacts_release.kotlin_module
--
Path = ./META-INF/flutter_contacts_release.kotlin_module
Type = lzma86

ERROR: Unexpected end of data : flutter_contacts_release

Sub items Errors: 1

Extracting archive: ./META-INF/kotlin-stdlib-common.kotlin_module
--
Path = ./META-INF/kotlin-stdlib-common.kotlin_module
Type = lzma86

ERROR: Data Error : kotlin-stdlib-common

Sub items Errors: 1

Extracting archive: ./META-INF/kotlin-stdlib-jdk7.kotlin_module
--
Path = ./META-INF/kotlin-stdlib-jdk7.kotlin_module
Type = lzma86

ERROR: Data Error : kotlin-stdlib-jdk7

Sub items Errors: 1

Extracting archive: ./META-INF/kotlin-stdlib-jdk8.kotlin_module
--
Path = ./META-INF/kotlin-stdlib-jdk8.kotlin_module
Type = lzma86

ERROR: Data Error : kotlin-stdlib-jdk8

Sub items Errors: 1

Extracting archive: ./META-INF/kotlin-stdlib.kotlin_module
--
Path = ./META-INF/kotlin-stdlib.kotlin_module
Type = lzma86

ERROR: Data Error : kotlin-stdlib

Sub items Errors: 1

Extracting archive: ./META-INF/kotlinx-coroutines-android.kotlin_module
--
Path = ./META-INF/kotlinx-coroutines-android.kotlin_module
Type = lzma86

ERROR: Data Error : kotlinx-coroutines-android

Sub items Errors: 1

Extracting archive: ./META-INF/kotlinx-coroutines-core.kotlin_module
--
Path = ./META-INF/kotlinx-coroutines-core.kotlin_module
Type = lzma86

ERROR: Data Error : kotlinx-coroutines-core

Sub items Errors: 1

Extracting archive: ./META-INF/kotlinx-serialization-core.kotlin_module
--
Path = ./META-INF/kotlinx-serialization-core.kotlin_module
Type = lzma86

ERROR: Data Error : kotlinx-serialization-core

Sub items Errors: 1

Extracting archive: ./META-INF/kotlinx-serialization-json.kotlin_module
--
Path = ./META-INF/kotlinx-serialization-json.kotlin_module
Type = lzma86

ERROR: Data Error : kotlinx-serialization-json

Sub items Errors: 1

Extracting archive: ./META-INF/services/kotlinx.coroutines.CoroutineExceptionHandler
ERROR: ./META-INF/services/kotlinx.coroutines.CoroutineExceptionHandler
Can not open the file as archive

Extracting archive: ./META-INF/services/kotlinx.coroutines.internal.MainDispatcherFactory
ERROR: ./META-INF/services/kotlinx.coroutines.internal.MainDispatcherFactory
Can not open the file as archive

Extracting archive: ./META-INF/window-java_release.kotlin_module
--
Path = ./META-INF/window-java_release.kotlin_module
Type = lzma86

ERROR: Unexpected end of data : window-java_release

Sub items Errors: 1

Extracting archive: ./META-INF/window_release.kotlin_module
--
Path = ./META-INF/window_release.kotlin_module
Type = lzma86

And that's where it ends:

Extracting archive: ./window_release
ERROR: ./window_release
Can not open the file as archive

Archives: 152
OK archives: 7
Can't open as archive: 123
Archives with Errors: 21
Archives with Warnings: 1

Warnings: 1

Open Errors: 1

Sub items Errors: 20
(B[?12l[?25h

The restoration doesn't actually happen from there. I just looked inside backup-tmp and there's tons of stuff, but there's also tons of stuff in the directory:

tjcarter@aki:~/Source/linux-android-backup/asuna$ ls
AndroidManifest.xml              kotlinx-coroutines-android
annotation                       kotlinx-coroutines-core
annotation-experimental_release  kotlinx-serialization-core
app_release                      kotlinx-serialization-json
assets/                          lib/
backup-tmp/                      linux-android-backup-06-30-2022-12-15-45.7z
classes.dex                      linux-android-backup-companion
collections                      linux-android-backup-companion.apk
coroutines                       META-INF/
DebugProbesKt.bin                NOTICES
flutter_contacts_release         NULL
internal                         ranges
kotlin/                          reflect
kotlin-stdlib                    res/
kotlin-stdlib-common             resources.arsc
kotlin-stdlib-jdk7               window-java_release
kotlin-stdlib-jdk8               window_release
kotlin-tooling-metadata.json

I've got some idea that maybe all of that is not supposed to be there? Anyway, it looks like I'm going to be awhile doing a messy manual restoration using the script as a guide. I had to reflash/erase everything. sigh

mrrfv commented 2 years ago

These files definitely shouldn't be there. The only explanation I can give you is that you've probably entered a directory as the location of the backup archive, causing 7-Zip to extract every single file in the folder. From what I can tell, these odd files you are seeing are the contents of linux-android-backup-companion.apk.

I need some more information before writing the fix - when the script asked you for the location of the backup archive, what did you enter?

knghtbrd commented 2 years ago

In both the backup and restore cases, I entered . for the location. In the extraction case, because it was suggested as a default (and because I had created a Dir and run the script from it seeing the usage of the script to backup)

Joseph

On Sun, Jul 3, 2022, at 07:08, mrrfv wrote:

These files definitely shouldn't be there. The only explanation I can give you is that you've probably entered a directory as the location of the backup archive, causing 7-Zip to extract every single file in the folder. From what I can tell, these odd files you are seeing are the contents of linux-android-backup-companion.apk.

I need some more information before writing the fix - when the script asked you for the location of the backup archive, what did you enter?

-- Reply to this email directly or view it on GitHub: https://github.com/mrrfv/linux-android-backup/issues/14#issuecomment-1173097400 You are receiving this because you authored the thread.

Message ID: @.***>

mrrfv commented 2 years ago

You need to provide the full location to the backup archive (in your case, it should be ~/Source/linux-android-backup/asuna/linux-android-backup-06-30-2022-12-15-45.7z) if you're restoring it.

knghtbrd commented 2 years ago

Good to know, thanks.

Might I suggest checking for a directory and looking to see if there are backup files in it and presenting a list the same way you do for the backup/restore menu? I think you should be detecting whether the supplied restore location is not an archive at least, but it seems like you have some option to do something cooler than that.

Joseph

On Sun, Jul 3, 2022, at 11:20, mrrfv wrote:

You need to provide the full location to the backup archive (in your case, it should be ~/Source/linux-android-backup/asuna/linux-android-backup-06-30-2022-12-15-45.7z) if you're restoring it.

-- Reply to this email directly or view it on GitHub: https://github.com/mrrfv/linux-android-backup/issues/14#issuecomment-1173148364 You are receiving this because you authored the thread.

Message ID: @.***>

mrrfv commented 2 years ago

Scanning for backups would definitely be cool, but for most users it would be impractical (for example, if they want to simply drag and drop the archive from a file manager or the backups are stored in a remote location, like a NAS or cloud storage). A simple check whether the specified location is a file should do the trick without complicating things too much.