How to sync your N9 with your ownCloud calendars and adress books

Update: Wassili tried this in May 2014 with SyncEvolution 1.3 against ownCloud 6.0 and found out that the shell commands changed a little since I wrote this guide back in 2012. With his hints, I tried it myself again and updated the article accordingly. Thanks alot for sharing your results!

This post reformats and enhances the knowledge that N770-Freak shared at talk.maemo.org, and is mostly some documentation for myself what I actually did to get the synchronization to work. Thanks for making me able to sync my phone again! ;)

(For N900 users: Thomas Tanghus wrote a guide on how to sync the N900 with your ownCloud and SyncEvolution.)

Syncing the N9 with ownCloud wasn't possible until Ovek managed to package syncevolution with CalDAV / CardDAV support at http://people.debian.org/~ovek/harmattan/. Great to see that people are still working on stuff for the N9, but again it shows that a Maemo-Extras equivalent for the N9 is really missing. :/ (Update: Two years later, we got https://openrepos.net/ for exactly this, a great place to revive your N9 with some new or updated apps!)

This guide is written for the syncevolution_1.3-1_armel.deb package from that page and ownCloud 6.0.3, but reported to still work with ownCloud 8.1.1 (thanks to Sean).

If you don't feel very lucky, you should create a backup of your calendar and addressbook data, both of your ownCloud and your N9. For me, it was a struggle to get both databases really in sync, I had both doubled contacts and corrupted data.

Update: Wassili found out that with syncevolution 1.3, if your ownCloud calendar already contains events, there are problems with the initial sync (with --sync slow). The calendar entries that already existed in ownCloud will be transfered to the N9, but for some reason, they won't be displayed in the calendar app.

Creating a new, empty calendar to sync in ownCloud in beforehand and import your data after the intial sync works, though, so to be safe, set up the sync with empty calendars first and import the data after the initial sync worked.

fundament

All of these commands are a single line, the line wraps are not on purpose. If you have developer mode activated on your N9, you can enter all of this conveniently over ssh.

Hint: Michael pointed out that all paths and names are case-sensitive, like it's usually the case on Linux. Additionally, the syncevolution --print-databases command can come in handy for troubleshooting.

# For some reason, downloading the package with the N9 browser and installing it
# from the downloads menu didn't work for me.
# So I installed the package on the terminal, too:
# (default password is rootme)
devel-su
wget http://people.debian.org/~ovek/harmattan/syncevolution_1.3-1_armel.deb
dpkg -i syncevolution_1.3-1_armel.deb
exit

# Fill in your ownCloud logindata and ownCloud url here.
# It should be of the form http[s]://sub.domain.tld
# or http[s]://domain.tdl/owncloud if you have ownCloud installed in a subdirectory.
# @owncloud is the local configuration identifier for SyncEvolution.
# You can name the configuration anyway you like.
syncevolution --configure --template WebDAV username=<username> password=<password> target-config@owncloud

CalDAV sync:

# mycalendar is the identifier for this caldav sync.
# Again, name it anyway you like or just stay with mycalendar.
syncevolution --configure database=<owncloudurl>/remote.php/caldav/calendars/<username>/<calendarname>/ backend=caldav target-config@owncloud mycalendar
# If you are using ssl access with a selfsigned certificate, you'll have to add the SSLVerifyServer=0 option to deactivate certificate checks:
syncevolution --configure database=<owncloudurl>/remote.php/caldav/calendars/<username>/<calendarname>/ backend=caldav SSLVerifyServer=0 target-config@owncloud mycalendar

# Don't enter any credentials here! username/password must be empty.
# owncloud is the SyncEvolution configuration identifier again.
syncevolution --configure --template SyncEvolution_Client sync=none syncURL=local://@owncloud username= password= owncloud

# N9calendar should be replaced with the calendarname of your local N9 calendar,
# leave it empty to use the default calendar.
syncevolution --configure sync=two-way backend=calendar database=N9calendar owncloud mycalendar

# For the first sync, sync with:
syncevolution --sync slow owncloud mycalendar
# If you run into problems with inconsistent databases, you can try
# other (more destructive! you made that backup, right?) sync methods:
# --sync [refresh-from-local, refresh-from-remote, one-way-from-local, one-way-from-remote]

# Later on this is enough to start the synchronization:
syncevolution owncloud mycalendar

CardDAV sync:

# myaddressbook is the identifier for this carddav sync.
# Again, name it anyway you like or just stay with myaddressbook.
syncevolution --configure database=<owncloudurl>/remote.php/carddav/addressbooks/<username>/<addressbookname>/ backend=carddav target-config@owncloud myaddressbook
# Again, if you are using ssl access with a selfsigned certificate, you'll have to add the SSLVerifyServer=0 option to deactivate certificate checks:
syncevolution --configure database=<owncloudurl>/remote.php/carddav/addressbooks/<username>/<addressbookname>/ backend=carddav SSLVerifyServer=0 target-config@owncloud myaddressbook

# This one command can be skipped if done already for caldav sync:
# Don't enter any credentials here! username/password must be empty.
# owncloud is the SyncEvolution configuration identifier again.
syncevolution --configure --template SyncEvolution_Client sync=none syncURL=local://@owncloud username= password= owncloud

syncevolution --configure sync=two-way backend=addressbook database= owncloud myaddressbook

# For the first sync, sync with:
syncevolution --sync slow owncloud myaddressbook
# If you run into problems with inconsistent databases, you can try
# other (more destructive! you made that backup, right?) sync methods:
# --sync [refresh-from-local, refresh-from-remote, one-way-from-local, one-way-from-remote]

# Later on this is enough to start the synchronization:
syncevolution owncloud myaddressbook

Making synchronization more easy

I set up any GUI stuff for syncevolution. There's a GUI for starting syncs floating around in the web, but the configuration part has to be done on the command line anyway. As I don't sync that often, I only made a script name sync.sh in the MyDocs-directory containing

syncevolution owncloud mycalendar
syncevolution owncloud myaddressbook

and then I fire up finger term, enter "./sync.sh" and watch for progress and problems. ;) Good luck!

Remarks? Additions? Corrections? For anything you want to tell me about this blog post, feel free to send me an email.
Despite having no comments section (isn't that easy with a static site generator and without relying on a proprietary 3rd party service), I greatly appreciate direct feedback. ;) In case of additions, I'll mention the name from the mail if you don't object.