4

I am trying to sync data between an Ubuntu instance and a CentOS 7 instance. It's like a bi-directional rsync so I thought unison would be the best tool. I installed it on both instances but when I tried to connect them I received an error because the versions are different:

unison -testServer . ssh://myuser@myremotehost/efs/home/
Contacting server...
myuser@myremotehost's password:
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".
This can happen because you have different versions of Unison
installed on the client and server machines, or because
your connection is failing and somebody is printing an error
message, or because your remote login shell is printing
something itself before starting Unison.

So I tried to make the versions match but when I look I only see the one version available on Ubuntu.

myuser@mylocalhost:/nas/$ apt policy unison
unison:
  Installed: 2.48.4-1ubuntu1
  Candidate: 2.48.4-1ubuntu1
  Version table:
 *** 2.48.4-1ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
        100 /var/lib/dpkg/status

And when I look on CentOS 7 I don't see any versions

$ yum --showduplicates list unison
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: d36uatko69830t.cloudfront.net
 * epel: mirror.prgmr.com
 * extras: d36uatko69830t.cloudfront.net
 * updates: d36uatko69830t.cloudfront.net
Error: No matching Packages to list

However, I can install it with no problem:

$ sudo yum install unison
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: d36uatko69830t.cloudfront.net
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * extras: d36uatko69830t.cloudfront.net
 * updates: d36uatko69830t.cloudfront.net
Package unison240-gtk-2.40.128-5.el7.x86_64 already installed and latest version
Nothing to do

Am I doing something wrong with finding the versions? How can I make them match?

The local host is:

myuser@mylocalhost:/nas$ cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04

The remote host is:

$ cat /etc/*release
CentOS Linux release 7.6.1810 (Core)
3
  • 2
    Found a gist to compile unison 2.48.4 from source on CentOS. Does that work?
    – Freddy
    Commented May 13, 2020 at 17:01
  • 1
    Yes, that worked! Thanks - feel free to respond as an answer.
    – jss367
    Commented May 13, 2020 at 17:11
  • 2
    You made it, you answer it. I only have Debian based distros to test, that's why I left a comment. :)
    – Freddy
    Commented May 13, 2020 at 17:23

2 Answers 2

3

Per @Freddy's comment, the key is to compile unison from source on CentOS:

yum install ocaml ocaml-camlp4-devel ctags ctags-etags

cd ~
wget http://www.seas.upenn.edu/~bcpierce/unison//download/releases/stable/unison-2.48.4.tar.gz
tar xvfz unison-2.48.4.tar.gz
cd src
make

sudo cp -v unison /usr/local/sbin/
sudo cp -v unison /usr/bin/

cd ~
rm -fr src

Then you will be able to run unison:

On the local server, go to the desired location, then test it with

unison -testServer . ssh://myuser@myremotehost//path/to/data/

To do the real thing, simply remove -testServer from above. It's also a good idea to tmux before doing so.

0

In order to run across the network, Unison needs the same program version, built with the same version of the OCaml compiler, on both ends.

As described in the other answer, you can build Unison from source. Either build on one machine and copy the binary to the other—or, if you decide to build Unison separately on each machine, ensure both have the same version of the OCaml compiler.

As an easier alternative, Unison versions starting with 2.40 are available as binary downloads from the project itself, at least for Intel platforms. Starting with 2.51.3, they even offer builds with different OCaml versions. Grab the one you want and deploy it to both of your machines, which ensures you are running the same on both ends.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .