Are contacts stored in the TWRP backup? (Update issues)

Hi, I think I made a mistake while updating my lineageos from 15.1 to 16.0 (I know I am late…)

My phone was encrypted and because of the issues with TWRP and encryption I decided to wipe the phone and do a clean reinstall.

For preparations I

  • manually copied everything accessible when the phone is connected via USB to a PC.
  • installed root and oandbackup and made a complete backup
  • made a backup from within TWRP

What I wanted to do is also at least do a manual backup of the contacts. I forgot… -.-

The Problem, oandbackup is not really working. I tried to “restore” some items manually (not using the batch functionality) but non of them (WiFi, Contacts, Messages) shows any results in terms of the data I would expect to see.

So the main questions is, is this data to be found in any of the other backups which I did (TWRP, manual backup) or shall I say goodbye?

And any hints for the future, at least regarding the SMS?

It should be in the oandbackup backup. For me on FPOpen 19.11.2 it’s in ‘Contacts Storage.’ Have you tried restoring that?

You can check if they’re there by looking in /yourbackupdirectory/com.android.providers.contact/com.android.providers.contacts.zip/databases/contacts2.db

1 Like

Thanks for the quick reply.

It is there as it seems. At least I can see a contacts2.db with 700kb. But restoring doesn’t do anything. I tried everything with “Contacts” in its name.

Could it be my setup? Orginaly I used DavX, installed by now and also tried to restore the settings for this one. No luck.

Could be… but I presume DavX uses the same database for local storage that the system uses. My contacts database is about 7MB, so I’d take a look at the contents of your database file. You can open it with something like sqlitebrowser if you’re on Linux or some other program that can read SQlite databases. You could even open it in a text editor and just Ctrl+F for a contact’s name to see if the file’s populated.

For backups, oandbackup just copies the relevant databases from /data/data. What you can try is take the database file from the backup and use it to replace the file in /data/data/com.android.providers.contacts/databases/contacts2.db. Make a backup of the file that’s there now first, of course.

So first unpack the database file to your working directory, and then

adb root
adb remount
adb shell mv /data/data/com.android.providers.contacts/databases/contacts2.db /data/data/com.android.providers.contacts/databases/contacts2.db.bak
adb push contacts2.db /data/data/com.android.providers.contacts/databases/contacts2.db

And then check if it took, it may or not require a reboot, I’m not sure. So potentially

adb reboot

Worth a try, worst comes to worst it doesn’t work and then you can just restore the backed up original

adb root
adb remount
adb shell mv /data/data/com.android.providers.contacts/databases/contacts2.db.bak /data/data/com.android.providers.contacts/databases/contacts2.db

and we look for a different solution.

1 Like

For some things which I try to restore with oandbackup it opens up an error log. (Like trying to restore used WiFis, I could open the file manually and verify that it has entries. So the information is there. I assume the same for the contacts. Only I’m on Windows and the tool Sqliteman won’t open the database.

The error log of oandbackup has entries like this:

Contacts: mkdir: Needs 1 argument (see "mkdir --help")
Contacts: resorecon: Needs 1 argument
...
oab-utils: error getting owner ids for "/data/misc/wifi/wpa_supplicant.conf":entity not found

Any ideas on this? I assume I’m doing something wrong when using oandbackups.

Dunno, possible things have been moved around in the system update? It’s apparently trying to make a directory for the contacts backup, which I imagine it’s doing because the directory it’s looking for isn’t there… but I’m not at all sure about that. Hence the manual option I described above, oandbackup tends to get screwy with system updates.

Okay. Thanks a lot. Will have to do it next week. To tired to do it right now.

As I have to find a easy working tool for the db, do you have a feeling for downgrading to LineageOS15 and trying my luck with the oandbackup there? Or is it an obvious waste of time?

Worth a try. Better chance of it working while using the version you backed up from.

You don’t need to find a database reader to perform the procedure. You can just try and see if it works, even without looking at the database - you won’t break anything either way.

Are you familiar with ADB? If not, you can also just copy the backup contacts2.db file to your FP2 and then use a (root-capable) file manager to copy it to /data/data/com.android.providers.contacts (after renaming the original /data/data/com.android.providers.contacts/contacts2.db to contacts2.db.bak).

Regarding ADB, familiar would be to much. I have everything necessary installed and it is working, but normally I did everything directly on the phone. But I will see.

Can anyone point me to a LineageOS 15.1 download? I only have 14.1 images and on the official sites I can only find 16.0. -.-

I would like to try downgrading first and see if oandbackups works correctly then.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.