1

On my raspberry pi computers:

pi@mizu:~ $ unison -version
unison version 2.40.102

On my desktop ubuntu 16.04 xenial:

kayd@Trunk:~$ unison -version
unison version 2.48.3

When trying to synchronize:

kayd@Trunk:~$ unison . ssh://pi@mizu/.
...
Fatal error: Received unexpected header from the server:
 expected "Unison 2.48\n" but received "Unison 2.40\n\000\000\000\000\017", 
which differs at "Unison 2.40".

A related post 1 ask me to install unison-all, which I did, but it contains only version 2.48:

kayd@Trunk:~$ ls -l /usr/bin/unison*
lrwxrwxrwx 1 root root      24 Mai 20 22:15 /usr/bin/unison -> /etc/alternatives/unison
lrwxrwxrwx 1 root root      13 Mär 18 16:10 /usr/bin/unison-2.48 -> unison-2.48.3
-rwxr-xr-x 1 root root 2169968 Mär 18 16:10 /usr/bin/unison-2.48.3
lrwxrwxrwx 1 root root      13 Mär 18 16:10 /usr/bin/unison-latest-stable -> unison-2.48.3

The two options I see:

  1. finding a PPA containing 2.40 for xenial
  2. finding a PPA containing 2.48 for raspberry

both have been unsuccessful so far.

Based on the answer below from User mapierce271 I looked into compiling it myself, but it seems to turn out to be a bit of a nightmare. The very last post in the unison dev mailing list e.g. states "The new OCaml 4.03 release made a small incompatible change to a library. I've fixed version 2.48 so that it will compile with either 4.02 or 4.03 and made a new release." and "P.S. I've also added a bit of hopefully better error reporting when the dreaded 'ocaml 4.02.1 not compatible with ocaml 4.02.2' failure is encountered at runtime. I did this just now, so if you've already grabbed the source tarball please do it again." which leads me to the conclusion that everything is highly fragile and will likely break if anything is updated even with a minor revision number changes. Having many computers to synchronize, one or another is regularly updated.

0

Yeah, the versions of Unison that you are running have to be identical. This is because the format for the archive file that Unison uses to keep track of stuff is improved changed in each new version.

Why not just install Unison from source? I would recommend installing 2.48 on your raspberry. You can download the source for Unison 2.48.3 here, and see instructions on how to compile and install it here. In fact I would recommending compiling and installing Unison from source on your desktop running Ubuntu too. This way you will avoid any unexpected hiccups if Ubuntu decides to update its Unison package, and also you can ensure that they are both compiled with the same version of OCaml, which has been an issue before.

It is also important to note that you will probably have to compile into bytecode instead of native code on your raspberry. You can do this by setting Native=false in the Makefile. See my answer here for more info.

1

Came across a solution:

Debian testing has 2.48, which should be compatible with the Ubuntu version. You need to add the testing repo on your Pi, but with a lower priority (so the repo will only be used when requested explicitly).

Add the following lines to /etc/apt/preferences (create the file if it does not yet exist):

Package: *
Pin: release o=Raspbian,a=stable
Pin-Priority: 500

Package: *
Pin: release o=Raspbian,a=testing
Pin-Priority: 300

Then add the following line to /etc/apt/sources.list:

deb http://mirrordirector.raspbian.org/raspbian/ testing main contrib non-free rpi

Now run:

sudo apt-get update
sudo apt-cache policy

Confirm that the testing repository (the one that was just added) has a lower priority than the others.

Finally:

sudo apt-get install -t testing unison-all

This gave me 2.48 on the Pi, and I was able to connect and sync.


You can also install an explicit version of Unison alongside the existing ones. Run

sudo apt-cache search unison

to find which versions are offered, then install the one(s) of your choice, e.g.:

sudo apt-get install -t testing unison2.40.102

The packages with a version number are the actual ones. unison is a meta-package which always depends on the latest version, while unison-all is a meta-package which depends on a selection of versions.

If you have multiple versions on your server, you may need to run Unison with the -addversionno option: Doing so causes the client to send its version number to the server, and tell the server to run that same version rather than its default version.


Alternatively, you could try a similar thing on your Ubuntu desktop. You’d need to:

  • Find a release that has a Unison version available on your Pi.
  • Add the repo for that release to /etc/apt/sources.list. (Copy the line for your current release, and change the release name—it’s the adjective, e.g. xenial for Xenial Xerus.)
  • Modify etc/apt/preferences accordingly. Instead of stable and testing, use your current release name and the release with your desired Unison version. Your current release gest the higher 500 priority.
  • Be sure to run sudo apt-get update; sudo apt-cache policy and verify output to ensure priorities are set correctly. Else you might end up messing up your Ubuntu installation!
  • When you’re sure all is good, install unison (or unison-all or an explicit version), selecting your new repo.

Or grab the .deb file and install it directly.

0

You can also install

unison-all

and have the proper version selected automatically as described in

How to use multiple versions of unison on one system?

  • Some distros still include just a handful of Unison versions. Ubuntu seems to have nothing except for the current one—if the peer doesn’t have that one, you’ll have to find another way. – user149408 Jan 11 '17 at 23:09
0

Same problem for me to synchronize a Unix computer (a Debian Jessie) with 2.40.102 Unison's version (installed from official stable packet releases of apt-get) and a macOS computer with the latest 2.48.15 version.

Best solution was to downgrade Unison's macOS version to 2.40. Binary is here :

Union 2.40.61 (GUI) for macOS Intel

And don't forget to install the command-line from "Unison" menu > "Install command-line tool".

At synchronization, it will replace the warning :

Unison[16276:318574] Calling nonGuiStartup
Fatal error: Received unexpected header from the server:
expected "Unison 2.40\n" but received "Unison 2.48\n\000\000\000\000\017",
which differs at "Unison 2.48".

by :

Unison[18574:332371] Calling nonGuiStartup
Connected [//SERVER.IP//Users/USer/Desktop/Unison -> //localhost//home/user/test]
Looking for changes Warning: No archive files were found for these roots…

NB : I'm on macOS Sierra 10.12.4 and Unison 2.40.61 seems working well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.