Stuff I've learned about Wine

If you're like me, you were probably frustrated by the state of Wine documentation when you first tried to use Wine. Sure, there are plenty of “How-to” documents out there that explain how to use it for a particular application or game, but I couldn't find any comprehensive “beginner's guide” to Wine that could give me the basic knowledge needed to begin really working with and understanding Wine. I didn't want a document that showed me how to make Half-Life 2 work, I wanted something that actually showed me how to use Wine. To that end, I began collecting all of the stuff I gathered from numerous Wikis, guides, forum posts and how-tos into a single general document. While this document does have a strong focus on running games in Wine, nearly all of the info included can be applied to running any application with Wine. Enjoy, its good stuff! 8-)
-Cogadh


[More Info]

General stuff

Wine is not an emulator
In fact, the name “WINE” used to be an acronym: “Wine Is Not an Emulator”. An emulator is a software program that creates a virtual environment for software to run in. That environment includes virtual representations of the hardware specifically required by the software and the operating system used to run it. That is not what Wine does. Wine is an alternate implementation of the Windows API. It is a compatibility layer that allows Linux to understand Windows executables and allows the Windows executable to understand Linux.
Use the latest Wine version...
…but be aware that the latest version sometimes includes bugs that were not part of previous working versions. Ubuntu Feisty includes Wine 0.9.33 in the repositories, while the current Wine version is 0.9.43 (as of this writing). Wine 0.9.33 is pretty stable, but later versions of Wine include significant DirectX improvements. I have several games that won't work with 0.9.33, but work great with 0.9.40. However, somewhere between 0.9.37 and 0.9.40, sound in KotOR 2 broke on my system. That is the perfect example of the risk involved in using the latest version.
Don't compile Wine from source
Unless you absolutely have to or you are doing it for the challenge. Every time a new version is released, an Ubuntu .deb of that version is also released on Wine's own Ubuntu repository. See WineHQ's announcement page for download details. WineHQ also has a download page for previous versions of Wine, in case you need to downgrade your Wine version.
Use the terminal
If installed correctly, Wine does associate itself with the .exe file type, so in most cases you can double click on an executable to run it. This, however, is not the recommended way to use Wine. It is better to use Wine from the terminal so that the application paths can be set appropriately (see “Always cd to the game's install path” in the Regular use stuff below) otherwise applications will often complain that they can't find needed files. Additionally, running the application from the terminal allows any error messages from Wine to be output to the terminal, which is very useful for troubleshooting purposes.
Be prepared to work for it
Wine is not perfect. Heck, it's not even complete. Not everything will work correctly at first and you may need to spend some time figuring it out on your own. But you're a Linux user now, you should already be prepared to do that on occasion.
Top

Stuff in "winecfg"

Run "winecfg"
You have to run “winecfg” at least once to set up the base Wine directories and devices. Wine won't really work until you do that.
Emulate Virtual Desktop
Using this option makes installations run so much smoother. I found instances where attempting to run an installation without this option checked caused some dialog boxes, such as CD key entry or disk swap confirmation, to not come to the front when activated. This led me to believe that the install had become “stuck” and I would end up killing the process. This can also help when troubleshooting a problem game as it won't lock up your desktop or alter your screen resolution to an unusable state when the game fails.
Use the Applications Settings
The Application Settings dialog on the winecfg Applications tab allows you to create some custom configurations for particular executables. At the moment, those configurations are limited to the OS version, some graphics settings and library settings (i.e. DLL overrides). Using the Application Settings allows you to do things like “override this DLL, but only when using blah.exe”. This is very useful when a game requires a particular native DLL, but that DLL override is not required by or is bad for other games. I use this for almost every DLL override I do, just in case an override is potentially bad for Wine. Rather than screw up Wine as a whole, I just screw up that executable's profile. I can just delete that profile without hurting Wine.
Windows version
Try different Windows versions for different applications. Just because a game was made for Windows XP doesn't mean that Wine's Windows 98 support won't work better for the game. I once had an old Windows 3.1/Windows 95 game run best if I set the Windows version to Windows NT 4.0. When you find a Windows version that works, make sure you add an application entry in winecfg for the executable.
Use the ALSA driver
Some games do require OSS to work, but unless absolutely required, always use ALSA. The OSS driver is no longer being developed and Wine's Alsa support is currently under very active development. Each new release of Wine includes significant sound improvements for ALSA.
Don't always allow the window manager to control the windows
Letting the Window manager control the windows will sometimes cause problems with running games in full screen, among other problems. Current Wine versions (0.9.39+) have corrected the full screen problems for most games but has introduced a new bug that prevents the keyboard from getting focus in the game when the window manager is not controlling the windows. This can be worked around by running the game in its own X session (see example in the Advanced stuff section).
Be careful with library overrides
winecfg gives you the ability to override Wine's built-in DLL files with Windows native DLL files. There are some DLLs that should never be overridden: kernel32.dll, gdi32.dll, user32.dll, and ntdll.dll. If you override those DLLs, Wine will not work at all. Some other DLLs will not work with games, but they don't prevent Wine itself from working. Just be careful if you override a DLL and make sure you never over-write a Wine DLL, just in case you need to go back to it.
IMPORTANT - Certain Microsoft DLLs do require you to own and accept a valid Windows license before they can be used. If you do not have a license or are not willing to accept the MS license, then don't use them.
Top

Special configuration stuff

Create a symbolic link to CD drive
Wine creates a symbolic link to the mount directory for your CD drive, but it sometimes helps to also create a symbolic link to the actual /dev entry. I found that if I didn't do this, Wine would create its own symbolic device link and would use it for the E: drive, while my mount directory was linked to the D: drive. I believe this caused issues with some CD-based installs, since two different drives in Wine were now showing identical content. Change the /dev entry on the below code to match your system:
ln -s /dev/hdc ~/.wine/dosdevices/d\:\:
Useful Registry Keys
PERFORMANCE TWEAK-
Some features and/or configurations aren't accessible through winecfg, but they can be accessed through Wine's registry. The Wine Wiki maintains a list of Useful Registry Keys and updates it with every new Wine update. Two keys I have found very useful are the Alsa Driver “UseDirectHW” option, which can correct some sound stuttering problems; and the Direct3D “VideoMemorySize” key, which allows you to enter your video card's correct memory amount. Without this key, Wine will automatically report a video memory size of 64MB. Check through the other keys to see what you can use.
WINEPREFIXCREATE
When you first run “winecfg”, it runs WINEPREFIXCREATE to create a default .wine directory, but you can use it to create a separate directory for running custom Wine configurations. I have found this useful for running games that require OSS for sound when I prefer to use ALSA. Having a separate directory for those games allows me to run them without having to run “winecfg” first to change my sound settings.
wineprefixcreate --prefix .ossgames

When running games that are in this directory, I need to modify the launch parameters with the “env WINEPREFIX=” option:

env WINEPREFIX=~/.ossgames wine "C:\Program Files\Game\Game.exe"

This environment option needs to be applied when running anything, including “winecfg”, on the custom directory.
NOTE - I have found it extremely helpful to use this to create a Wine “test lab” to try out new installs in. I can set up the test directory exactly how I want to, try out the install, mess with the configuration, add DLL files, break things, fix things… all without affecting my existing (and working) Windows application installs. If anything goes horribly wrong with installs on the test lab, I can just delete the directory and build a new one, without losing all the work I have done on my other functional Windows apps. When I am done and have figured out the correct config, I can then install the application in my existing “production” Wine directory without fear of breaking it.

Install the Wine Gecko IE engine
Some programs require Internet Explorer to be installed in order to run. However, installing Internet Explorer can severely break Wine. Instead, you should install the Wine Gecko IE engine. To install the Gecko engine, do this:
  1. Run the following in the terminal:
    wine iexplore http://www.winehq.org
  2. Answer yes to the install prompt
  3. Go to the Useful Registry Keys page and scroll down to the HKEY_LOCAL_MACHINE section.
  4. Add all of the Internet Explorer keys by using regedit.

ALTERNATE INSTRUCTIONS Occasionally, the Gecko engine may fail to download or install properly. If this happens, do the following:

  1. Open a terminal and manually download/extract the Gecko package by running the following:
    NOTE - You will need to install the cabextract package from the repositories to do this
    wget http://downloads.sourceforge.net/wine/wine_gecko-0.1.0.cab && cabextract wine_gecko-0.1.0.cab
  2. Next, run the following to create the directories needed for Gecko:
    mkdir -p ~/.wine/drive_c/windows/gecko/0.1.0/
  3. Place the extracted Gecko files into the newly created directory:
    mv wine_gecko ~/.wine/drive_c/windows/gecko/0.1.0/
  4. Run regedit in the terminal. Go to HKEY_Current_User/Software/Wine/MSHTML and create a new key labeled “0.1.0”
  5. In the new “0.1.0” key, create a new string value labeled “GeckoPath” and set the string value to “c:\windows\gecko\0.1.0\wine_gecko”
  6. Go to the Useful Registry Keys page and scroll down to the HKEY_LOCAL_MACHINE section. Add all of the Internet Explorer keys/strings to the registry.

Gecko should now be installed properly. To test the Gecko installation, run the following in the terminal:

wine iexplore http://www.winehq.org

Top

Install stuff

Use Windows ini files for info
Every install CD has an autorun.ini files and will sometimes have a setup.ini file. Checking these files out can help you troubleshoot an installation problem. Sometimes the setup.ini will give you info on what executables are being launched during the install. Knowing this can help you determine where a problem is actually occurring. For example, when trying to install a Windows 95 game, the install kept nearly completing, but would crash before I got the chance to finish. I checked the setup.ini file and found that the setup finished by calling the DirectX install executable and that executable was actually causing the problem. I created a modified setup.ini and removed the DirectX setup entry and the install completed normally (the game ended up not running though).
(Almost) Never run an install from the CD directory
Don't change directories to the CD drive in order to launch a setup executable. Doing so can sometimes prevent your CD drive from properly ejecting when you need to swap install CDs. Instead launch the install by running this from your home directory (change the path and executable name to match your system):
wine /media/cdrom/setup.exe

There are rare occasions when an install may require you to be in the CD's directory in order for the install to run, so if an install fails (usually with an error indicating it can't find some needed file) try changing directories to the CD drive and then launch the install.

