"adb backup" blocks on running apps - ONE Q&A, Help & Troubleshooting

I have been trying to make an ADB BACKUP of my phone the whole day yesterday, but have so far failed. The backup always blocks at certain points, and it seems it is due to the apps being backed up are active in some way or another. Is that normal? I used to be able to make backups of apps with adb without that much trouble, but can't anymore.
Anyway, is there some way to ensure no app is running to make the back complete? This includes services.
I was trying to build a package list and backup every app (or a group of apps), but this would create a lot of backup files to handle and would require hours and hours or work on my part. For each backup, I have to acknowledge it on the phone, so I can't fully script this. :-/
I am running CM13 non-rooted.

I think I found a way to make the backup continue when an app blocks. The reason for the block seems to be that the app wont exit when asked by the backup system.
So I open another command prompt and run this command:
set "adb=C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe"
"%adb%" shell am force-stop com.airties.waooandroid
, where com.airties.waooandroid is the app currently blocking the backup stream.
And how do I know it blocks and isn't just taking a long time? Well, I do this:
"%adb%" logcat in a third window (first being backup and second my kill window), where I should see messages related to the backup system (like backup_file_helper outputting a message for each file found).
If there aren't any messages for a few minutes, I assume the app shown on the phone is blocking the backup and issue a force-stop.
I may have to kill twice as some apps are too quick to restart, still preventing the backup from continuing.
Cumbersome, but what are my options?

Thanks for this tip, it's genius and it allowed my backups to complete after a couple of kills.

Related

Titanium Backup and Cyanogenmod7: got a problem?

Crossposted from my blog since more people read xda-devs
http://bellybuttonporn.com/wp/2011/05/19/titanium-backup-and-cyanogenmod7-got-a-problem/
I’ve run into this and from my searching it seems a few others have too.
Here’s the scenario: You’re running CyanogenMod 7 on your phone and you decide to try out a different ROM. You use Titanium Backup to save all your apps and data only to find that once you’re on the new ROM a lot of data doesn’t seem to stick around. Titanium reports that it’s successfully restored the data — and some of it really has been restored — but lots of data is missing. It’s restored to the default value from when you first installed the app.
Now here’s what’s really going on.
Titanium is indeed restoring your data. It just makes sure the app isn’t running and copies all of the database and prefs setting files into its data directory. No magic. That’s all it does and that’s all it needs to do. When your app starts up (if it’s coded well) it will check the integrity of its database files. If they are corrupt it will probably delete them and start over from scratch. Not exactly optimal, but at least the app can still run, right? Well that’s what’s happening here. Your app thinks its database file is corrupt.
CyanogenMod 7 uses a newer version of sqlite than other ROMs. (sqlite is the database engine underpinning android’s apps). This version introduces a new journaling method, the write-ahead-log, abbreviated wal for short. There’s a variety of technical benefits to using wal but that discussion doesn’t really impact our issue. Our issue is that the older version of sqlite on other ROMs doesn’t understand wal, so thinks your databases are corrupt. Bam, bye-bye data!
You can attempt this fix in one of two places. You can either fix the database files before you back them up, or after you restore them. In terms of having the right version of sqlite3 available, it’s probably best to try this before you back up your apps.
This fix assumes a few things. First, you have root. If you’re messing with CM7 and Titanium Backup you already have root. Not a problem. Second, you have busybox installed. Again, not a problem since Titanium requires busybox (and even installs it for you). Third, you have to have a sqlite3 binary somewhere on your phone. If your ROM doesn’t (some don’t for some reason) include it, you’re not screwed. I *think* Titanium will detect this and copy a binary to your phone when you click the “Problems?” button. If that’s not the case, there may be other copies of sqlite3 on your phone you can use. Open up a terminal, buddy, you’re goin in.
Find an sqlite3 binary:
find / -name sqlite3
This will locate sqlite3 for you, if it’s on your phone. Once you find it, (mine was in /system/xbin/, i.e. preinstalled in the ROM), make sure it’s new enough to understand wal.
/path/to/sqlite3 --version
If you get something 3.7.0 or higher, you’re in luck. If not, hopefully you found other sqlite3′s you can try. This is why it’s a good idea to do this BEFORE backing your apps up and flashing a new ROM. If your ROM has wal, its copy of sqlite3 does too.
I hesitate to call this a script, so here’s the command to run:
find /data/data/ -regex '.*databases/[^-]*' -exec /path/to/sqlite3 {} 'PRAGMA journal_mode=delete;' \;
Again, run this in a terminal. And yes, you do need to be root. What this is doing is going through all of the database files stored by your apps and setting them to the old journal_mode. You will get errors that certain files ending in -wal or -shm don’t exist. Don’t worry about those. When sqlite3 changes the journal_mode back to delete it will get rid of the -wal and -shm files automatically; that confuses find but doesn’t hurt anything. If an app is running during the process we won’t be able to open and update its database files. So make sure to kill them all from the Applications menu (or your task killer if you still have one of those around).
IMHO the best time to do this is on your old ROM (e.g. CM7) before doing the Titanium Backup. If you’ve already flashed to the new ROM and you’re stuck, then you can try running the command immediately after restoring everything in Titanium Backup. If you mess something up try not to panic; Titanium still has your data safely backed up. You can try again.
Leave a comment to tell everyone if this worked for you.
Interesting! I ran many times into the problems you described when switching ROMs or full wipes and restoring from titanium backups.
Unfortunately I'm not technical enough to follow your solution.
Hm!
Nandroid backup also has a problem, which I figured out the hard way. If your SD card has not enough space for its backup, I don't get an error message. It even states backup successful, when its only partial due to low card space.
Gotta watch out more for those traps.
Sent from HTC Legend on CM7.
@daoist: You, Sir, are my hero of the week! I tried to restore a backup from a Nexus S on Cyanogenmod to a Galaxy S running stock Gingerbread. And failed.
Thanks to your insights and this guy's blog article, I managed to restore everything. Thanks a lot!
I have a question, I found two files Sqlite3, version over 3.7.0, so I entered the command you tell:
find /data/data/ -regex '.*databases/[^-]*' -exec /path/to/sqlite3 {} 'PRAGMA journal_mode=delete;' \;
Click to expand...
Click to collapse
Nothing happens, means that there is not file found or means that there was not found any error? I copied pasted the command exactly like that, should I need to see a progress of files processed or something like this?
Thanks very much for the tip.

