[DEPRECATED] Migrator - Android Backup Solution and Data Migration Utility

Search This thread

totalnoob34

Senior Member
It doesn't wipe /system, only /data. That's done while preserving most of the useful data you would want to keep (i.e., contacts, WI-FI networks, call log, Magisk modules, adoptable storage keys, and much more.).

There's one thing I need to know before enabling the 'wipe' feature by default: "what's left in /data after a TWRP factory reset (when data is encrypted)".

Someone who uses encryption would have to make a nandroid backup, save it somewhere else (OUT of /data), then wipe (not format) /data (with TWRP) and copy everything left (except /data/media) to /data/media/somefolder, so that we can check whether any encryption key is there. If there's one, you can already imagine what would happen if it's not preserved... everything in /data (inc. /data/media) would be lost!

I understand.

I just tried doing a ROM flash using adk with wipe enabled. The order of flashing was:

  • adk (latest, I see it outputs what it wipes)
  • ROM (which happens to include Magisk 16.6, is that a problem?)
  • Gapps

I then wiped /cache and dalvik, and rebooted. First off, I didn't go through the usual setup wizard, is that normal? My settings were preserved (it's RR, so all its tweaks, background, etc), as well as Magisk modules.
Being noauto disabled, I expected applications to be automatically restored, but nothing was happening. So after a couple minutes I opened adk from the shell, and tried restoring packages that way. $e/adk/backups had not been renamed to backups.old, if that is relevant. To avoid accidental overwrites, I renamed it myself.

Anyway, trying to restore app/data (option 3) resulted in the following error:

Code:
(i) Input pattern(s) to match (i.e., sp.*fy or duk|faceb|whats. A dot matches all)... wiki

Restoring apps+data...
- org.wikipediaError: Can't open non-file: /mnt/media_rw/8580-1BEA/adk/backups.old/apk/org.wikipedia.apk
Error: java.lang.IllegalArgumentException: Unknown package: org.wikipedia

So I thought, fine, I enabled wipe and something must've survived that it shouldn't have. I then proceeded to perform a TWRP factory reset, ran through the setup wizard, installed adk via Magisk Manager, and tried restoring apps this way. No luck, still.

I'm not sure what I did wrong, I assume something went wrong with the restore process. Fear not, I pulled main.log from /data/media/adk/logs, it's attached to this post.

EDIT: I'm available to perform additional tests, feel free to PM me.
 

Attachments

  • main.log
    84 KB · Views: 10
Last edited:
  • Like
Reactions: Sander9847 and VR25

VR25

Senior Member
Apr 20, 2013
2,015
4,931
github.com
@totalnoob34, the built-in Magisk is fine.

Your settings, inc. setup wizard were preserved. That's good.

Now, looking at the log, the first thing which stands out is, your folders in /data/app are suffixed by -2OsxMlVF1Ckjp370OlVsjg==, so that the standard "/data/app/com.google.android.gms-NUMBER" is instead "/data/app/com.google.android.gms-2OsxMlVF1Ckjp370OlVsjg==". That's a major issue!

Is this a Resurrection Remix thing?

Also, did you check whether your apps+data were actually backed up to <external storages>/adk/backups?

BTW, I appreciate your willingness to perform further testing. Thanks.
 
Last edited:
  • Like
Reactions: totalnoob34

totalnoob34

Senior Member
@totalnoob34, the built-in Magisk is fine.

Your settings, inc. setup wizard were preserved. That's good.

That's good to know.

Now, looking at the log, the first thing which stands out is, your folders in /data/app are sufixed by -2OsxMlVF1Ckjp370OlVsjg==, so that the standard "/data/app/com.google.android.gms-NUMBER" is instead "/data/app/com.google.android.gms-2OsxMlVF1Ckjp370OlVsjg==". That's a major issue!

Is this a Resurrection Remix thing?

I honestly have no idea. I can type stuff in the terminal, but I don't dig deeper than that. I suspect it's more an issue with my install, but being my G5 very poorly mantained it could be the ROM's fault as well. I just reinstalled the same ROM, and sure enough the folders in /data/app are all padded with the same -*== string. I'm moving to LOS, I'll see if the situation changes.

What you're saying is that it's installed ROM's fault, right?

Also, did you check whether your apps+data were actually backed up to <external storages>/adk/backups?

Yes, all the apks + appdata were backed up in $e/adk/backups. Do you happen to know why adk didn't rename the folder to backup.old on its own? When is it supposed to do that again?

BTW, I appreciate your willingness to perform further testing. Thanks.