"wine eject" is your friend
If an install needs you to switch CDs and the OS complains that you can't eject the CD, then open a new terminal window and run:
wine eject x:

Change the drive letter to match the drive letter you actually have configured in Wine. Alternatively you can run this:

wine eject -a

This ejects all CD-ROM/DVD-ROM drives on your system. Either way, “wine eject” will eject the current CD and usually allow the new CD to be automatically mounted. Sometimes the auto mount doesn't work, but the mount can still be performed manually.

Don't install DirectX
Wine has its own DirectX libraries, installing Microsoft's DX will screw up those libraries and Wine in general. Just don't do it.
However… the DX libraries named d3dx9_##.dll and d3dx10_##.dll can be overridden in winecfg and may provide some help with running DirectX games. Using these files does require you to own and accept a valid Microsoft Windows license.
Install the InstallShield bugfix
There is a bugfix for InstallShield that can correct some CD install problems. Use it, it will help you.
Always use the uninstaller
Use the terminal command “uninstaller” to launch the Wine uninstaller tool when you want to uninstall games. Don't try using the uninstall shortcuts that a game will sometimes place in the menu during the install. Those shortcuts often don't work right, but the Wine uninstaller tool usually will work.
NOTE - The uninstaller will not remove any application menu entries that were made during the install. You will need to manually remove these yourself.
.MSI files can be installed
Usually Windows applications use an .exe file to install the application. However, occasionally there are applications that use a Windows Installer File with an .msi extension instead (the current version of Steam, for example). There are two ways you can run this type of file in Wine:
wine msiexec /i install.msi

