Running Windows programs on Linux with Wine

Wine Importer

© Shanna Korby, Fotolia

© Shanna Korby, Fotolia

Author(s):

Users who move from Windows to Linux often miss some of their favorite programs and games. Wouldn't it be practical to run Windows applications on the free Linux operating system? Time for a little taste of Wine.

Many Linux migrants miss games and graphics programs such as CorelDRAW or products such as Adobe Photoshop. The only solution is to install Windows parallel to Linux -- or try Wine, which tricks applications into believing they are running on a Windows system.

The history of Wine goes back to the year 1993. At the time, Sun developed a small tool to run Windows applications on its own Solaris operating system – without the need for a Windows license or other interaction. This software inspired Bob Amstadt and Eric Youngdale to develop something similar for Linux. A short while later, the first version of Wine was released. Today, more than 300 volunteer programmers from all over the world continue to contribute to the Wine project.

What's in a Name?

To run Windows programs on Linux, Wine uses a fairly complex trick: It sits between the Windows application and Linux like a simultaneous interpreter. If the Windows application says: "Draw a button," Wine passes this command directly to Linux. In contrast to VirtualBox or VMware, Wine does not emulate a whole PC and is thus not a real emulator. This also explains the name Wine, which means Wine Is Not an Emulator.

Because of the way Wine works, it offers a number of advantages. Chiefly, you do not need an expensive Windows license. Programs will run almost as fast as on the Redmond operating system, and windows behave as if they belong to a native Linux program.

An interpreter can only be as good as its knowledge of the language, and therein lies the problem: Because Microsoft refused to release details of its operating system until just recently, Wine developers were forced to adopt a trial and error approach. This involved much painstaking work, and considering the multiple gigabyte operating system monster they were facing, it was very much a labor of Sisyphus. On top of this, some software manufacturers use pretty nasty programming tricks, and to talk these applications into running on Linux, Wine needs to know these tricks. Unfortunately, most software vendors keep this kind of information safely under lock and key.

Despite years of work, then, Wine is still officially under development, and most of the work is going into the fields of multimedia, video, and 3D graphics. This said, Wine does support DirectX 8 and 9 quite well by now. The developers started work on the tenth incarnation of this critical graphics interface for games last year. An additional limitation is that Wine can only handle 32-bit Windows applications, although support for 64-bit software is planned for some time in the future.

Wine has another disadvantage: It can only handle Windows applications; it cannot revitalize hardware with Windows-only driver support.

Preparation

Before you fire up your package manager and launch into the Wine install, you might want to take a look at the application database on the Wine homepage [1]. This database summarizes the level of support for various Windows programs: whether or not they run on Wine, and if so, how well behaved they are. To access the database, go to the Wine homepage and, in WineHQ Menu, click AppDB on the left. In the AppDB area, select Browse Apps. Then go through the drop-down list labeled Category until you find the category and application you are interested in and click on Update filter. CorelDRAW and Photoshop are hidden below Multimedia | Graphics | Graphics Editing, for example. Alternatively, you can use the search function on the left to find your application in the database.

If you decide to investigate CorelDRAW, you are taken to the page shown in Figure 1, where you will find ratings for different versions, telling you how well the program fared in tests performed by Wine users. The Platinum rating is only awarded if a program runs without errors and without any impairment to functionality on Wine. A couple of older CorelDRAW versions have made Gold status; the current X4 version refuses to cooperate entirely (Garbage). Adobe Photoshop CS2 will run more or less as the makers intended, whereas the current CS3 version has reached only Bronze status. Things are even worse in the case of Adobe Illustrator. As a rule of thumb, the older a program is, the better your chances are of getting it to work.

Figure 1: The Wine database lists numerous applications that run on Wine – for example, the CorelDRAW graphics package.

A Wrench in the Works

Clicking on a program version tells you exactly what the trouble is. A new window appears with details of what does and doesn't perform as expected. In addition, user reports at the bottom and tips for talking the program into cooperating can be very useful. The steps this requires, some of which are very complex, are something you should not attempt unless you are an experienced Linux user. In some cases, programs refuse to work because Internet Explorer is missing; for example, Lexware accounting software relies on Internet Explorer for some operations.

If your application is still listed as broken in the database, you should check the test date (in Test Results). If the test was a while back, you might want to experiment yourself. Wine continues to mature, and it is conceivable that your application has been taken care of. For this reason, it makes sense to enable the distribution's automatic updater, which installs any Wine update releases. Failing this, you should at least install the latest version of Wine – version 1.0 – as described in the box titled "Installing Wine 1.0 on openSUSE."

Once you have established that your choice of Windows application is likely to run on Wine, the next thing you need is an installation disc for the Windows application. Although Wine is free of charge, you will need a valid license for the Windows application, of course.

Installation

Wine is either included with all major distributions or you can easily retrieve it from a repository. If you prefer to install the latest version of Wine, follow the steps in the "Installing Wine 1.0 on openSUSE" box.

On openSUSE 10.2, 10.3, and 11.0, launch YaST and select Software Management in the Software dialog. Then, type wine in the search box and click Search. In the list of results on the right side, check the wine entry, and confirm your selection by clicking Apply (or Accept in openSUSE 11.0).

Installing Wine 1.0 on openSUSE

Many of the major distributions continue to work with the older Wine versions. Kubuntu includes 0.9.59, openSUSE 11.0 uses version 0.9.64, and openSUSE 10.3 and 10.2 use versions 0.9.44 and 0.9.24, respectively. See your distribution's documentation for more installation help.

To install a brand new version of Wine on openSUSE, select Software | Software Repositories in YaST on openSUSE 11.0, and click Add. Then, check Community Repositories, go to the Next screen, select openSUSE BuildService – Wine CVS Packages, and click OK. YaST will now parse the package list for the new source. If an Import Public GnuPG Key window appears, choose Import. If necessary, close the current window (Finish) and you can then go to Software | Software Management to install Wine 1.0.

Preparations

Wine does not integrate with the start menu on openSUSE. To launch Wine, press Alt+F2, type winecfg in the text box, and click – depending on the desktop you use – Launch or Run.

Winecfg will then go on to create a hidden .wine directory below your home directory. The software uses this directory to store the basic configuration, which you can see in Figure 2. Do not modify anything here right now, but click Cancel to close the tool.

Figure 2: This window shows you the current Wine settings.

Installing a Windows Program

To take Wine for a test run, download the WinRAR packer [2], then open your distro's file manager. In the file manager, look for the installer for the Windows application: It will typically be setup.exe, or autorun.exe. In WinRAR's case, the name is fairly cryptic: wrar371.exe (Figure 3). Simply click the file with the mouse. On openSUSE, you should now see the window shown in Figure 4. Type wine in the input box, and click OK.

Figure 3: The installation file for the WinRAR packer.
Figure 4: On openSUSE, this window appears when you click on a Windows program.

Wine takes over in the background and launches the Windows program. Just follow the normal steps to install the program. I talk about Windows drive letters in the next section, but for now, confirm the default installation directory suggested by the application (Figure 5). If the installer asks you to reboot Windows, press Alt+F2, type wineboot, and click Run. This tells Wine to simulate a Windows reboot. Figure 6 shows how a Windows program looks running in Wine. If Wine does not launch the Windows program, check out the "Dead as a Dodo" box.

Figure 5: Installing WinRAR on openSUSE 11.0.
Figure 6: The Windows application WinRAR running on openSUSE.

If the installation program creates one or multiple entries in the start menu, some distros place them below Wine. If so, you can use the entries as a convenient method for launching the Windows program. However, with openSUSE, you will need to search your disk for the Windows programs you install.

Tell Me Your Name

By default, Wine stores any Windows programs that think they are installing on drive C: in a hidden subdirectory below your home directory. To display the hidden files, select View | Show Hidden Files in Konqueror or Dolphin. Change directory to .wine in your home directory. One level below this, you will see a drive_c subdirectory, and below this Program Files and Windows. The former contains the application you just installed. For WinRAR, you click on WinRAR.exe in the WinRAR folder. On openSUSE, you also must type wine.

Directory Jungle

