<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi Tone.<br>
Yes, it sounds like you have a corrupted contacts database. Any idea how that might have happened?<br>
<br>
In any case, you can try to recreate the database to fix the issue. You need to do something along the lines of the following (but please sanity-check these instructions before running them, I'm typing them into email, not having tested them on device!):<br>
<br>
You will need to have a privileged user session:<br>
$ devel-su -p<br>
<br>
Then stop everything that might be writing to the contacts database:<br>
$ systemctl --user stop lipstick<br>
$ systemctl --user stop msyncd<br>
$ systemctl --user stop contactsd<br>
$ systemctl --user stop as-daemon<br>
<br>
Change to the directory where the database resides:<br>
$ cd ~/.local/share/system/privileged/Contacts<br>
<br>
Check that DB is actually corrupted; this will say 'ok' if there are no problems, or report a bunch of error messages:<br>
$ sqlite3 qtcontacts-sqlite/contacts.db "pragma integrity_check;"<br>
<br>
If there are problems, continue:<br>
<br>
Make a backup copy of the broken DB just in case we lose something:<br>
$ mkdir bkp<br>
$ cp -R qtcontacts-sqlite bkp/<br>
<br>
Dump the DB contents:<br>
$ mkdir temp<br>
$ sqlite3 qtcontacts-sqlite/contacts.db .dump > temp/dump.sql<br>
<br>
Record the current schema version of the DB, which is reported by the following command (it is probably 15 or 16 or something similar):<br>
$ sqlite3 qtcontacts-sqlite/contacts.db "pragma user_version;"<br>
<br>
Recreate the database from the dump:<br>
$ mkdir new-db<br>
$ sqlite3 new-db/contacts.db < temp/dump.sql<br>
<br>
Set the schema version in the new database, where VER is the number reported above:<br>
$ sqlite3 new-db/contacts.db "pragma user_version = <VER>;"<br>
<br>
Move the new database to be the device database:<br>
$ mv qtcontacts-sqlite old-db<br>
$ mv new-db qtcontacts-sqlite<br>
<br>
Then reboot, and the device will restart using the new version of the DB.<br>
<br>
You can then remove the bkp, temp and old-db directories, assuming things went well. If things did not go well, you can restore the old-db directory to the 'qtcontacts-sqlite' location (after stopping everything as we did earlier) and contact me directly.<br>
<br>
Thanks,<br>
Matt<br>
<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF626378"><font face="Tahoma" color="#000000" size="2"><b>From:</b> devel-bounces@lists.sailfishos.org [devel-bounces@lists.sailfishos.org] on behalf of Tone Kastlunger [users.giulietta@gmail.com]<br>
<b>Sent:</b> Tuesday, October 27, 2015 5:47 AM<br>
<b>To:</b> devel@lists.sailfishos.org<br>
<b>Subject:</b> [SailfishDevel] Contacts db issue<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">
<div>
<div>Hey; <br>
</div>
looking through the logs (for something else) on my Jolla I happened to find the <br>
</div>
<div>following error; it appears to be realated to the contacts db. Any way to fix it?<br>
<br>
</div>
<div><br>
"Failed to prepare query for joined details:<br>
database disk image is malformed Unable to fetch row<br>
Query:<br>
SELECT Details.detailId,Details.contactId,Details.detail,Details.detailUri,Details.linkedDetailUris,Details.contexts,Details.accessConstraints,Details.provenance,COALESCE(Details.modifiable, 0),COALESCE(Details.nonexportable, 0),Addresses.*,Anniversaries.*,Avatars.*,Birthdays.*,EmailAddresses.*,Families.*,GeoLocations.*,Guids.*,Hobbies.*,Nicknames.*,Notes.*,OnlineAccounts.*,Organizations.*,PhoneNumbers.*,Presences.*,Ringtones.*,Tags.*,Urls.*,OriginMetadata.*,GlobalPresences.*,ExtendedDetails.*
FROM temp.RegenerateAggregate CROSS JOIN Details ON Details.contactId = temp.RegenerateAggregate.contactId LEFT JOIN Addresses ON Addresses.detailId = Details.detailId LEFT JOIN Anniversaries ON Anniversaries.detailId = Details.detailId LEFT JOIN Avatars ON
Avatars.detailId = Details.detailId LEFT JOIN Birthdays ON Birthdays.detailId = Details.detailId LEFT JOIN EmailAddresses ON EmailAddresses.detailId = Details.detailId LEFT JOIN Families ON Families.detailId = Details.detailId LEFT JOIN GeoLocations ON GeoLocations.detailId
= Details.detailId LEFT JOIN Guids ON Guids.detailId = Details.detailId LEFT JOIN Hobbies ON Hobbies.detailId = Details.detailId LEFT JOIN Nicknames ON Nicknames.detailId = Details.detailId LEFT JOIN Notes ON Notes.detailId = Details.detailId LEFT JOIN OnlineAccounts
ON OnlineAccounts.detailId = Details.detailId LEFT JOIN Organizations ON Organizations.detailId = Details.detailId LEFT JOIN PhoneNumbers ON PhoneNumbers.detailId = Details.detailId LEFT JOIN Presences ON Presences.detailId = Details.detailId LEFT JOIN Ringtones
ON Ringtones.detailId = Details.detailId LEFT JOIN Tags ON Tags.detailId = Details.detailId LEFT JOIN Urls ON Urls.detailId = Details.detailId LEFT JOIN OriginMetadata ON OriginMetadata.detailId = Details.detailId LEFT JOIN GlobalPresences ON GlobalPresences.detailId
= Details.detailId LEFT JOIN ExtendedDetails ON ExtendedDetails.detailI<br>
Oct 26 21:38:30 Jolla [1156]: [W] ContactWriter::regenerateAggregates:3652 - "Failed to read constituent contacts for aggregate 8487 during regenerate"<br>
<br>
<br>
</div>
<br>
</div>
</div>
</div>
</div>
</body>
</html>