OR

wine start install.msi

Top

Regular use stuff

Use the Wine documentation
By that I don't mean “RTFM”. Wine has pretty good Wiki now. It is a very dry and boring read, but it does have plenty of useful info.
Use Wine's Application Database
Thousands of people are testing Wine on a daily basis and many of us add our experiences to the Application Database (AppDB) in the hopes that it will benefit other users and assist with the further development of Wine. Often AppDB entries will include installation and configuration solutions that other users have come up with. Other times, it may help you identify which games are not worth trying (yet).
How do I run something with Wine?
Wine is a terminal or command-line application. The most basic way to run an application with Wine is like this:
wine application.exe
Always cd to the game's install path
If you have ever looked at a shortcut's properties in Windows, you've probably noticed there are two path fields. One path is the path to actual executable. The other is a path labeled “Run in…”. Most Windows executables want to “Run in” the directory they were installed in, changing directories to the executable's install path accomplishes that.
Turn off WINEDEBUG
PERFORMANCE TWEAK-
When run normally, Wine is constantly producing debug messages (all those “fixme” things). Most of that info is not really needed if you already have a functional game. So to free up those resources, launch the game using the “WINEDEBUG=-all” option. No messages will be generated at all. If you are troubleshooting a game, use the “WINEDEBUG=fixme-all” to remove only the “fixme” messages, which are just developer messages and mean nothing to the normal user.
WINEDEBUG=-all wine game.exe
Get used to cracks
Without completely functional copy protection support, sometimes the only way to get a game to work in Wine is to use a cracked executable. Either get over any apprehension you may have about using cracks, or dual boot Windows and use it for the games that won't work without a crack. Someday we will hopefully have functional copy protection support in Wine and cracks will no longer be an issue.
NOTE - As of Wine 0.9.49, nearly all SecuROM protected games I have tried work without using a cracked executable. Most SafeDisk protected games still require a cracked executable. Any StarForce protected game will likely always require a cracked executable, as StarForce actually installs virtual device drivers in Windows to accomplish its task, something that will never work in Wine. I have not tried any other copy protection systems with Wine (yet).
NEVER run Wine as root or with sudo
Wine is still beta software. Allowing it unrestricted access to the system through the use of a root account or the sudo command can and will cause problems. Just don't do it.
Other Wine commands
Wine has a few commands other than “wine”, “winecfg”, “wineprefixcreate” and “uninstaller”. These commands can prove very useful:
  1. wineboot - Simulates a Windows reboot, useful for when an install requires a reboot before it can be used.
  2. wine control - Launches the Control Panel. If you install any Windows applications that make use of a Control Panel shortcut, then this is how you access it
  3. wineserver - wineserver is automatically launched by the wine command, but it can also be run from a terminal with different switches to different effect:
    • -d# - Sets the debug level in the terminal output. You might find a use for that, I never have
    • -h - Display the wineserver help file
    • -k - Kill the current wineserver. Useful if an application has locked up and you need to break out of it.
    • -p - Makes the wineserver persistent, meaning it will continue to run even after the application has closed. Useful if you intend to run several consecutive wine apps, as it can decrease wine load time
    • -w - Makes wineserver wait until the currently active wineserver exits. Again, you might find a use for that, I never have.
