Ghost addressbooks left behind after repeatedly adding and removing some NextCloud account

REPRODUCIBILITY: Unknown
OS VERSION: 4.4.0.68
HARDWARE: Sony Xperia X
UI LANGUAGE: German
REGRESSION: Unknown, but somebody reported a similar issue 2 years ago: Ghost accounts after failed account create

DESCRIPTION:

Ghost addressbooks were left behind at some point after repeatedly adding and removing some NextCloud account. Since I did not notice this having happened until later, I cannot unfortunately say what exactly caused this.

More than anything else I’m hoping for any pointers on how to manually resolve this issue. So if you happen to know anything about how and where the addressbook data is stored on SailfishOS please leave a comment!

PRECONDITIONS:

In this case at least a NextCloud account was used. It is unknown whether it would also happen with other account types registering any addressbooks in the system.

EXPECTED RESULT:

Address book entries and all their associated contacts are cleanly removed from the system when removing the associated account.

ACTUAL RESULT:

The addressbooks and at least some of the contacts contained therein are still visible in various places in the contacts app, but the associated account appears the be gone from settings.

MODIFICATIONS:

PatchManager, lots of self-contained apps from OpenRepos (rarely using the harbour store nowadays)

ADDITIONAL INFORMATION:

Ghost addressbooks show up without any specific icon in the contacts app, while addressbooks associated with an active NextCloud account show up using the NextCloud icon and account username. As such it indeed appears as though the link between the addressbooks and the account has somehow been broken before the account was removed, leaving behind just the addressbooks.

1 Like

Well, I “solved” it by manually editing the contact database file at ~/.local/share/system/privileged/Contacts/qtcontacts-sqlite/contacts.db (uww… :face_vomiting:):

  1. Open the terminal app
  2. Run pkexec sqlite3 ~/.local/share/system/privileged/Contacts/qtcontacts-sqlite/contacts.db
  3. Enter SELECT * FROM Collections; to see a list of all known addressbooks in order creations
  4. Identify the ghost addressbooks based on the data displayed:
    • Third column is the addressbook name (as also displayed in the Contacts app)
    • Columns 8 to 10 are “applicationName”‚ “accountId” and “remotePath” respectively – useful to get a sense where the account originates from
  5. For each addressbook identified in step 4 note down the “collectionId” displayed as the first colmn
  6. Enter DELETE FROM Contacts WHERE collectionId=<collectionId>;, replacing <collectionId> with each of the identified “collectionId” values in the last step in turn, to remove any contacts associated with the ghost addressbooks
  7. Enter DELETE FROM Collections WHERE collectionId=<collectionId>;, again replacing <collectionId> with each of the identified “collectionId” values in the last step in turn, to also remove the ghost addressbook entries themselves
  8. Enter .quit to exit the sqlite3 prompt
  9. Restart the Contacts app for changes to take effect

I could not cause ghost addressbooks anymore, thus I think the actual bug is not really reproducible anymore.

Should this just be marked as fixed/ be closed?

Perhaps pending is a more appropriate tag.