8

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/ubuntu-bugs@lists.ubuntu.com/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?

1
12

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.

3
  • 3
    I am using this as well, and it works well. Three comments 1. I now use the Ubuntu 18.04 package rather than Debian one: wget http://fr.archive.ubuntu.com/ubuntu/pool/universe/u/unison/unison_2.48.4-1ubuntu1_amd64.deb sudo dpkg -i unison_2.48.4-1ubuntu1_amd64.deb 2. aptitude hold unison is mandatory... otherwise after a few days you get the 2.48.4-4 version back 3. It did not work completely until I removed the unison archives (ar... and fp... files) generated by the 2.48.4-4 version in ~/.unison. – Marc Wouts May 5 '20 at 0:50
  • 1
    You only have to delete the fp..., thankfully. I don't know what that one does, but the ar should track what's updated and not, so luckily it seems to have not caused too many issues. – odinho - Velmont May 22 '20 at 10:30
  • Works with unison 2.40.102-2ubuntu1 too for me from here fr.archive.ubuntu.com/ubuntu/pool/universe/u/unison because I needed an older version. – Oli Aug 6 '20 at 17:06
7

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.

1
  • Yeah, this is the way I've had to do it too. Except I'm running with version 2.40.63 because that's what the folks at rsync.net have running on their sync servers. – Mike Pierce May 5 '20 at 1:28
2

Another solution, better in the long run IMHO, especially if you are synchronizing only linux machines, would be to install the snap version of Unison.

This version of Unison is system independent and whatever version of Ubuntu, Debian, etc. you install it on, it is always compiled against the same OCaml. So you don't have to worry about these issues every time something changes in Unison or OCaml. Currently, Unison is at 2.51.2 and OCaml 4.02.3

See this:

https://unix.stackexchange.com/questions/583058/unison-and-version-compiler-conflicts/583377#583377

Remember that you must install snapd first if you are not using Ubuntu:

sudo apt update
sudo apt install snapd

Log out and back in again, or restart your system, to ensure snap’s paths are updated correctly before proceeding.

Then, follow the steps showed in either the link above or this one:

http://www.xente.mundo-r.com/zasjls/other/20/unison_en.html

3
  • When you install using snaps than all paths outside home won't be accessible. So I could not sync my Media-Library which has a couple of terras. – wstein Oct 6 '20 at 12:41
  • @wstein Have you tried installing unison in developer mode sudo snap install --devmode unison-jz – zasjls Dec 2 '20 at 11:18
  • @zasjis Not installed in dev mode but set it to dev mode after install. Hope this answered your question – wstein Dec 3 '20 at 16:18

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.