Wine doesn't always like to play nice
PERFORMANCE TWEAK-
If you are experiencing slow or choppy performance in a game, it can sometimes be fixed by giving the process a higher scheduling priority. This is done by using the “renice” command after launching a Wine game. The “renice” command allows you to change the priority of a currently running process, i.e. how “nice” a process is to other users on the system (higher priority = less nice, lower priority = more nice). The command has a range of -20 (highest priority) to 19 (lowest priority) and the default priority is 0. In order to use renice, you will need to open a separate terminal and run a command like this, after you have already launched your game/application:
sudo renice -10 -n game.exe

I don't recommend jumping right to using -20 to run Wine games, start with -10 and if it doesn't improve performance enough, try working up in small increments. You will likely find that most games don't require more than -10 to get the best performance. Also, it goes without saying (I think), that you must be able to ALT-TAB out of the game to run the renice command.

ALTERNATE INSTRUCTIONS For those of you that prefer the GUI method, you can do this instead to renice an app:

  1. Launch the game from a terminal, then ALT-TAB to get back to the desktop
  2. Launch System Monitor (System > Administration > System Monitor) and switch to the Processes tab
  3. Right-click on the running executable and select “Change Priority…”
  4. Move the slider to your desired prority and click “Change Priority”
  5. Enter your user password when prompted
  6. Close System Monitor and ALT-TAB back into the game

Top

Third party stuff

Wine-Doors
Wine-Doors is a graphical application that assists with the installation of many Windows applications, including games. It is currently in beta development and does have an initial release available for download. The application itself does look very promising.
NOTE - Since Wine-Doors is beta software, it should go without saying, use at your own risk.
Cedega
Cedega is technically a fork of Wine, with a specific focus on gaming. Cedega does include a GUI for running installations and launching games, plus it includes some support for copy protection software (you might not need to use a crack with Cedega). Cedega is not free, however. It has a $5 US monthly fee with a three month minimum. A small discount is offered for purchasing a full year in advance.
NOTE - Cedega was originally called WineX and branched off of the Wine tree when Wine was still under the old MIT license and not the LGPL. Because of this, Cedega does not contribute back to the Wine source tree, as it would if it was covered by the LGPL. It also does not benefit from future updates to Wine. This combined with less than spectacular support leads many people away from Cedega as a Linux gaming solution.
CrossOver
Technically, CrossOver is not a third party product, as it is the primary financial backer for Wine. CrossOver originally started as a means of running Microsoft Office applications in Linux, but has recently released a new product called Crossover Games, specifically for running Windows games in Linux. The original CrossOver is based on older, more stable versions of Wine and is still intended to be used with productivity applications. CrossOver Games uses more recent versions of Wine with greater DirectX support. Each CrossOver product costs $39.95 US to purchase the standard edition.
ReactOS
Also a Wine backer like CrossOver, ReactOS is an attempt to create a fully Windows compatible operating system based on much of the work already done in Wine. The ReactOS system, when complete, will be able to use the same drivers and applications that Windows uses, completely natively. The project is currently in alpha stages of development, but there are install CDs, live CDs, QEMU and VMware virtual machine images available for download.
NOTE - Again, since ReactOS is alpha software, it goes without saying, use at your own risk
Top

