2

I have formatted my phone, but I made a Nandroid Backup before.

I then installed Whatsapp again, expecting it to download the chats from the cloud. It didn't. I then deleted Whatsapp and the newly generated /data/data/com.whatsapp, extracted it from the Nandroid Backup and put it on my phone, and reinstalled Whatsapp. However, it immediately crashes. It starts and just closes again.

If I copy back the newly generated com.whatsapp folder without my messages, it starts but my chats are gone. If I copy the folder from the backup, it doesn't even boot.

How do I get my chats back? Can I "mix" the working folder with just the msgstore.db from the old one? I don't want to mess more up ...

2
  • I did re-flash the phone again, this time first copying my old folder back, then installing the exact same version of Whatsapp, it still doesn't boot. Logcat seems to indicate permission issues? pastebin.com/qtVmN8hr Why? Can I fix this somehow? I haven't yet created a new com.whatsapp folder after the re-flash. - Whatsapp seems to want toread from /data/user/0/com.whatsapp instead of /data/data/com.whatsapp .. Feb 22, 2017 at 10:41
  • 1
    As a side note, /data/user/0 is a symlink to /data/data.
    – Grimoire
    Feb 22, 2017 at 14:45

1 Answer 1

2

To restore WhatsApp's functionality, you need to uninstall and reinstall it again. Then, open a terminal and issue

su
ls -l /data/data/com.whatsapp

, noting down the content of the third and fourth columns. The third identifies the file owner, while the fourth is the group.

After that, restore your backup and, in a terminal, issue

su
chown -R <owner>.<group> /data/data/com.whatsapp

, replacing <owner> and <group> with the data you previously noted down. This procedure sets the correct ownership for WhatsApp data, letting you effectively restore your backup.


Reason behind the failure

I was finally able to reproduce the issue.

Your phone has SELinux installed, and set in Enforcing mode. Now, SELinux is able to limit even the root user, and it does so by enforcing certain so-called contexts. The appropriate context for app data is u:object_r:app_data_file:s0, while the context of the backup was u:object_r:system_data_file:s0. This can be seen at line 13 of your log, which reads

02-22 11:38:10.673  7269  7269 W SharedPreferenc: type=1400 audit(0.0:909): avc: denied { read } for name="com.whatsapp_preferences.xml" dev=mmcblk0p12 ino=73372 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:system_data_file:s0 tclass=file permissive=0

(tcontext is the file's context).

Basically, SELinux denied WhatsApp the right to operate any changes under /data/data/com.whatsapp despite ownership and permissions, because the app isn't allowed to edit anything belonging to the abovementioned tcontext.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .