MigrateContactsDatabase » History » Version 33

Denis 'GNUtoo' Carikli, 06/02/2022 02:46 PM
Use images in the tutorial

1 1 Denis 'GNUtoo' Carikli
h1. MigrateContactsDatabase
2 2 Denis 'GNUtoo' Carikli
3 31 Denis 'GNUtoo' Carikli
4 1 Denis 'GNUtoo' Carikli
5 31 Denis 'GNUtoo' Carikli
h2. Warnings
Improvements to this article are welcome:
8 2 Denis 'GNUtoo' Carikli
* This article is a work in progress
* It hasn't been tested yet and might contain mistakes
10 4 Denis 'GNUtoo' Carikli
* It needs to be more clear for less technical users
11 1 Denis 'GNUtoo' Carikli
12 31 Denis 'GNUtoo' Carikli
h2. Migration overview
13 4 Denis 'GNUtoo' Carikli
14 19 Denis 'GNUtoo' Carikli
Starting with @Replicant 6.0 0004 RC5@, the internal contact database format has changed due to the removal of some nonfree code (the Ambient SDK).
15 1 Denis 'GNUtoo' Carikli
16 19 Denis 'GNUtoo' Carikli
So when upgrading from a Replicant 6.0 image before @Replicant 6.0 0004 RC5@, you will need to follow the migration procedure that is in this wiki page.
If you follow it, you will have to backup your contact database to a file, then you will erase the internal contact database from within the Replicant recovery.
When this is done you will be able to install the new Replicant image.
After that you will be able to restore your contacts database by restoring it from the file you backuped it to.
h2. Backuping your contacts in a file
26 33 Denis 'GNUtoo' Carikli
First, you'll need to make sure Replicant is booted on the device and open the stock contact application. Here's how it looks like after the first start of Replicant 6.0 0003:
27 1 Denis 'GNUtoo' Carikli
28 33 Denis 'GNUtoo' Carikli
30 1 Denis 'GNUtoo' Carikli
Then if it shows a screen with "No contacts." in it, you won't need to backup the contacts to a file since you have no contacts, so you can skip this section (Backuping your contacts in a file), but you will still need to follow the rest of the tutorial in order to erase the internal contact database, otherwise your device may continuously crash after installing a new Replicant version with a different contact database format.
32 33 Denis 'GNUtoo' Carikli
If instead it shows some contacts, like in the following image you will then need to backup them to a file:
34 1 Denis 'GNUtoo' Carikli
35 33 Denis 'GNUtoo' Carikli
To do that you will first need to go in the contact application settings. For that click on the menu button (it's on the top right and it consists of 3 vertical dots):
37 1 Denis 'GNUtoo' Carikli
38 33 Denis 'GNUtoo' Carikli
That will display a menu. You will then have to select "Import/export" and then "Export to .vcf file":
40 1 Denis 'GNUtoo' Carikli
41 33 Denis 'GNUtoo' Carikli
It will then display a new screen with many contacts. You will need to click a menu button again (it's on the top right and it consists of 3 vertical dots):
42 1 Denis 'GNUtoo' Carikli
43 33 Denis 'GNUtoo' Carikli
44 1 Denis 'GNUtoo' Carikli
45 33 Denis 'GNUtoo' Carikli
Then  a new menu with only one option ("All [ ]") will appear:
47 1 Denis 'GNUtoo' Carikli
48 33 Denis 'GNUtoo' Carikli
You will need to select this option to select all contacts. This will bring to a new screen with all the contacts being checked. You will then need to press the right tick (it looks like a V) that is between the search button and the menu button on the top-right of the screen.
49 7 Denis 'GNUtoo' Carikli
50 33 Denis 'GNUtoo' Carikli
51 7 Denis 'GNUtoo' Carikli
52 33 Denis 'GNUtoo' Carikli
Once this is done, it typically brings you to the download application that let you save your contact to a file in the device. As there are no other options you need to select "Download" on the left to save it to the download folder:
54 7 Denis 'GNUtoo' Carikli
55 33 Denis 'GNUtoo' Carikli
It's then strongly advised to copy the resulting file outside of the phone for instance:
* To copy it on a microSD and keep the microSD in a safe place where you won't loose it
* To copy it on an USB key with the help of a special usb cable
* To copy it on your computer with the help of adb
59 4 Denis 'GNUtoo' Carikli
h2. Setup ADB
Follow the instructions for [[ADB|setting up ADB on your computer]] so that you can access a root shell on your device.
*NOTE*: when prompted on your Replicant device, make sure that you check the box that says *Always allow from this computer* when you grant your computer USB debugging permissions. Otherwise, you will be unable to obtain root shell access on your Replicant device when you reboot it into the recovery OS to actually perform the backup.
*NOTE*: for security reasons, you may want to [[ADB#Revoking-all-computers-USB-debugging-permissions|revoke these non-expiring permissions]] once the backup is complete.
68 12 Denis 'GNUtoo' Carikli
h2. Reboot into the recovery
To reboot in the recovery, you can follow the instructions in the [[RebootIntoTheRecovery]] wiki page.
72 6 Denis 'GNUtoo' Carikli
h2. Mount the data partition
74 14 Denis 'GNUtoo' Carikli
You then need to mount the data partition.
75 1 Denis 'GNUtoo' Carikli
76 28 Denis 'GNUtoo' Carikli
For the @Galaxy S III (GT-I9300)@, the @Galaxy Note II (GT-N7100)@ and the @Galaxy Note 8.0 (GT-N51xx)@, you can use the following command:
77 9 Denis 'GNUtoo' Carikli
78 13 Denis 'GNUtoo' Carikli
mount /dev/block/platform/*/by-name/USERDATA /data/
79 1 Denis 'GNUtoo' Carikli
80 9 Denis 'GNUtoo' Carikli
81 26 Denis 'GNUtoo' Carikli
And for the @Galaxy Nexus (GT-I9250)@, you can use the following command:
82 11 Denis 'GNUtoo' Carikli
83 26 Denis 'GNUtoo' Carikli
mount /dev/block/platform/*/*/by-name/userdata /data/
84 25 Denis 'GNUtoo' Carikli
85 11 Denis 'GNUtoo' Carikli
86 27 Denis 'GNUtoo' Carikli
For the @Galaxy S II (GT-I9100)@ and the @Galaxy Note (GT-N7000)@, you can use the following command instead:
87 26 Denis 'GNUtoo' Carikli
88 23 Denis 'GNUtoo' Carikli
89 26 Denis 'GNUtoo' Carikli
mount /dev/block/platform/*/by-name/DATAFS /data/
90 23 Denis 'GNUtoo' Carikli
92 24 Denis 'GNUtoo' Carikli
And for the @Galaxy Tab 2 (GT-P31xx, GT-P51xx)@:
mount /dev/block/platform/*/*/by-name/DATAFS /data/
95 21 Denis 'GNUtoo' Carikli
96 4 Denis 'GNUtoo' Carikli
h2. Erase your contact database
Once in the recovery, you will then be able to erase your contact database:
101 2 Denis 'GNUtoo' Carikli
102 1 Denis 'GNUtoo' Carikli
rm -rf /data/data/
103 22 Denis 'GNUtoo' Carikli
rm -rf /data/data/
104 1 Denis 'GNUtoo' Carikli
105 4 Denis 'GNUtoo' Carikli
106 15 Denis 'GNUtoo' Carikli
Once this is done you will need to umount the userdata partition. This can be done with the following command:
108 29 Denis 'GNUtoo' Carikli
umount /data/
109 15 Denis 'GNUtoo' Carikli
110 10 Denis 'GNUtoo' Carikli
111 4 Denis 'GNUtoo' Carikli
h2. Install the new Replicant images
112 1 Denis 'GNUtoo' Carikli
Once the backup is done, you can proceed to install the Replicant images that have the contact database format to migrate to.
114 19 Denis 'GNUtoo' Carikli
h2. Restoring your contacts from a file
118 4 Denis 'GNUtoo' Carikli
h2. Revoke USB debugging permissions
If you don't need @USB debugging permissions@ anymore, it might be a good idea to remove them. The [[ADB#Revoking-all-computers-USB-debugging-permissions|Revoking all computer's USB debugging permissions]] section in the ADB wiki page explains how to do that.
123 17 Denis 'GNUtoo' Carikli
h2. Finally
125 16 Denis 'GNUtoo' Carikli
That's it! Your contacts database is now backed up.
126 17 Denis 'GNUtoo' Carikli
h2. Extra information
The file you backuped your contact in is in the "VCard": format. That format is a standard, and many other software are compatible with it.