Advanced stuff

Use launch scripts
PERFORMANCE TWEAK-
Wine games will often perform their best when they are launched in a separate X server. Wine doesn't require a window manager (Gnome, KDE, XFCE, etc.) to run properly, so if you launch a game in a separate X server, you can get a significant performance boost. You can get an even bigger boost by stopping the GDM/KDM before you launch the game (only to be done from the console).
  1. First you need to create the script. From the terminal, do the following:
    nano launcher.sh
  2. Copy the text below and paste it into the terminal with either the middle mouse button or by clicking on Edit→Paste. Take out the nVidia settings portion if you don't have an nVidia card and modify the application paths to match your game.
    #!/bin/sh
    #uncomment if launching from console session
    #sudo /etc/init.d/gdm stop
    #KDE use this instead
    #sudo /etc/init.d/kdm stop
    
    # Launches a new X session on display 3. If you don't have an Nvidia card
    # take out the "& nvidia-settings --load-config-only" part
    X :3 -ac -terminate & nvidia-settings --load-config-only
    
    # Goto game dir (modify as needed)
    cd "$HOME/.wine/drive_c/Program Files/Game/Directory/"
    
    # Forces the system to have a break for 2 seconds, X doesn't launch instantly 
    sleep 2
    
    # Launches game (modify as needed)
    DISPLAY=:3 WINEDEBUG=-all wine "C:/Program Files/Game/Directory/game.exe"
  3. Save the file in your home directory by pressing CTRL-O, hit enter then CTRL-X to exit.
  4. Next, make your script executable with this command:
    chmod +x ~/launcher.sh
  5. Launch the game by doing this from a terminal:
    sh launcher.sh

    OR

    ./ launcher.sh

ALTERNATE INSTRUCTIONS If your game doesn't work, or if you want to try and squeeze some additional performance out of the game, follows these additional steps to try running it without your default X session still running:

  1. Uncomment the “sudo /etc/init.d/gdm stop” line (remove the ”#”) in the script and save it. If you use KDE, uncomment the “sudo /etc/init.d/kdm stop” and save the script.
  2. Close all open applications and switch to the console by pressing CTRL-ALT-F1.
  3. Log into the console and run the script:
    sh launcher.sh

    OR

    ./ launcher.sh

    You will be prompted for your password and your game will launch in its own X session, without the Gnome or KDE window manager getting in the way.

  4. If the script complains that you don't have permission to start the X session do this:
    nano launcher.sh

    Then modify the X server launch line of the script to read:

    sudo X :3 -ac & nvidia-settings --load-config-only

    NOTE - You can avoid having to modify the script by editing the Xwrapper.config file to allow normal users X access. Open the /etc/X11/Xwrapper.config file in a text editor using sudo, then change the “allowed_users=console” entry to “allowed_users=anybody”.

  5. Once you are finished playing, either reboot or restart your X server and desktop by doing this:
    sudo /etc/init.d/gdm start

    If you use KDE, do this instead:

    sudo /etc/init.d/kdm start

    The desktop should come right back up immediately, if it doesn't just type “startx”.

ADDITIONAL NOTES

  • If you launch a game in it's own X session, make sure that Wine's virtual desktop has been disabled.
  • Running a game in its own X server will often correct the problem with a non-functional keyboard in Wine games.
  • There are additional command line switches that could be applied when launching the new X session see the Xserver manual and Xorg manual for details.

Top

wine/winestuff.txt · Last modified: 2008/07/16 18:40 (external edit)
www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0