Installing Wine 1.9.11 on Ubuntu 16.04

wine-software-that-can-lead-a-man-to-drinkIt should not have been this difficult.

But alas, it has been.

I must have spent 4 or more hours now trying to install Wine 1.9 (though any version would have been just fine after the first few hours), on Ubuntu 16.04 / Xenial.

The reason for all this Wine-ing? SQLYog. It’s by far and away the best MySQL GUI I have ever used, and nothing on Linux comes close. Wine allows me to run Windows software (almost) as though it were a native Linux app. Pretty awesome.

Now, I’ve never had any trouble installing Wine before. I’m almost positive (though it’s always worth doubting my own memory) that I’ve had Wine installed on previous Linux / Ubuntu boxes simply by using the Ubuntu Software Center. Sure, it’s an ancient version, but it does the job.

Things got so desperate that I was in the middle of installing Windows 7 into a VirtualBox VM just so I could run this one single app. And of course, whilst that was installing in the background, I managed to stumble upon a fix.

Anyway, enough background / blather, I’m sure you are only interested in how I fixed this problem.

My Solution

I followed the instruction guide from the Wine docs:

sudo dpkg --add-architecture i386 
sudo add-apt-repository ppa:wine/wine-builds
sudo apt-get update
sudo apt-get install --install-recommends winehq-devel

However this constantly threw up errors like:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies.
 winehq-devel : Depends: wine-devel (= 1.9.11~ubuntu16.04.1)

I knew there was something around the whole x64 / i386 thing going on, and along the way I learned that adding in :i386 after a package name installs the 32 bit version of the software, should you be on a 64 bit OS.

This led me to trying all manner of variations.

Then I stumbled upon this, which gave a much clearer indication of the missing dependency:

➜  ~ sudo apt-get install --install-recommends wine-devel-i386
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies.
 wine-devel-i386:i386 : Depends: libgphoto2-6:i386 (>= 2.5.9) but it is not going to be installed
                        Recommends: libgnutls-deb0-28:i386 but it is not installable or
                                    libgnutls26:i386 but it is not installable
                        Recommends: libsane:i386 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

That led me to this StackOverflow thread which got me much further, but not 100% of the way there.

The first command worked a treat:

sudo apt-get install gcc-multilib libasound2-dev:i386 libgsm1-dev:i386 libjpeg8-dev:i386 liblcms2-dev:i386 libldap2-dev:i386 libmpg123-dev:i386 libopenal-dev:i386 libv4l-dev:i386 libx11-dev:i386 libxinerama-dev:i386 libxml2-dev:i386 zlib1g-dev:i386

But the second one needed a little modification:

sudo apt-get install libcapi20-dev:i386 libcups2:i386 libdbus-1-3:i386 libfontconfig:i386 libfreetype6:i386 libglu1-mesa:i386 libgphoto2-6:i386 libncurses5:i386 libosmesa6:i386 libsane:i386 libxcomposite1:i386 libxcursor1:i386 libxi6:i386 libxrandr2:i386 libxslt1.1:i386 ocl-icd-libopencl1:i386 libgd3:i386

Fortunately, again, the output was very helpful in pointing me towards the right dependency.

With both of those installing all the bits and pieces, finally Wine installed properly:

sudo apt-get install --install-recommends winehq-devel wine-devel

Most of the frustration came from me not understanding the output clearly enough to figure out what dependency I was missing.

Some raw output which may help you debug this problem:

