How to recover an account which lost sync (facebook, email, etc.)
asked 2015-03-04 13:47:15 +0200
This post is a wiki. Anyone with karma >75 is welcome to improve it.
There is an issue with the Jolla accounts system, where accounts aren't able to syncronise with a remote server any more, and it is not possible to activate it again via settings menu. I discovered it with some of my email accounts and my facebook account (the notification system). @Okw reported this issue already here and made a video illustrating this issue here.
This bug occours apparently when the phone crashes while it is syncing. If this happens some mandatory config files get corrupted. For now, there is no automatic solution for this. To fix the problem you can either delete and recreate the broken account (which is awkward), or you can fix the corrupted config files manually. I want to show how in this post.
Edit 5.3.2015: I experimented a little bit and discovered an even easier way to recover broken accounts: Just delete the broken config files. This should work for all sort of accounts. I hope jolla will provide a fix for the underlying bug in the upcoming release.
I want to thank @VDVsx, who originally gave the instructions here.
Prerequisites
You have to enable developer mode to get root privileges. See the instructions here. I recommend to do the following steps via an ssh shell on a PC, that is much easier than in fingerterm :).
Identifying the accounts
When you enabled developer mode and connected to the terminal via ssh, type the following commands:
devel-su -p # To get permissions to install packages
pkcon install libaccounts-glib-tools #Install accounts-tools package
ag-tool list-accounts #list your accounts
From the list printed above locate your broken account and check what's the ID, you will need that number later. Now change to the directory where the broken config files are:
cd ~/.cache/msyncd/sync #navigates to the folder with the sync configs
Fix broken email account
Check the files handling the email accounts:
[nemo@Jolla sync]$ ls -l syncemail-*
There is a file for every e-mail account you have installed, the output looks like this:
-rw-r--r-- 1 nemo privileged 0 2015-03-05 09:30 syncemail-XX.xml
Instead of the XX in the filename you will see the ID of the e-mail account. Now check the number in the fifth column (after "privileged"). This is the size of the file. For your corrupted e-mail account it will be probably 0, which means that it is empty. Re-check this with
cat syncemail-XX.xml
If there is no output, the file is empty. Delete it with
rm syncemail-XX.xml
Afterwards go on your phone to Settings -> Accounts -> email account. You should be able to select a sync schedule now. By doing this, a new syncemail-XX.xml is created. Now everything should be fine again.
Fix broken facebook account
Check the files handling the facebook account:
[nemo@Jolla sync]$ ls -l facebook.*
There should be five files:
-rw-r--r-- 1 nemo privileged 916 2015-03-05 10:00 facebook.Calendars-XX.xml
-rw-r--r-- 1 nemo privileged 912 2015-03-05 10:00 facebook.Contacts-XX.xml
-rw-r--r-- 1 nemo privileged 904 2015-03-05 10:00 facebook.Images-XX.xml
-rw-r--r-- 1 nemo privileged 0 2015-03-05 10:00 facebook.Notifications-XX.xml
-rw-r--r-- 1 nemo privileged 0 2015-03-05 10:00 facebook.Signon-XX.xml
XX is the ID of the account. The number in the fifth column (after "privileged") is the size of the file. For some of them, probably facebook.Notifications-XX.xml and facebook.Signon-XX.xml it will be 0, which means that these files are empty. Re-check this with
cat facebook.Notifications-XX.xml
cat facebook.Signon-XX.xml
Now delete all the empty files with
rm facebook.Notifications-XX.xml
rm facebook.Signon-XX.xml
Afterwards go to Settings -> Accounts -> Facebook account. You should be able to select a sync schedule now. By doing this, the missing xml files are created new. Now everything should be fine again.
Other accounts
The same instructions should be straightforward for other accounts. In principle you just have to check the folder ~/.cache/msyncd/sync for empty files and delete them. Afterwards go into the settings menu of the corrupted account and readjust the settings.
Do you know if this can be done for CardDav account as well? I will need to take a look and gather some logs later this evening, to see what's the issue with ownCloud CardDav sync, but this could come in handy. Thanks for the how-to, I'll have to try the FB fix as my GF can't get all of the events synced.
raketti ( 2015-03-04 16:02:45 +0200 )editI think so, but I'm not sure, because I haven't added a Caldav or carddav account yet. You can check the files in ~/.cache/msyncd/sync/. If there are xml files for your CardDav account which are empty it is the same issue. But I don't know what exactly has to be put into the file to fix them. I think the best is to create a new carddav account and copy the xml files of this fresh account into the corrupted ones, of course with the correct ID's.
Edit 5.3.2014: I discovered an easier way to recover broken accounts, see the corrected version of my original post. In principle you just have to check for empty files and delete them.
wanderer ( 2015-03-04 19:09:49 +0200 )edit@wanderer - Thanks a lot for this update, seems way easier now! :) I'll have to take a look at my CardDav account later this evening and if I find that this solves the sync issue, I'll update the steps here. :)
raketti ( 2015-03-05 11:59:41 +0200 )editThis is specifically to fix the case where the device crashes during a write of a sync profile. The file content gets truncated to zero, but the device crashes before the new content is flushed to disk. As such, the filesize of the sync profile (under ~/.cache/msyncd/sync) is zero / empty.
I am looking into this one, the first step is to reduce the number of times the profile gets written, as that happens in many cases often unnecessarily, at the moment - see https://github.com/nemomobile/buteo-syncfw/pull/79
The next step is to automatically recover from the situation where the profile gets corrupted. I am going to look into that one next week.
chris.adams ( 2015-03-06 09:10:14 +0200 )editThank you very much!
rob_kouw ( 2015-03-12 19:17:03 +0200 )edit