Monday, February 20, 2017

backup - How to manually transfer entire Whatsapp installation to another device (the hard way)


I'm using Whatsapp from a virtual machine since I lost my phone, and now need to transfer it to a new VM.


The easy way would be to use the backup feature native to Whatsapp, but it is disabled since the VM is connected via Ethernet (and Android thinks it's a Mobile connection). In fact the very "local backup" feature is not available. I have a ton of messages which I really wouldn't like to lose.


There's an Xposed module which could possible fake an Wifi connection in the Android VM, but at this point I really want to do the entire transfer locally as my internet is painfully slow right now.


I tried the built-in adb backup feature, only to find out it's disabled for Whatsapp and can't be easily enabled (requires decompiling the apk file).


So, how can I manually transfer Whatspp app data to the new "device"? What folders do I need to copy, and what files must be modified in order for the transfer to work seamlessly?


I do of course have full root access.


[Update] Neither of the following work:





  • Copying the entire contents of /data/data/com.whatsapp/databases after installing Whatsapp, signing in and closing it. It will crash when opening, without any error message.




  • Copying the same directory, but without opening Whatsapp and signing in after installation. Same error as above.




  • Copying /data/data/com/whatsapp/databases/msgstore.db after installing Whatsapp and signing in. An error message is presented: "Something went wrong with your chat history"





  • Copying the entire /data/data/com.whatsapp directory, after installing and closing it. It will crash when opening, without any error message.





Answer



I was encountering the crashing behaviour trying these approaches too, but @DeathMaskSalesman seems to've been on the right track—the crashes are indeed a permissions issue.


If you remove WhatsApp entirely, reinstall it, and copy /data/data/com.whatsapp over and adjust the permissions correctly before launching it the first time, then it should just need to reverify your number to work. This worked for me.


To adjust permissions, first use ls -la to check the permissions on what's put in the /data/data/com.whatsapp directory upon install, e.g.:


drwxrwx--x   3 u0_a105 u0_a105  4096 2018-07-14 00:55 cache

Then use the username and group (here both u0_a105) to rename the files after you've copied them in:



chown -R u0_a105:u0_a105 /data/data/com.whatsapp/*

Then WhatsApp should launch okay without crashes, and retain settings, messages, and multimedia.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...