sudo dpkg --add-architecture i386 
sudo add-apt-repository ppa:wine/wine-builds
sudo apt-get update
sudo apt-get install --install-recommends winehq-devel
apt-mark showhold 
sudo apt-get remove wine
sudo apt-get install wine1.7
sudo apt-get install wine1.7-amd64 wine1.7-i386
sudo apt-get install --install-recommends wine-devel
sudo apt-get install --install-recommends wine-devel-i386
sudo apt-get install --install-recommends wine-devel-i386:i386
sudo apt-get install ia32-libs
sudo apt-get install wine-devel-i386
sudo apt-get install --install-recommends winehq-devel wine-devel
sudo apt-get install --install-recommends winehq-devel libasound2-plugins:i386
sudo apt-get install libcapi20-dev:i386 libcups2:i386 libdbus-1-3:i386 libfontconfig:i386 libfreetype6:i386 libglu1-mesa:i386 libgnutls26:i386 libgphoto2-2:i386 libncurses5:i386 libosmesa6:i386 libsane:i386 libxcomposite1:i386 libxcursor1:i386 libxi6:i386 libxrandr2:i386 libxslt1.1:i386 ocl-icd-libopencl1:i386
sudo apt-get install gcc-multilib libasound2-dev:i386 libgsm1-dev:i386 libjpeg8-dev:i386 liblcms2-dev:i386 libldap2-dev:i386 libmpg123-dev:i386 libopenal-dev:i386 libv4l-dev:i386 libx11-dev:i386 libxinerama-dev:i386 libxml2-dev:i386 zlib1g-dev:i386 
apt-get install libcapi20-dev:i386 libcups2:i386 libdbus-1-3:i386 libfontconfig:i386 libfreetype6:i386 libglu1-mesa:i386 libgnutls26:i386 libgphoto2-2:i386 libncurses5:i386 libosmesa6:i386 libsane:i386 libxcomposite1:i386 libxcursor1:i386 libxi6:i386 libxrandr2:i386 libxslt1.1:i386 ocl-icd-libopencl1:i386
sudo apt-get install libcapi20-dev:i386 libcups2:i386 libdbus-1-3:i386 libfontconfig:i386 libfreetype6:i386 libglu1-mesa:i386 libgnutls26:i386 libgphoto2-2:i386 libncurses5:i386 libosmesa6:i386 libsane:i386 libxcomposite1:i386 libxcursor1:i386 libxi6:i386 libxrandr2:i386 libxslt1.1:i386 ocl-icd-libopencl1:i386
sudo apt-get install --install-recommends winehq-devel wine-devel
sudo apt-get install libcapi20-dev:i386 libcups2:i386 libdbus-1-3:i386 libfontconfig:i386 libfreetype6:i386 libglu1-mesa:i386 libgphoto2-2:i386 libncurses5:i386 libosmesa6:i386 libsane:i386 libxcomposite1:i386 libxcursor1:i386 libxi6:i386 libxrandr2:i386 libxslt1.1:i386 ocl-icd-libopencl1:i386
sudo apt-get install libcapi20-dev:i386 libcups2:i386 libdbus-1-3:i386 libfontconfig:i386 libfreetype6:i386 libglu1-mesa:i386  libncurses5:i386 libosmesa6:i386 libsane:i386 libxcomposite1:i386 libxcursor1:i386 libxi6:i386 libxrandr2:i386 libxslt1.1:i386 ocl-icd-libopencl1:i386
sudo apt-get install libcapi20-dev:i386 libcups2:i386 libdbus-1-3:i386 libfontconfig:i386 libfreetype6:i386 libglu1-mesa:i386 libgphoto2-6:i386 libncurses5:i386 libosmesa6:i386 libsane:i386 libxcomposite1:i386 libxcursor1:i386 libxi6:i386 libxrandr2:i386 libxslt1.1:i386 ocl-icd-libopencl1:i386
sudo apt-get install libcapi20-dev:i386 libcups2:i386 libdbus-1-3:i386 libfontconfig:i386 libfreetype6:i386 libglu1-mesa:i386 libgphoto2-6:i386 libncurses5:i386 libosmesa6:i386 libsane:i386 libxcomposite1:i386 libxcursor1:i386 libxi6:i386 libxrandr2:i386 libxslt1.1:i386 ocl-icd-libopencl1:i386 libgd3:1386
sudo apt-get install libcapi20-dev:i386 libcups2:i386 libdbus-1-3:i386 libfontconfig:i386 libfreetype6:i386 libglu1-mesa:i386 libgphoto2-6:i386 libncurses5:i386 libosmesa6:i386 libsane:i386 libxcomposite1:i386 libxcursor1:i386 libxi6:i386 libxrandr2:i386 libxslt1.1:i386 ocl-icd-libopencl1:i386 libgd3:i386
sudo apt-get install --install-recommends winehq-devel wine-devel

wine is not an emulator

But it may make you need a drink.