Unlike Windows, Linux does not use drive letters, so Wine must use a workaround: Each drive letter maps to a Linux directory. Although a Windows program running on Wine thinks it is storing data on drive C:, it is writing to a subdirectory called .wine/drive_c below the home directory. The Wine control center shows which letter maps to which directory. In a quick launcher (Alt+F2) type winecfg, then visit the Drives tab (Figure 7). The list at the top shows you which drive letter maps to which Linux directory. Normally, C: maps to .wine/drive_c, and Z: lets the Windows application access the whole directory tree because it maps to the root directory. Here, you can Add mappings by defining new virtual drive letters and typing the Path the letter should point to.

Figure 7: The Drives tab lets you map Linux directories to drive letters.

Dead as a Dodo

If a Windows program fails to launch when you click it, some manual attention might make it see reason. Start by opening a terminal window. On Kubuntu, select System | Konsole in the start menu; if you have openSUSE, select the System | Terminals | Konsole item in the menu. Then type

cd directory

where directory represents the full path to your installation program. If the setup.exe file is on a DVD, you can access the DVD via the /media/ path. The command line looks like this:

cd /media/DVD_name

Replace DVD_name with the entry in your media directory, and then climb down the directory tree until you find the directory with the .exe file you need (in WinRAR's case, this is /programs/other/winrar). When you get there, type

wine file

replacing file with the name of the application you want to run, say, setup.exe. Make sure you stick to the exact spelling, remembering that upper- and lowercase letters are vital. To tell Wine to run the Windows program, press Enter again. If you experience difficulty launching the program, check the terminal window for error messages – you should not close the terminal window or you will terminate the Windows program running in it. If the Windows program crashes, you can try relaunching it.

VistaXP 98

Some Windows programs require the characteristics of a specific version of Windows. The Applications tab can help you cater to this. For each application, you can individually define the Windows version that Wine should emulate. To do so, click Add application and look for the executable for your application (in .wine/drive_c).

Now click Open, select the application in the list, and then select the required version of Windows in the Windows Version drop-down list. The configuration in Default Settings is valid for all Windows applications, unless you define an exception.

Apps Gone Bad

The Wine MIT license gives users many privileges, a fact that has helped TransGaming generate huge profits. TransGaming just grabbed the package, added DirectX capabilities, which are required for gaming, and started to sell the results as Cedega [3] (formerly WineX). The Wine developers were unhappy about this, and thus changed the licensing terms to the LGPL in March 2002. The LGPL ensures that you can continue to use Wine for commercial purposes, but that changes and additions must be given back to the project. CodeWeavers is exemplary in this respect; the company bundled Wine with its own commercial components to create the CrossOver [4] package, while actively promoting the ongoing development of Wine.

Garbage Collection

To get rid of a Windows application you have installed on Linux, you might think it would suffice to delete the corresponding directory below .wine/drive_c/Program Files.

Don't do this because Wine will still list the application as installed. Instead, run Wine's own Uninstaller. To launch the uninstaller, press Alt+F2 within openSUSE and type uninstaller. Then, click Run (or Launch), and you should see the window in Figure 8. When you get there, select the software you want to delete and click Uninstall.

Figure 8: Wine gives you a graceful approach to uninstalling Windows programs.

Conclusions

Wine is not a panacea, unfortunately, and many major programs still refuse to cooperate. Your best chances are with games (see Figures 9 and 10), but you might need to do without popular accounting packages, CorelDRAW, the latest version of Photoshop, or iTunes, for example.

Figure 9: Some Windows games, such as Adventure Runaway, …
Figure 10: … will run on Linux thanks to Wine.

A better alternative might be to look around for a Linux program that provides similar functionality. In the case of Photoshop, why not try GIMP or Krita? And OpenOffice has long been a more than adequate replacement for Microsoft's Office suite. If you check out the list of packages in your distribution's package manager, you might be surprised at the number of comparable programs, or even programs with superior features, that Linux offers.

Infos

  1. Wine Project homepage: http://www.winehq.org
  2. WinRAR packer homepage: http://www.rarsoft.com
  3. Cedega website: http://www.transgaming.com
  4. CrossOver for Linux: http://www.codeweavers.com/products/cxlinux/