Popular Emulators for Linux

Quite a few emulators are available for Linux. If you need to run a non-Linux program within Linux, chances are good you'll be able to do so, but picking the right emulator can be a daunting task.

CPU Emulators

The most important CPU emulator for Linux is arguably Bochs (http://bochs.sourceforge.net). This open source program sets up an emulated IA-32 environment in which you can run DOS, Windows 95, Wndows NT, Linux, and probably other OSs. (Exact OS support varies from version to version, and the developers haven't tested every possible variation.) Bochs uses a disk file in which the emulator sets up a simulated hard disk. For instance, if you have an 80GB hard disk, you can create a 10GB file that the emulator will treat as a 10GB hard disk. As a CPU emulator, Bochs is quite slow. It's most useful when you're running Linux on a non-IA-32 CPU such as a PowerPC or Alpha, and then it will be sluggish compared to running native programs. Despite these problems, Bochs can be a lifesaver if you really need to run a Windows program on a non-IA-32 system.

Other CPU emulators for Linux emulate older computers. A host of emulators, such as Executor (http://www.ardi.com/executor.php) and STonX (http://stonx.sourceforge.net), emulate 680x0-based systems such as early Macintoshes and Atari STs. These emulators tend to work reasonably well and, on modern hardware, can equal or exceed the original systems' performances. A wider range of emulators handle still older 8-bit computers and game systems. The most ambitious of these are the MAME and MESS projects, which are closely affiliated and handle a very wide range of systems from the 1970s through 1990s. Check http://x.mame.net for more information.

CPU emulators typically set up a window devoted to the host OS. The window may change in size as the host OS changes video resolution. Cutting and pasting between the host and guest OSs is typically not possible, but many emulators provide a screen shot option so that you can capture an image of the guest OS's display. Figure 10.2 shows a Bochs window as it boots Linux.

Figure 10.2: Most emulators run in windows that emulate a computer screen. Machine Environment Emulators

Because they don't need to perform the costly CPU emulation, machine environment emulators typically run much faster than CPU emulators. They're usually about as tedious to set up, though, and they often require special kernel support to help the emulator interface with your real hardware. The five most popular machine environment emulators are listed here:

DOSEMU This open source emulator, headquartered at http://www.dosemu.org, is the simplest and most limited of the machine environment emulators. It supports just enough functionality to allow DOS to run. DOSEMU ships with most IA-32 Linux distributions, along with FreeDOS (http://www.freedos.org). DOSEMU works best using a file that it treats as a hard disk, but you can boot it from a DOS floppy if required.

Win4Lin This commercial program, available from Netraverse (http://www.netraverse.com), is designed to run Windows 9x/Me only. It's available both in a desktop system and as the Win4Lin Terminal Server, which enables one Linux computer to deliver Windows functionality to many thin clients. Unlike most machine environment emulators, Win4Lin provides direct access to the underlying Linux filesystem. Because it's tailored so closely to Windows 9x/Me, Win4Lin is faster than other machine environment emulators—but of course, it's less flexible. Win4Lin requires a kernel patch to run.

VMware This commercial emulator, available from a company of the same name (http://www.vmware.com), is an extremely powerful and flexible program. VMware supports all versions of DOS, Windows, Linux, and FreeBSD. Other OSs might or might not run. VMware is slower than Wn4Lin, and it requires a dedicated partition or a large disk file to serve as a virtual disk. (With some preparation, you can also boot the emulator from an existing standard Windows installation.) VMware requires a kernel patch to run.

Plex86 This open source emulator

(http://savannah.nongnu.org/proiects/plex86) can be thought of as either an open source version of VMware or a machine environment emulator version of Bochs. It's not nearly as polished as VMware. Like Bochs and VMware, Plex86 uses a large file as a virtual disk.

MoL The Mac-on-Linux (MoL; http://www.maconlinux.org) project is roughly equivalent to VMware or Plex86, but it runs on PowerPC hardware. As such, MoL runs Mac OS or PowerPC versions of Linux rather than Windows. You can boot your regular Mac OS installation after running Linux, much as Mac OS X runs Mac OS 9 to enable compatibility with older Mac OS applications.

In general, Win4Lin, VMware, and MoL are the easiest of these emulators to use. DOSEMU's configuration can be tedious, and getting Plex86 to work is a real challenge. The commercial emulators pose a special hurdle, though, in keeping their kernel patches updated with a changing Linux kernel. You may be forced to pay for upgrades just to use a version for which modern kernel patches are available.

All of these emulators except for DOSEMU run in their own windows or take over the entire screen, much as do most CPU emulators. DOSEMU can run in much this way, but for text-mode applications, it can run in an xterm or from a text-mode login. This mode of operation simplifies text cut-and-paste operations for DOS programs.


The WINE project (headquartered at http://www.winehq.com) is an effort to develop an independent implementation of the Microsoft Wndows application programming interface (API). WINE has two components. The first is a set of libraries (Winelib) that implement what are, in Linux terms, a widget set similar in scope to the popular Qt, GTK+, or Motif. Using this component of WINE, a developer can take Windows source code and compile it into a native Linux application. The second WINE component is a program loader. It launches unmodified Windows executables, enabling them to run with Winelib under Linux. In theory, Winelib could be used on any platform, but the program loader works only on IA-32 systems.

Unfortunately, WINE isn't yet complete, and probably never will be—Microsoft is likely to continue updating the Windows API until the Windows product dies, forcing WINE to play perpetual catch-up. Nonetheless, WINE has come a long way since its inception in 1993. WINE or its derivatives can run several versions of Microsoft Office, Internet Explorer, web browser plug-ins, many games, and assorted other programs. WINE's main problem is its tricky configuration (described in more detail shortly). Tweaking WINE for specific applications is often necessary, and doing so can take trial-and-error experimentation. In order to simplify configuration and fill in some of the gaps in WINE's source code, several commercial projects have arisen around WINE:

Crossover CodeWeavers (http://www.codeweavers.com) markets three WINE spin-offs: Crossover Office, Crossover Office Server Edition, and Crossover Plugin. The first two products are designed to run Microsoft Office on Linux workstations and servers, respectively. Crossover Plugin runs Wndows web browser plugins, such as QuickTime and Shockwave players. All of these products feature easy-to-use GUI installation and configuration tools. None ships with the target programs; you must obtain your own copy of Microsoft Office or other programs. You may be able to use these products to run programs not advertised by CodeWeavers, but they're fully tested and optimized only for their narrow ranges of programs.

WineX Transgaming (http://www.transgaming.com) provides a version of WINE that's optimized for use with popular Windows games. WneX is provided on a subscription basis to end users, or as a tool for game developers who want to release Linux ports of their games.

Lindows This system (http://www.lindows.com) is a Linux distribution that includes better WINE integration than most, with the goal of easing the transition from Microsoft Windows to Linux.

Assuming you install a stock WINE version on a traditional Linux distribution, you'll configure the program by editing a global configuration file called wine.conf or config, typically stored in the /usr/local/etc or/etc/wine directory. Alternatively, you can create a .wine/config file in your home directory to override the WINE defaults. Either way, the configuration file is structured much like the WIN.INI file from Windows 3.1—sections begin with names in brackets, and continue with lines that set important values. The WINE package comes with a sample config file, usually stored in the documentation/samples subdirectory of the directory in which you installed WINE. (If you install an RPM or Debian package, you can use the rpm or dpkg tool to locate the sample file, as in rpm -ql wine | grep config or dpkg -L wine | grep config.) Table 10.2 summarizes some of the more important sections and typical contents.

Table 10.2: Important WINE Configuration File Options

Configuration File Section

Features Controlled

Typical Entries

[Drive X]

This section adjusts the mapping of Linux directories to Windows drive letters. It also sets drive volume labels and other features. X is the drive letter.

"Path" = "/other/shared""Type" = "hd""Filesystem" = "win95"


This section sets the path to the Windows system directory, as required by many Windows programs, as well as some drivers and tools.

"Windows" =

"c:\\windows""Temp" = "e:\\"


WINE includes built-in equivalents to many common Windows dynamic link libraries (DLLs), but sometimes a native DLL works better. This section lets you tell WINE which to use on a DLL-by-DLL basis.

"msvcrt" = "native,* builtin"

[x11 drv]

This section controls how WINE interfaces with X, including how many colors Windows programs can claim, whether or not to use the X window manager (the Managed setting), and so on.

"AllowSystemColors" = "100""Managed" = "Y"


You can control the mapping of X fonts to Windows fonts in this section.

"Resolution" = "96""Default" = "-adobe-* helvetica-"


WINE can use TrueType fonts directly if you point it to appropriate directories.

"dirl" = "/usr/share/* fonts/1 I"

The most important configuration file options are in the [Drive X\ section. If these options are set incorrectly, Windows programs won't be able to locate the all-important windows directory, in which many store DLLs. You may also be unable to access your own user files. Typically, you should set aside a directory for C: (say, /usr/local/wine/c or perhaps a mounted Windows C: partition). If it's not already present, you should create windows and windows/system directories in this location. You may also want to create drive letters that point to your removable-media mount points, your home directory (the F: drive is usually so configured by default, using the ${HOME} variable), and any network filesystems you've mounted. The default settings usually work well, except that you may need to change the C: settings or create an appropriate directory. Defining Type as "hd" and Filesystem as "win95" is usually best. Be sure you have full read/write access to C: and any other directories that should be so accessible.

To run a program, type wine followed by the complete path to the program. You can specify this path either as a Linux path or in the equivalent Windows format. For instance, if D: is defined as/other/shared, then /other/shared/apps/someprog.exe and D:\\apps\\someprog.exe are equivalent. Note that when using Windows format, you use backslashes (\) rather than forward slashes (/) in the filename specification. To keep the Linux shell from interpreting the backslash as an escape character, you must double up these backslashes.

The first time you use WINE, it will spend some time parsing your fonts, so the program will launch very slowly. Subsequent launches will go much more rapidly.

WINE runs many Windows programs very well, but others it handles with quirks or not at all. In some cases, you may need to install the program in Windows and then copy some DLLs or other files from Windows to your WINE installation. You can try WINE on individual programs, or check the compatibility database at http://appdb.winehq.org; however, be aware that the compatibility database includes rankings from people with different skill levels and running different versions of WINE. A bad (or good) ranking from a year ago may not be relevant to a modern version of WINE.

WINE can either run all programs in a dedicated WINE window or run Windows programs side-by-side with Linux programs. Figure 10.3 shows the latter configuration, with Microsoft Word running on the Linux desktop using Crossover Office, alongside the GIMP and other Linux programs. You can easily cut-and-paste between Linux and Windows programs.

Figure 10.3: WINE enables Windows and Linux programs to run on the same desktop.

Team LIB


Was this article helpful?

0 0

Post a comment