boot time

I have about 160+ apps installed in my xoom, and it almost needs 1min50 secs to boot up. is this normal? what can i do to boost the boot up time? i m in stock 3.2
Uninstall some applications.
most of them are games.. i neednt to delete them right?
Use something like Titanium Backup to backup all your apps on Xoom (or any other rrooted android device) then uninstall the apps you don't use much/anymore/etc... It'll backup the app itself and the data that goes along with it (although it prob won't backup things like your game saves, just leave them where they're at on the sdcard whether it's internal or external). If you decide later you need the app again, just fire up TB and restore it, quick and simple. Sometimes after a restore of certain apps, you may need to reboot the Xoom to get all the functionallity back but aside from that, you get to keep your apps as backup and restore them anytime while reducing your overhead of having a pile of active apps that you don't always use...
This is what I do anyway on both my Xoom and my Epic. I typically don't uninstall apss through TB although you can, I just use it to backup and restore. I do the uninstalling through the normal system settings. That's just a preference tho...
Hope this helps!
EDIT - When I suggested this to you, I was assuming that your stock 3.2 setup was rooted. If not, then TB won't do you any good and the only other advice it what solarnz offered, delete some apps.
250+ Apps here, over 5 Minutes Boot Time. Running Tiamat Hammerhead and already Reinstalled everything once. Boot Time caused by "Unpacking Native Libraries" of every single application. I hate that -.-
Learnt something new i have 101 and thought itwas getting slower lol
Sent from my Xoom using Tapatalk
200+ apps on my Xoom and the boot time is still solid as can be! For the rooters: Try using an app called Autostarts to disable all of those unwanted apps that make their way into the startup list. For the non rooters: Autorun Manager.
A lot of times, apps will attach themselves to the startup list even though they do not need it, such as a game. Why would you want a game booting up with your Xoom? I wouldn't, that's for sure. It's pointless, takes up memory, and it makes the boot time worse.
For the most part: Wipe out every single one of the startup apps that are not a part of the system, or as many as you need to. If you disable the user startup apps, you will have a more solid boot time no doubt. Almost none of the apps you install will ever need to boot up with your Xoom, unless you want it to. For me, I keep only a select few apps at startup such as: Equalizer, AdFree, and SetCPU. And chances are, if you have a ton of apps... your startup list will be massive, to say the least when you load up the app for the first time.
Rooters: Autostarts
Non Rooters: (Also has a root option) Autorun Manager

[Q] How do I modify my backup and restore manifest?

Hi xda,
Though my thread title may be a little vague and might supposedly be better asked on google or android per se, just patiently read along as I try to explain my dilemma in more detail.
For ICS users, we all know the convenience of the "backup & restore" feature. Everything from wifi passwords, contacts, and installed apps will be magically restored when you install a new firmware on your phone with a full data wipe. And for us flash junkies, that indeed is really convenient.
But even though I have come to love such feature, I've noticed a few quirks as I was using it over time. The backup manifest or shall I say, the list of backed up data gets cluttered as you continue to backup data over time. This leading to a point where my backup data is now so messed up, whenever it auto restores once again, I see previously uninstalled apps back again and duplicate contact entries. So messed up, that I've decided to stop using this much loved feature and just manually backup my contacts, and re-install apps.
So, I am looking for some solution that I might be somehow able to manually edit that current backed up list (over at google or wherever it's stored), and update which will be restored if ever I flash my phone again. Or wipe that list clean and overwrite it with my current phone state.
Sorry for the long post but I've done my googling and forum searching beforehand only to no avail.
You can forgo that feature entirely and use titanium backup instead, for backing up your personal app data...
Titanium acts a little twitchy when restoring system apps and data across roms with different bases...
Your best bet would be to backup your downloaded apps with titanium, backup contacts and msgs (and call logs) from other market apps (I use go backup)...
For bluetooth and wifi access points, I haven't found anything that is truly cross compatible among roms...so better of you just write it down somewhere and refer that later...
Typed using a small touchscreen

Titanium Backup when using a Nightlies ROM

I'm fairly new to Ti and have a question. I'd like to backup my downloaded apps and user data like text messages and email settings. I don't need much more than that. I saw a tutorial that said to backup apps, user and system data. That doesn't seem right if I'm using a custom ROM.
What do you guys recommend?
t0adman said:
I'm fairly new to Ti and have a question. I'd like to backup my downloaded apps and user data like text messages and email settings. I don't need much more than that. I saw a tutorial that said to backup apps, user and system data. That doesn't seem right if I'm using a custom ROM.
What do you guys recommend?
Click to expand...
Click to collapse
With titanium backup, you can backup all your apps and the data and then when you go to a different rom or newer build tell it to rebackup only app s that have been updated or contain new data. Text messages can be backed up in it as well and its super simple to backup and restore them (depending on how many messages you, more messages longer it takes). As far as email settings ive never done that so i can't comment on that part.
The reason for this is that if you flash a new rom and something goes wrong you can still have that data to just simply restore. The reason i use titanium backup is because its a thousand times faster to restore all your apps with that then redownload them all.
Word of advise, NEVER restore system data, that could potentially cause issues in the future, restoring apps and app data for games and such should be fine though
But as far as nightlies go, a full wipe shouldn't be required everytime a new one comes out, unless stated otherwise, or for myself i don't like to flash more than 3 or 4 nightlies on top of eachother so by the 4th or 5th one i do a fresh install, in which i backup apps and messages and restore them.
I hope that helps you understand a little better
Yes, definitely! Thank you. I'm seeing the option to backup all user apps, all system data, a combo of both, and several other scenarios. Last time I backed up just user apps and when I restored them I lost all my text messages. Is there a setting I need to select?
t0adman said:
Yes, definitely! Thank you. I'm seeing the option to backup all user apps, all system data, a combo of both, and several other scenarios. Last time I backed up just user apps and when I restored them I lost all my text messages. Is there a setting I need to select?
Click to expand...
Click to collapse
i can't remember if you need the pro version or not but for text messages and call logs, when you first enter the app hit the menu button and it should be under "backup data to xml" you'll click that and then choose what data you want to backup. From there you can either backup to your sd card, or i believe dropbox/google drive, but i always put it on the sdcard since its not a very big file
Neverendingxsin said:
i can't remember if you need the pro version or not but for text messages and call logs, when you first enter the app hit the menu button and it should be under "backup data to xml" you'll click that and then choose what data you want to backup. From there you can either backup to your sd card, or i believe dropbox/google drive, but i always put it on the sdcard since its not a very big file
Click to expand...
Click to collapse
nonono, there's an easier way to do what he wants.
@ OP, choose the option to backup all user apps... run it... there's one backup. Then, go into backup system apps, de-select all, then scroll through and find Call Log and Messages and check those... run the backup of those two items. Then you'll have all your user apps + texts and call logs.
Now you can do a factory wipe, run TiBu and restore ALL backups that you have (you only have user apps and the two items from system) and you will have everything except various system settings back as they were.
You can use filters to make it even easier. Make a new filter, only add the apps you want backed up (downloaded apps and the call log). Then all you have to do is backup and restore one list.
You can get fancy with it too. I have 3 filters. One for user apps I won't need to restore data to, one for use apps I want to be able to restore data to, and one for bloat that always gets bulk uninstalled immediately (I also use this list to test if system apps are removable by backing them up, uninstalling them, then if no problems arise I delete the back up). When ever I do a full wipe I just restore the first list (apps only), restore the second list (apps + data), and bulk uninstall everything on the third list. Takes all of 5 minutes and it's like I never wiped at all.
That said, I just dirty flash nightlies. Until I have a problem, there's no reason to do a full wipe.
Sycobob said:
You can use filters to make it even easier. Make a new filter, only add the apps you want backed up (downloaded apps and the call log). Then all you have to do is backup and restore one list.
You can get fancy with it too. I have 3 filters. One for user apps I won't need to restore data to, one for use apps I want to be able to restore data to, and one for bloat that always gets bulk uninstalled immediately (I also use this list to test if system apps are removable by backing them up, uninstalling them, then if no problems arise I delete the back up). When ever I do a full wipe I just restore the first list (apps only), restore the second list (apps + data), and bulk uninstall everything on the third list. Takes all of 5 minutes and it's like I never wiped at all.
That said, I just dirty flash nightlies. Until I have a problem, there's no reason to do a full wipe.
Click to expand...
Click to collapse
Oh Yeh, I forgot about the filters, I haven't messed with them much at all.
Go backup is also quite good as an alternative. Less customization but very simple to use
Sent from my SCH-I535 using xda app-developers app

Backup app data without root?

This is the first time I have bought a phone without a known method for rooting. I have always used Titanium Backup to backup and restore apps+data whenever I bought a new phone but unfortunately without root, this won't work. Can some one suggest another method to transfer app data from my Oneplus 3T to Pixel 2? I tried Helium but it shows "Backup Disallowed" for several of my installed apps.
Did you try using the data transfer process that is part of the initial setup on the phone? It walks you through connecting a cable between your old phone and new one and then is supposed to transfer everything.
That said, people have had extremely inconsistent results with this. I've seen people say it transferred everything no problem. Others that it didn't work. For me in transferred a lot of phone settings, but not all, wifi passwords, but not contacts or calender data; and all it did with apps was redownload them from the store and not transfer the actual data and settings at all. I had to redo settings myself, manually copy data that was on the sdcard partition, and for any apps that had a feature to export their settings to a file and then reimport them on the other phone I did that by hand.
The other possible option that I'm aware of is to use the settings on your old phone that allows Google to backup your app data to the cloud and then sync it on the new phone. I did not do that, because I don't want Google to have all my personal information. But perhaps that works. I have the sense that the whole data transfer process works best when you just let Google invade your soul as deeply as possible, because that's what they are really after.
But those less than optimal options aside, I think that transferring app data without root is pretty much impossible, since most of it resides in the /data directory which is not accessible without root.
Yeah, this sucks. Personally this is the first and last time I will buy a device at the moment of release, before root is available.
Edit: Never mind, I see you already tried Helium
Android Debug Bridge is what you're looking for. In short: enable USB debugging, install ADB, connect to computer with USB.
You can backup an app with:
adb backup -f backupfileonyourcomputer.ab packagename
You can get the packagename from the address bar if you check the application page on Play Store in a browser.
Restoring an app:
adb restore backupfileonyourcomputer.ab
You could backup all apps at once, but then can only restore the whole bulk later. (Possible to extract apps, but it's tedious)
If you need more details just search for adb backup.
Cloud save is also working really well, as stated above, but some apps don't support it. I use adb to move those from one device to another. Finally some apps have backup disabled by the developers, well.... no luck if you have some of those.

Categories

Resources