Wine, a cruel mistress – updating Debian’s ancient wine

Wine can indeed be a cruel mistress; the morning after the night before, after the sudo apt-get install has faded away and left you nothing but a jiggered system that won’t even run notepad.

I speak of course not of the mighty grape and what she gives us, but of wine (Wine Is Not an Emulator), the Win32 translation layer for Unix/Linux that does an excellent job of allowing Windows programs to run natively on Linux, often at great speed and without problems.

And sometimes with problems. If you run Ubuntu or Fedora, you’ll be blessed with recent updates from the 1.3 beta versions of wine, while the official stable version has languished at 1.2 for what seems like an eon. If you use Debian, then apt-get will only provide you with the even more Jurassic 1.0.3 version from the current stable (squeeze) repositories, there’s nothing in debian-backports, and even the upcoming releases in testing (wheezy) and unstable (sid) are only minor 1.x version bumps. You can do a full search of Debian distribution package list to see the tale of woe.

The reasoning behind Debian’s exceptionally cautious nature and glacial pace of rolling out updates is well known and well founded, and wine is hardly a core package. But that doesn’t help in the slightest when you really, simply, absolutely have to install and run Deathspank right now, and older versions aren’t cutting it.

Naturally, there are ways and means. Linux is more complex; but with complexity comes flexibility.

There are a couple of options for Debian users that offer a relatively pain-free way of using updated wine binaries and libraries without the risk of doing something terrible to the system.

 

Debian, winehq-approved packages

Debian packages created from the latest wine builds by Kai Wasserbäch can be found on his page at carbon-project.org. These are the latest builds, currently 1.3.33 for i386 or amd64 architectures, released today, and officially sanctioned by winehq.

Rather than setting up an apt repository (as he points out, “I don’t want to encourage people to install binary packages from third parties without thinking about what they’re doing”), the individual files are listed for download. You could just click each one, but it’s nice to get the computer to do the work for us. While wget won’t accept wildcards when downloading using http, so we can’t use a regexp like *wine*[your_arch_here], we can use a different method.

First highlight and copy the text list of packages from the webpage for whichever architecture you need and paste it into a text file. Using gedit or vi will neatly remove the bullet points leaving one package name per line, just as we want it. Name the file something memorable and recognisable, such as say, zig. Then type into a shell:

# wget --base=http://dev.carbon-project.org/debian/wine-unstable --input-file=zig -P libwine

This gives wget the base URL to work from, the list of files to download, and –P tells it create or use the directory libwine to store the files. Add the full path to zig if required, and you can substitute -B for --base and --i for --input-file.

Once you have a neat directory of .deb packages, you have to install them. apt-get is for querying and installing packages from the main Debian repositories (or other repositories you have added to /etc/apt/sources.list). For manual installation use dpkg, which usefully can be pointed at a directory and told to get on with installing a bunch of files at once:

# dpkg -R -i libwine/
or
# dpkg -i libwine/*

achieve much the same, where -i selects for install and -R tells dpkg that -i refers to a directory, not a file, which is why in the second example the asterisk wildcard (*) is needed to refer to ‘all files’.

But dpkg doesn’t provide hands-free dependency handling like apt-get, so it may be that some of the wine packages will fail to install due to unmet dependencies or version clashes. It’s easy enough to work out what it wants from the output given on screen, search the Debian package list for the updated version, download and use dpkg to install as before – but if you’re unlucky, that process that could potentially continue ad infinitum, ad nauseam. For what it’s worth, running Debian squeeze I needed only two: lib32ncurses5_5.9-4 and lib32tinfo5_5.9-4, both available from the testing repository (change the distribution drop down box to ‘any’, and search). It’s worth using the --no-act switch while using apt-get and dpkg
to dry-run without installing, giving you not only a chance to review what is happening but also precise details of what file version is being pulled from which repo.

 

Ubuntu Wine Team PPA packages

So far so easy. It’s certainly preferable to use packages built for the version of Debian you’re using, or at least a version of Debian, but if that doesn’t bring the results hoped for there’s always Ubuntu to turn to. With a large installed user base, more resources and a quicker release schedule than the Debian team, Ubuntu packages are mostly interoperable and tend to be packaged with the less-expert user in mind. For example, the Debian packages above weighed in at 59 Mb, while apt-get install issued at the Ubuntu wine PPA tried to pull in over 200 Mb of dependencies and support packages to make sure things work smoothly, including the very useful winetricks. Too much, I hear you say? Well it (wine 1.3.26) worked for me while the Debian packages (wine 1.3.33) didn’t, so the proof is in the pudding.

I’ve explained how to use Ubuntu Launchpad PPA repositories with Debian here, and the same applies. Briefly:

1.    Go to the Ubuntu wine PPA archive.

2.    Click on the green ‘Technical details’ tab, select an Ubuntu version and copy/paste the deb and deb-src lines into your /etc/apt/sources.list file. I’ve used the last long term support version, Lucid.

