Syncing your N900 with ownCloud – an update

Back in January I wrote a post about syncing your Nokia N900 with ownCloud (btw, please read that first, if you have any questions/problems using the instructions here). Since I got a lot of very good advice and information in the comments on it, I thought I would post an update with a simpler and more correct configuration. Karel, who also commented on the post, was kind enough to send me his setup. Please refer to the original post for info about connecting to your device with SSH etc. For reference I use syncevolution version 1.2.2-1 from the extras-devel repository and a snapshot of ownCloud from git master, but it should also work fine with a recent 4.0.x release. As in the original post owncloud refers to the URL to the root of your onCloud installation e.g. http://example.com/owncloud, user is your login and password is your password. My default calendar is called calendar and my address book is called default. First create a main configuration for ownCloud:
syncevolution --configure \
	--template webdav \
	username=user \
	password=password \
	target-config@owncloud
Then configure remote URLs and link them to the owncloud config we just created. First the calendar:
syncevolution --configure \
	database=owncloud/remote.php/caldav/calendars/user/calendar/ \
	backend=caldav \
	target-config@owncloud calendar
And the address book:
syncevolution --configure \
	database=owncloud/remote.php/carddav/addressbooks/user/default/ \
	backend=carddav \
	target-config@owncloud contacts
I think the next command creates the entry which will be available in the UI pointing to the owncloud config we created with the first command, and yes, username and password are supposed to be empty:
syncevolution --configure \
	--template SyncEvolution_Client \
	sync=none \
	syncURL=local://@owncloud \
	username= \
	password= \
	owncloud
Now create the configuration for the local storage. The calendar:
syncevolution --configure \
	sync=two-way \
	backend=calendar \
	database=N900 \
	owncloud calendar
The N900 database is the standard storage. You can see the available ones by running syncevolution from the command line, and you can create new local calendars from the Calendar app and link them to e.g. your Work and Private calendars, just remember that the case matters, so the names must be entered exactly as they are printed by syncevolution. And the address book:
syncevolution --configure \
	sync=two-way \
	backend=contacts \
	database=file:///home/user/.osso-abook/db \
	owncloud contacts
Now everything should be OK, but let us make some quick tests.
syncevolution --print-items target-config@owncloud calendar
This should print the URI part and and the summary of all events.
syncevolution --print-items target-config@owncloud contacts
This should just show the URI part of all contacts. If everything worked out OK it's time to do the actual syncing. If you already have events and/or contacts on your device you want to keep you should do an initial slow sync:
syncevolution --sync slow owncloud
Some times you need to do it several times for it to succeed, but once you don't get any more error you can run a normal incrementel sync just by running
syncevolution owncloud
I chose to update everything from the server and ran
syncevolution --sync refresh-from-server owncloud calendar
syncevolution --sync refresh-from-server owncloud contacts
Note: Read this comment first!

Now you can also sync using the syncevolution-frontend app. Just click on the icon Syncevolution and you will see owncloud listed, and when you click on it you will get to the sync options:

Syncevolution overview

Syncevolution overview

Syncevolution options

Syncevolution options



Unfortunately the latest stable release still doesn't support VTODO or VJOURNAL for Notes and Tasks, but according to the information on the pre-release page for version 1.3, it is added there.

If you have any problems when configuring, please read the original post and any comments there first.

flattr this!

Posted in ownCloud, Sync. Tags: , , . 75 Comments »

Yet another MySQL vs. AppArmor barf

I freaking hate AppArmor! Of course only because I don't want to be bothered when an update makes a mess of it - I really don't know how it works but I don't want to need to know either. Some months ago I tried out Logitech Media Server on my box, and it screwed it up big time. Now it seems there has been an update, so it doesn't accept symlinks anymore. It seems logical that it shouldn't, but Ubuntu could have done a better job fixing it - or maybe it's because I had already edited it, that it didn't get updated..? A search lead me to an issue at Launchpad about it, but I've only skimmed through it. Anyways, today when I rebooted MySQL wouldn't run and /var/log/syslog was filled with entries like this:
Mar 30 11:55:31 tanghus kernel: [ 1309.198481] type=1400 audit(1333101331.343:97): apparmor="DENIED" operation="mknod" parent=1 profile="/usr/sbin/mysqld" name="/run/mysqld/mysqld.sock" pid=7192 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=114 ouid=114
Mar 30 11:55:36 tanghus kernel: [ 1314.463559] init: mysql main process (7192) terminated with status 1
Mar 30 11:55:36 tanghus kernel: [ 1314.463606] init: mysql main process ended, respawning
Mar 30 11:56:01 tanghus kernel: [ 1339.105333] init: mysql post-start process (7194) terminated with status 1
Mar 30 11:56:01 tanghus kernel: [ 1339.111425] type=1400 audit(1333101361.335:98): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=7291 comm="apparmor_parser"
To fix it edit /etc/apparmor.d/usr.sbin.mysqld and replace the lines: /var/run/mysqld/mysqld.pid w, /var/run/mysqld/mysqld.sock w, with: /run/mysqld/mysqld.pid w, /run/mysqld/mysqld.sock w, and restart mysql by running sudo service mysql restart - if it doesn't respawn by itself. AppArmor should automagically refresh from the change of it's configuration file, otherwise run sudo service apparmor restart.

