Can I install Unison for Ubuntu 18.04 LTS on Ubuntu 20.04 LTS?

I have two machines running Ubuntu. One runs Ubuntu 18.04 LTS and the other one runs Ubuntu 20.04 LTS. I want to use unison to sync files between them. I've installed unison on both of them the conventional way. I.e.:

sudo apt install unison-all

When I check what version is installed, I get this on both machines:

unison version 2.48.4

When I try to sync between them, the sync fails and I get the message:

Fatal error during unmarshaling (input value:ill-formed message) possibly because client and serer have been compiled with different versions of OCaml compiler.

When I look at /usr/bin/unison-2.48.4 on both machines, I get:

3377264 Oct 31  2017 /usr/bin/unison-2.48.4 [18.04]
3866920 Feb 16 10:04 /usr/bin/unison-2.48.4 [20.04]

So while the version number is the same, they have different sizes and a different timestamps, and my guess is that the difference is what causing the error.

The problem is also posted here: https://www.mail-archive.com/[email protected]/msg5750379.html – but no solution yet.

The unison that is installed on the machine running Ubuntu 18.04 LTS syncs fine with unison 2.48.4 for MS Windows 10, so that is the one I want to use on Ubuntu 20.04 LTS as well.

Is there any way to install the version of unison available for Ubuntu 18.04 LTS on Unison 20.04 LTS?

If "yes", how?


I think a better solution is

  1. Purge the current installation
  2. Install the former Debian version on the Ubuntu 20.04 LTS server:
wget http://ftp.fr.debian.org/debian/pool/main/u/unison/unison_2.48.4-1+b1_amd64.deb
sudo dpkg -i unison_2.48.4-1+b1_amd64.deb
wget http://ftp.fr.debian.org/debian/pool/main/u/unison/unison-gtk_2.48.4-1+b1_amd64.deb
sudo dpkg -i unison-gtk_2.48.4-1+b1_amd64.deb

Then set them on hold aptitude hold unison unison-gtk. Follow https://bugs.launchpad.net/ubuntu/+source/unison/+bug/1875475 to see when it will be fixed.


I've discovered the hard way what apparently is common knowledge: Unison is extremely picky about not only the version number of the tool itself, but also the OCaml compiler used to compile it. It looks like the team that put together the binaries for Ubuntu 20.04 LTS recompiled with a newer version of the OCaml compiler than what was previously used, without thinking about backwards and cross-platform compatibility is the main feature of syncing tool. IMHO, that's a major goof-up.

The way I fixed this was to first purge unison on Ubuntu 20.04 LTS via apt and then reinstalling it "by hand" by using the static file unison-2.48.4-linux-i386-text-static.tar.gzthat can be downloaded from: https://www.urs-mueller.ch/de/computer/index.html.

I am not an Ubuntu wizard, so I don't know if that is the correct way to go about this, but it works for me and allows me to sync between all my computers again.