That's no problem. It's also in my interest to have this module as stable as possible. The concept is an ablsolute game changer.
 

VR25

Senior Member
Apr 20, 2013
2,015
4,931
github.com
I had an old install of adk which wasn't working for me, so I uninstalled it. There is still a folder /media/adk with some files in it.
I can't delete these files even using a root explorer or the terminal with su. Anyone knows what's causing this?
Is the path really "/media/adk" instead of "/data/media/adk"? If so, that's crazy! I wonder how that folder would get there...
Anyway, if that's the case, run su -c mount -o remount,rw / && rm -rf /media/adk && mount -o remount,ro /.

What you're saying is that it's installed ROM's fault, right?
Yes, and that string is the issue.

Yes, all the apks + appdata were backed up in $e/adk/backups. Do you happen to know why adk didn't rename the folder to backup.old on its own? When is it supposed to do that again?
The renaming from "backups" to "backups.old" happens right after apps+data migration and before "wipe" kicks in. Why that failed is a mad question mark. The apps+data migration subshells likely crashed due to that odd suffix. However that shouldn't have interfered with "backups" migration at all. A TWRP log would reveal the missing pieces of this little puzzle.

That's no problem. It's also in my interest to have this module as stable as possible. The concept is an ablsolute game changer.
That's good to know.

P.S., I suppose your APKs were backed up with that strange suffix. This could be the reason why the manual restore failed as well.
 
Last edited:

totalnoob34

Senior Member
Is the path really "/media/adk" instead of "/data/media/adk"? If so, that's crazy! I wonder how that folder would get there...
Anyway, if that's the case, run su -c mount -o remount,rw / && rm -rf /media/adk && mount -o remount,ro /.

Yes, and that string is the issue.

The renaming from "backups" to "backups.old" happens right after apps+data migration and before "wipe" kicks in. Why that failed is a mad question mark. The apps+data subshell has likely crashed due to that odd suffix. However that shouldn't interfere with backups migration at all. A TWRP log would reveal the missing pieces of this little puzzle.

That's good to know.

P.S., I suppose your APKs were backed up with that strange suffix. This could be the reason why the manual restore failed as well.

I just booted a freshly installed LOS, and a ls in /data/app yields

Code:
com.topjohnwu.magisk-DnuoiSwDBMDIeIAmI2gAiw==

I'm not sure what to make of all of this, but I'm starting to wonder if all the builds for my device (LG G5, variant H850) have that suffix. I suppose you could account for this variation, it's entirely possible some other device has that funky business going on.

Can I still pull the TWRP log? I've done other wipes in the meanwhile. Where would I find it?
 

VR25

Senior Member
Apr 20, 2013
2,015
4,931
github.com
Sorry, I am stupid! Was trying to delete in some /emulated folder.
No worries!

It's the same for me on OnePlus 3T with official Lineage 15.1.
My guess is that the suffixes might be related to the data encryption.
The encryption, of course... that suffix could be a side effect of it. ?

I'm not sure what to make of all of this, but I'm starting to wonder if all the builds for my device (LG G5, variant H850) have that suffix. I suppose you could account for this variation, it's entirely possible some other device has that funky business going on.
Currently working on that...

