The archived blog history of Per Liedman.

© 2013. All rights reserved.

Built on @mdo's Hyde.

Using Ubuntu One from a headless Oneiric Ocelot server

I discovered my backup has been broken since august. Yikes. I don't know the whole story why it started failing, but apparently it became permanently broken after updating to Ubuntu 11.10, Oneiric Ocelot. I use Ubuntu One for my backup, since I'm a cheap bastard. The way I set it up is described here: Using Ubuntu One for backup on a headless server. Unfortunately, the package ubuntuone-client-tools has been removed in Oneiric Ocelot, which was pretty much a disaster for my backup. Since my old blog post still appears to be the number one Google result for backing up to Ubuntu One from the command line, I sort of feel obliged to tell you how to set it up in Oneiric Ocelot as well.

Setting up u1sync in Ubuntu 11.10, Oneiric Ocelot

Maybe I'm just dumb or something, but I was sort of shocked of how hard it was to find any information at all about what had happened to the u1sync utility or why the package ubuntuone-client-tools had been removed. At last, I found that u1sync is now hosted on Launchpad - it doesn't appear to be part of any package, there doesn't appear to be any documentation, there isn't even a downloadable file. You can get the latest code (no tags or branches or anything fancy here) using Bazaar, the VCS that isn't popular anywhere. Sorry to be sarcastic, but it's pretty much the caricature of an open source project. On the bright side: the code is there, someone has made this utility and is sort of maintaining it - I love you for doing this!

So, to get u1sync on your machine:

  1. Install Bazaar: sudo apt-get install bzr
  2. Download the latest code to your working directory: bzr branch lp:u1sync
  3. Install the code: cd u1sync sudo python setup.py install

...and we are more or less back to where we left off in my previous blog post. One minor issue: if you used the u1sync utility from the old package, you might get the error message: ImportError: No module named u1sync.genericmerge when running u1sync. In this case, you have an old file called .ubuntuone-sync/local-index in your synced folder - open the file and find the text ubuntuone.u1sync.genericmerge - remove the first part, so that only u1sync.genericmerge is left. (Yes, yikes! I spent a good part of a day swearing over this.)

Getting an authorization token for Ubuntu One using command line

A lot of the comments on my earlier blog post revolved around the fact that I reused the oauth token from my desktop machine when doing the backup from my server. That was an imperfect solution which resulted in file conflicts and other issues. On the other hand, not even Stuart Langridge, Technical architect for Ubuntu One, could post correct instructions on getting a new token from the command line :)

After digging in to this a bit more, writing some code of my own to do it, I finally found that of course someone else already did it. Roman Yepishev wrote a small script to create a new oauth token for Ubuntu One - it's pretty self instructive if you use it. It dumps the new token to stdout, and you stick it into the u1sync commandline. Exactly what I wanted.

Hope this was helpful in getting Ubuntu One from the command line set up for you!