3.    Copy the GPG key (the part after the 1024R/) and add it using apt-key, then use apt-get update and apt-get install wine1.2 or apt-get install wine1.3 to install wine, depending on how wild, up-to-date and un-Debian you’re feeling.

Finally, run winecfg to prompt wine to autoconfigure, use the GUI to make any further changes and then see what works, using winetricks to install Microsoft packages such as msxml3, msxml4, msvc60, gdiplus, etc. if needed. There’s a lot of information on what works and what doesn’t, tips and tricks at appdb.winehq.org.

Note: it’s worth mentioning that there is another repository of updated Debian packages including wine at http://frickelplatz.de/debian/dists/, which appear to be different builds of equally up-to-date versions. And another is the Mepis Linux distribution, based on Ubuntu/Debian, for which repos can be found at http://main.mepis-deb.org/mepiscr/repo/. You’re mileage may vary as I’ve not tried either of them.

Using Ubuntu PPA packages with Debian or Crunchbang

Ah, the joys of package management. Every linux distribution flavour has a package management tool – even the venerable Slackware – to ensure the otherwise near-impossible task of installing programs and their dependencies and updating them to the latest versions is made possible for mere mortals.

Ubuntu, based on Debian, uses the same apt-get and dpkg tools. But as the pace of development at Ubuntu is much quicker and has a broader reach of users and developers than vanilla Debian, Canonical introduced PPA – personal package archives – on its Launchpad service to allow developers to create and maintain their own packages that can be accessed by Ubuntu users through apt-get, without having to bring them into the Ubuntu official release package tree itself.

While built for Ubuntu releases specifically, these packages can be used with Debian – and therefore Crunchbang – without much hassle. Two things are needed: firstly the location of the archive, usually an http:// or https:// web address; secondly the GPG encryption key that is used to sign the .deb packages, ensuring that the software you are installing on your computer with root permissions is, at least to a point, trusted.

In Ubuntu this is taken care of either using the add-apt-repository command, or by adding the package source using the Synaptic package manager GUI app. Neither comes with the stripped down and Gnome/KDE-free Crunchbang.

Instead we go old school again and edit the text file that the graphical app would be doing for us anyway, /etc/apt/sources.list. In this case, I’m installing the Darktable photo management and editing package, a sort of open source Adobe Lightroom. The PPA address can be found from the Ubuntu PPA achive on Launchpad. A search reveals the individual page(s) for Darktable.

In this example, there are three pages for Darktable, darktable-release, -release-plus, and -unstable. I’m using the cutting edge -unstable release in this case. Debian Squeeze (6.0.1) came out in February 2011, but I’ve used packages from the Ubuntu 10.04 “Lucid Lynx” release from April 2010 as it is a Long Term Support version and will continue to be updated long after Ubuntu 10.10 “Maverick Meercat” has been archived. Click the green link marked Technical Details about this PPA to reveal the source lines we need, beginning with deb:

We need to add the following text to /etc/apt/sources.list:

deb http://ppa.launchpad.net/pmjdebruijn/darktable-unstable/ubuntu lucid main
deb-src http://ppa.launchpad.net/pmjdebruijn/darktable-unstable/ubuntu lucid main

Darktable-unstable is the cutting-edge version in this case. The same deb line but substituting the words “darktable-release” would install from the more stable branch.

Running sudo apt-get update will force apt to add the new PPA repository to its list, but it will complain that it doesn’t have the GPG encryption keys we need to install packages:

Hit http://ppa.launchpad.net lucid/main Sources
Hit http://ppa.launchpad.net lucid/main amd64 Packages
Fetched 634 B in 0s (1,172 B/s)
Reading package lists... Done
W: GPG error: http://ppa.launchpad.net lucid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40C18E9EC07EE05F
[...]

To add the key we use the apt-key tool. Under the PPA source lines on the Darktable page, under the title Signing Key is an eight-character key, prefixed with 1024R/ (= 1024-bit RSA encryption). The key is per-user, so will be the same for each of the Darktable releases created by Pascal de Bruijn. To add it to our GPG keychain, the command we need is:

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C07EE05F

Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv-keys C07EE05F
gpg: requesting key C07EE05F from hkp server keyserver.ubuntu.com
gpg: key C07EE05F: public key "Launchpad PPA for Pascal de Bruijn" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)

Follow this with another sudo apt-get update, and we’re done. You can install away using the usual method, for example: sudo apt-get install darktable.

It’s a little less polished than Ubuntu’s tools, but what you lose in convenience you gain in speed and responsiveness, and a better understanding of how the system works underneath – a price worth paying, imho.

UPDATE: It’s worth noting that up-to-date versions of Darktable packages now appear in Debian Wheezy (1.0.4-1) and Debian Sid (1.0.5-1).