How to install Unison 2.40 on Ubuntu 16.04 xenial (to resolve "Fatal error: Received unexpected header")

6,968

Solution 1

Today I had the same problem: Server with raspbian (unison 2.40) and two clients (Ubuntu 14.04 / unison 2.40 and Ubuntu 16.04 / unison 2.48).

Because of raspbian, I could not (easily) upgrade to 2.48 on server. But copying the 2.40-binaries from Ubuntu 14.04 to Ubuntu 16.04 did work:

ubu1604# cd /usr/bin; sudo scp -p ubu1404:/usr/bin/unison-2.40.102* .

You may then call unison-2.40.102 direct, or change the links /etc/alternatives/unison* to the respective binaries.

Edit:

After upgrade from 14.04 to 16.04 on my second machine I again had the issue, and getting and installing the .deb file helped, thanks to kay_D.

Changing only the links in /etc/alternatives did not be sufficient, as the repective .desktop file called the unison binary directly. So I changed /usr/share/applications/unison-gtk.desktop

Exec=unison-gtk

(Sometimes i prefer to call programs not from a terminal, but from the menu)

Solution 2

I found a deb file here, which is for trusty, but aparently works anyway, downloaded the 64 bit version and used

sudo dpkg --install ./unison-gtk_2.40.102-2ubuntu1_amd64.deb

to install. Based on ridgy's answer I use unison-2.40-gtk to invoke unison for synching with my RaspberryPis

Solution 3

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.

If you really want to install 2.40 on Xenial, just download the source for Unison, compile it with OCaml, and install it.

Although, I would recommend installing a newer version of Unison on your other computer.

Share:
6,968
kay_D
Author by

kay_D

Busy employee trying to code, hack and build as much as possible in my spare time. Openstreetmap, Raspberry Pi, Electronics, Bike, Family in randomly changing order :-)

Updated on September 18, 2022

Comments

  • kay_D
    kay_D over 1 year

    On my other computers I have unison version 2.40.102 (this is the latest version available), and on my desktop ubuntu 16.04 xenial I have 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".
    

    Various sources tell 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 my question is:

    How can I install version 2.40 on xenial?

  • kay_D
    kay_D almost 8 years
    That almost worked, but it turned out that my old 14.04 installation was 32 bit and my new 16.04 is 64 bit. So lots of errors that were not resolvable. However, I found and installed - based on your hint - a deb file and it worked - as you describe in your last sentence. Thanks.
  • Eric FD
    Eric FD over 7 years
    Furthermore you can then use sudo apt-mark hold unison-gtk in order to prevent the package from being automatically upgraded in the future.