Can I still pull the TWRP log? I've done other wipes in the meanwhile. Where would I find it?
You would have to go through the whole process over again...
Install an app or two, then perform the adk migration/wipe.
Before rebooting into system, grab /cache/recovery/*log* and/or /tmp/recovery.log or just go to TWRP "advanced" section > "copy logs to sdcard". See of you can also get a fresh main.log for comparison.

EDIT: @totalnoob34, install the attached zip from TWRP and use it instead of the latest on the repo. Run touch /data/.adk before the first flashing (forced upgrade). I changed some stuff to handle that odd suffix and stop right away, with a more descriptive error message if apps+data migration fails.
 

Attachments

  • adk-2018.9.13-1-DEBUG.zip
    735.8 KB · Views: 12
Last edited:

totalnoob34

Senior Member
Currently working on that...

You would have to go through the whole process over again...
Install an app or two, then perform the adk migration/wipe.
Before rebooting into system, grab /cache/recovery/*log* and/or /tmp/recovery.log or just go to TWRP "advanced" section > "copy logs to sdcard". See of you can also get a fresh main.log for comparison.

Will do. I'll do a standard TWRP factory reset. In the meanwhile, I also posted in my ROM's thread to see what the developer says.

EDIT: @VR25, the recovery.log file is attached. I'm reinstalling adk right now, main.log will follow shortly.
EDIT2: main.log is attached as well.

EDIT3: @VR25, please make a post, this editing thing is complicated)

I used the DEBUG build you posted, this is what I did:

  • Installed adk DEBUG (I'll refer to it as adk from now on) in magisk, after forcing the update.
  • Rebooted to TWRP, flashed adk again, no error prompts. I see that apks in $e/adk/backups/apk no longer have the infamous trailing string.
  • Standard factory reset.
  • Reboot to system, installed adk, and tried restoring the apps I had.

Now apps restore fine, and no additional prompts are printed. However, appdata doesn't seem to be restored. I did some additional testing with the ROM booted, and adk will restore an app fine if its data is wiped first, but it ignores (Solid Explorer) or corrupts (Titanium Backup, crashing) its data.

Definitely a step forward, I pulled main.log and attached it as mainNew.log.
 

Attachments

  • recovery.log
    24.6 KB · Views: 2
  • main.log
    77.7 KB · Views: 2
  • mainNew.log
    76.9 KB · Views: 2
Last edited:
  • Like
Reactions: godofsalt

VR25

Senior Member
Apr 20, 2013
2,015
4,931
github.com
EDIT3: @VR25, please make a post, this editing thing is complicated)
Indeed...

Now apps restore fine, and no additional prompts are printed. However, appdata doesn't seem to be restored. I did some additional testing with the ROM booted, and adk will restore an app fine if its data is wiped first, but it ignores (Solid Explorer) or corrupts (Titanium Backup, crashing) its data.

Definitely a step forward, I pulled main.log and attached it as mainNew.log.
Nice! We're getting there. Now I need to take a look at your /data/system/packages.xml and packages.list files, respectively. Could you upload these? Thanks.

BTW, you're still using encryption, right?

In order to speed up the debugging process and fully support encrypted data as soon as possible, I may have to encrypt my own data. Unfortunately this takes a while and I only have a single device in hand. Will see once it's "safe" to disconnect from the word for a few hours...
 
  • Like
Reactions: totalnoob34

totalnoob34

Senior Member
Indeed...

Nice! We're getting there. Now I need to take a look at your /data/system/packages.xml and packages.list files, respectively. Could you upload these? Thanks.

They're attached. I renamed *.list to *.list.zip so that xda would upload it.

BTW, you're still using encryption, right?

No, I never was.

In order to speed up the debugging process and fully support encrypted data as soon as possible, I may have to encrypt my own data. Unfortunately this takes a while and I only have a single device in hand. Will see once it's "safe" to disconnect from the word for a few hours...

I get that, I'm doing this troubleshooting on my daily driver /: I don't unfortunately have any other device at hand, otherwise I'd be delighted to do that on it.
 

Attachments

  • packages.xml
    626.3 KB · Views: 2
  • packages.list.zip
    16.1 KB · Views: 4
  • Like
Reactions: VR25

totalnoob34

Senior Member
pkgName[-suffix]
@totalnoob34, could you confirm there are no such trailing strings anywhere in /data/data?

Also, where's the wizard.log file? :p

Nope, no trailing edges:

Code:
h1:/ # cd /data/data/
h1:/data/data # ls
android                                com.android.inputdevices                com.android.vpndialogs                   com.vzw.apnservice
com.android.apps.tag                   com.android.inputmethod.latin           com.android.vzwomatrigger                lineageos.platform
com.android.backupconfirm              com.android.keychain                    com.android.wallpaper.livepicker         org.codeaurora.ims
com.android.bips                       com.android.location.fused              com.android.wallpaperbackup              org.lineageos.audiofx
com.android.bluetooth                  com.android.managedprovisioning         com.android.wallpapercropper             org.lineageos.eleven
com.android.bluetoothmidiservice       com.android.messaging                   com.android.wallpaperpicker              org.lineageos.jelly
com.android.calculator2                com.android.mms.service                 com.android.webview                      org.lineageos.lineageparts
com.android.calendar                   com.android.mtp                         com.google.android.apps.turbo            org.lineageos.lineagesettings
com.android.calllogbackup              com.android.nfc                         com.google.android.backuptransport       org.lineageos.lockclock
com.android.captiveportallogin         com.android.pacprocessor                com.google.android.configupdater         org.lineageos.overlay.accent.black
com.android.carrierconfig              com.android.phone                       com.google.android.ext.services          org.lineageos.overlay.accent.blue
com.android.carrierdefaultapp          com.android.printservice.recommendation com.google.android.ext.shared            org.lineageos.overlay.accent.brown
com.android.cellbroadcastreceiver      com.android.printspooler                com.google.android.feedback              org.lineageos.overlay.accent.cyan
com.android.certinstaller              com.android.providers.blockednumber     com.google.android.gms                   org.lineageos.overlay.accent.green
com.android.companiondevicemanager     com.android.providers.calendar          com.google.android.gms.setup             org.lineageos.overlay.accent.orange
com.android.contacts                   com.android.providers.contacts          com.google.android.googlequicksearchbox  org.lineageos.overlay.accent.pink
com.android.cts.ctsshim                com.android.providers.downloads         com.google.android.gsf                   org.lineageos.overlay.accent.purple
com.android.cts.priv.ctsshim           com.android.providers.downloads.ui      com.google.android.hiddenmenu            org.lineageos.overlay.accent.red
com.android.defcontainer               com.android.providers.media             com.google.android.onetimeinitializer    org.lineageos.overlay.accent.yellow
com.android.deskclock                  com.android.providers.settings          com.google.android.packageinstaller      org.lineageos.overlay.black
com.android.development                com.android.providers.telephony         com.google.android.partnersetup          org.lineageos.overlay.dark
com.android.dialer                     com.android.providers.userdictionary    com.google.android.setupwizard           org.lineageos.profiles
com.android.documentsui                com.android.proxyhandler                com.google.android.syncadapters.calendar org.lineageos.recorder
com.android.dreams.basic               com.android.sdm.plugins.sprintdm        com.google.android.syncadapters.contacts org.lineageos.settings.device
com.android.dreams.phototable          com.android.server.telecom              com.google.android.tts                   org.lineageos.settings.doze
com.android.egg                        com.android.settings                    com.keramidas.TitaniumBackup             org.lineageos.setupwizard
com.android.email                      com.android.sharedstoragebackup         com.motricity.verizon.ssodownloadable    org.lineageos.snap
com.android.emergency                  com.android.shell                       com.qualcomm.qcrilmsgtunnel              org.lineageos.trebuchet
com.android.externalstorage            com.android.smspush                     com.qualcomm.qti.telephonyservice        org.lineageos.updater
com.android.facelock                   com.android.statementservice            com.qualcomm.timeservice                 org.lineageos.weather.provider
com.android.gallery3d                  com.android.stk                         com.quicinc.cne.CNEService               pl.solidexplorer2
com.android.hotwordenrollment.okgoogle com.android.storagemanager              com.svox.pico                            qualcomm.com.vzw_msdc_api
com.android.hotwordenrollment.tgoogle  com.android.systemui                    com.topjohnwu.magisk
com.android.hotwordenrollment.xgoogle  com.android.terminal                    com.verizon.vzwavs
com.android.htmlviewer                 com.android.vending                     com.vzw.apnlib
h1:/data/data #


I attached wizard.log. You're needy, though!
 

Attachments

  • wizard.log
    95.5 KB · Views: 4

totalnoob34

Senior Member
Found out all I needed to know about the sneaky trailing strings, and exactly how to handle these.

I can make the necessary changes to the manual restore part fast.

The automatic mechanism, on the other hand, will take some time.

Within the next 24 hours or so, a new version should be up.

That's very impressive. I'll check out the updated version when it hits the repo.

Thanks a lot for your dedication, this community needs people like you. Kudos, man.

EDIT: If you have the manual-only version on hand, please post it. I've set up a script and renamed the apks as their data folders, and I'm curious to see if the apps finally restore correctly before restoring the old TBK way.
 
Last edited:
  • Like
Reactions: VR25

Sander9847

Senior Member
Mar 30, 2015
518
259
Wow this seems like a great project!!
While reading the least pages found out I have the same problem; the weird strings on RR even though my rom was never encrypted.
Really looking forward to using/testing this once new build is out ?
 

Attachments

  • Screenshot_MiXplorer_20180914-143610.jpg
    Screenshot_MiXplorer_20180914-143610.jpg
    192.3 KB · Views: 213

Top Liked Posts

  • There are no posts matching your filters.
  • 76
    31
    Reserved for jokes.
    20
    Everyone who claims their data has been lost, please check whether it is in /data/media/adk/.appData.

    I'm not here to blame you, but I even wrote "app data backup is RECOMMENDED" and clearly enough, the last word in that line is capitalized. Besides, why wouldn't you just backup your data before trying something that moves it around?

    Ok, nuff yelling. I assure you this works (for me at least) and I've tested it multiple times before publishing. As a rule, I don't post anything which hasn't worked flawlessly at least on my device. When posting, warnings are always included and clearly visible.

    Now, back to the main subject. If your data is in the aforementioned folder, then it is not lost. All you have to do is reboot into recovery, go to terminal and run "mv -f /data/media/adk/.appData/* /data/data" whithout quotes. And of course, uninstall or disable adk with Magisk Manager for Recovery Mode.

    If it is not clear by now (even though that's in the README), no app data is moved to the sdcard. Besides being dangerous, that would take ages and be extremely inefficient. Did I say dangerous yes? Good. App data goes to /data/media/adk/.appData. Since that's still in internal storage, the moving process is executed in a breeze (could be well less than 10 seconds). What goes to the sdcard (if it's available within the 90 seconds timeout) are APK copies. If no sdcard is found, APK backups are stored at /data/media/adk/apksBkp.

    Last, I haven't tried this module on Magisk v16.7. I'm currently on 16.6 and everything is going fine. Don't look at anything here as insensitive and/or poorly tested, as that couldn't be farther from the truth. I'm here to provide useful tools and support. However, I cannot guarantee those work for everyone, considering all which is involved. Thus, disclaimers/warnings are never unseen.
    15
    @qqzwc, the idea is great. I've actually thought about that before building this module.
    The only issue with your implementation is that system obliterates any data which is not associated to an APK. In other words, target apps must be installed BEFORE the restore operation.
    It's still possible to make this work, though.
    All you want is a simpler version of adk, which automatically does all the work by default (without keeping app data in /data/media at all times). With one addition, of course... the data migration flashable zip -- used to preserve app data and automatically wipe /data (excluding obvious files/folders) afterwards.
    Upon a fresh start, adk kicks in and restores all APK's plus data.
    I can certainly implement that as an alternative to the default working mode. Are we on the same page so far?

    Regarding extended support, adk is built to work on any ARM/x86 device (64bit included) with Magisk up and running (regardless of Androids version).


    To all,
    Bootloops? Please, provide logcats and all logs in /data/media/adk/logs. Thanks.

    P.S., a new version is up. ;)

    **2018.8.28 (201808280)**
    - Protected data and respective APK's are automatically backed up to largest_external_partition/adk/backups (fallback -- /data/media/adk/backups)
    - Removed 'rollback' executable (obsolete)
    - Support for automatic (scheduled) as well as on-demand incremental backups
    - Magisk module template 1500
    - Migrate app data to '/data/media/adk/appdata'
    - More efficient APK backups
    - Restrict app data permissions to 'rwx-rwx-x (771)'
    - Terminal 'adk' wizard
    - Updated documentation
    - Zillion+ features, fixes and improvements
    15
    WARNING: disclaimers are all over the place. Still, some people just take things for granted and refuse to follow recommended safety guidelines prior to playing with advanced stuff for the FIRST TIME. Be an advanced user or not, make sure you read and understand the OP before installing this module. If something goes wrong, either because "reasons" or you forgot to feed your cat beforehand -- and you don't have a backup, DO NOT curse me! Of course, I'm always willing to help. That is, until you lose your mind and start attacking me.

    Yes, saying "it works for me" is not an excuse. However, that's never meant to be, nor does it serve as incentive to try this module. You install this because you want to, not because I told you to.

    Regarding rolling things back if something goes wrong...
    1. First of all, don't lose your mind and throw everything at me.
    2. Make sure you have the LATEST zip
    3. Boot into recovery
    4. Flash the zip
    4. Run "adk" (without quotes) on recovery terminal. Type "y" when prompted and press the "enter" key. This undoes everything.

    This info is on the README, by the way.

    Code:
    **2018.8.10 (201808100)**
    - General optimizations
    - Support for `exc`, `exc pkgName` and `inc pkgName` config lines (details on the README)
    - Updated reference
    
    **2018.8.8 (201808080)**
    - Disable ESDFS & SDCARDFS and enable FUSE (might improve compatibility)
      *Release notes:* follow all safety guidelines strictly. Don't curse me if something goes wrong either because "reasons" or you forgot to feed your cat beforehand. I've been cursed enough times already. Still, somehow managed to stay alive and cool to this day.

    P.S., installing from TWRP makes no difference. The latest module version itself does. About the French stuff... never heard of that, but gained some interest now that it was mentioned:)

    If this ends up not working for most people, I'll redesign the whole thing. Current features will be kept, but turned off by default. The module will primarily function as an automatic app backup tool, with an interface similar to that of Magisk Manager for Recovery Mode.

    Last but not least, I'm sorry for all data lost. I can't blame myself for that, though. What I can do is keep working to improve compatibility and add features... and perhaps write a book on disclaimers and how people skip them.

    For additional words, the OP has been updated. Please [re]read it.