flattr this!

Syncing your N900 with ownCloud

The other day I was lucky to get my hands on and old, solid Nokia N900 device. As I'm very enthusiastic about ownCloud, and currently also coding a bit on the Contacts App, of course the first the I had to do, was to set up syncing ownCloud Calendar and Contacts. Unfortunately that involved getting my hands dirty with syncevolution. I have tried that before with different configurations and devices, but I have always caved in after battling with the huge amount of configuration options and files. It took me from 9 PM to 9 AM to get it to work, but now I do believe I've got it right. Still a little rough around the edges, but that I can always fix, ha :-) As it involved editing a lot of files and running commands in a terminal window, I started with setting up an SSH server on the device. DuckDuckGo came to the rescue, and I found instructions on getting root access and connecting to the device over WiFi with SSH. Once you're logged into the device remember to change to the normal user account with the command 'su user' and go to the users home directory with 'cd'. In this example owncloud refers to the URL to the root of your onCloud installation e.g. http://example.com/owncloud, user is your login and password is - you guessed right - your password ;-) The default first calendar in onCloud is called default calendar. The space in the name is asking for trouble, so I created a new calendar and called it calendar. Easy to remember. First setup the sync to the ownCloud server:
syncevolution --configure \
             --template SyncEvolution \
             backend=CalDAV \
             --sync-property username=user \
             --sync-property password=password \
             --sync-property syncURL=owncloud/apps/calendar/caldav.php/calendars/user/calendar \
             --sync-property deviceId=n900 \
              consumerReady=0 \
             target-config@owncloud-calendar
Test to see if there is a connection to the server by listing the events:
syncevolution --print-items target-config@owncloud-calendar calendar
If you get any errors try to have a look at the access log for the webserver ownCloud uses and read the one syncevolution produces. It's very verbose to say the least. Next setup the connection to the calendar on the device:
syncevolution --configure \
              --template "SyncEvolution Client" \
              syncURL=local://@owncloud-calendar \
              evolutionsource=N900 \
              username= \
              password= \
              type=maemo-events \
              consumerReady=1 \
              owncloud-calendar calendar
The username and password fields are empty on purpose because the credentials for the server sync is used, but for some reason they have to be there. Now it's time to see if it works by running the first sync. It has to be run in slow mode the first time, and yes, it is really slow.
syncevolution --sync slow owncloud-calendar
Syncevolution is very picky on the validity of the data and I had a couple of disturbing error messages during the first sync, but everything seemed to work OK. For doing normal incremental sync run:
syncevolution owncloud-calendar
Of course you don't want to have to open a terminal everytime you want to sync, but I'll leave that as an excercise for the reader ;-) (Hint: look in the Resources section) Now for the Contacts. Set up the server sync:
syncevolution --configure \
              --template SyncEvolution \
              backend=CardDAV \
              --sync-property username=user \
              --sync-property password=password \
              --sync-property syncURL=owncloud/apps/contacts/carddav.php/addressbooks/user/default \
             --sync-property deviceId=n900 \
              consumerReady=0 \
              target-config@owncloud-contacts contacts
And again a test:
syncevolution --print-items target-config@owncloud-contacts contacts
Set up sync to the local address book:
syncevolution --configure \
              --template "SyncEvolution Client" \
              syncURL=local://@owncloud-contacts \
              evolutionsource=file:///home/user/.osso-abook/db \
              username= \
              password= \
              type=evolution-contacts \
              consumerReady=1 \
              owncloud-contacts contacts
Initial slow sync:
syncevolution --sync slow owncloud-contacts
And incremental sync:
syncevolution owncloud-contacts
Syncevolution saves the configuration in ~/.config/syncevolution, so if you mess something up, just run rm -rf ~/.config/syncevolution/* (yes, I have once tried to add an extra space when running a similar command...) This setup will likely also work on the Nokia N800 and N9 and possibly on other devices too. Update: I have made a follow-up on this post with a simplified and more correct configuation. Resources: Sync Maemo 5 / Nokia N900 How to synchronize your Nokia N900's calendar with any calendar accessible to evolution (also if you usually use Thunderbird Lightning, Korganizer, ...) [SyncEvolution] CalDAV/CardDAV backends available How to connect PC to my Nokia N900 over WIFI? Root Access

flattr this!

Posted in ownCloud, Sync. Tags: , . 68 Comments »