Wine
Wine is a compatibility layer capable of running Microsoft Windows applications on Unix-like operating systems. Programs running in Wine act as native programs would, without the performance/memory penalties of an emulator.
Contents
- 1 Installation
- 2 Configuration
- 3 Usage
-
4 Tips and tricks
- 4.1 Wineconsole
- 4.2 Winetricks
- 4.3 CSMT patch
- 4.4 Unregister existing Wine file associations
- 4.5 Prevent new Wine file associations
- 4.6 Dual Head with different resolutions
- 4.7 Changing the language
- 4.8 Using Wine as an interpreter for Win16/Win32 binaries
- 4.9 16-bit programs
- 4.10 Burning optical media
- 4.11 Proper mounting of optical media images
- 4.12 Force OpenGL mode in games
- 4.13 Show FPS overlay in games
- 4.14 Microsoft Office
- 4.15 Running Wine under a separate user account
- 5 Third-party applications
- 6 See also
Installation
Wine can be installed by enabling the Multilib repository and installing the wine (stable) or wine-staging (testing) package. Wine Staging is a patched version of Wine, which contains bug fixes and features (e.g. CSMT patch), which have not been integrated into the stable branch yet. See also #Graphics drivers and #Sound.
Consider installing wine_gecko and wine-mono for applications that depend on Internet Explorer and .NET, respectively. These packages are not strictly required as Wine will download the relevant files as needed. However, having the files downloaded in advance allows you to work off-line and makes it so Wine does not download the files for each Wine prefix needing them.
Configuration
Configuring Wine is typically accomplished using:
- winecfg is a GUI configuration tool for Wine, which can be started by running
winecfg
. - regedit is Wine's registry editing tool, which can be started by running
regedit
. See WineHQ's article on Useful Registry Keys. - control is Wine's implementation of the Windows Control Panel, which can be started by running
wine control
. - See WineHQ's List of Commands for the full list.
WINEPREFIX
By default, Wine stores its configuration files and installed Windows programs in ~/.wine
. This directory is commonly called a "Wine prefix" or "Wine bottle". It is created/updated automatically whenever you run a Windows program or one of Wine's bundled programs such as winecfg. The prefix directory also contains a tree which your Windows programs will see as C:
(the C-drive).
You can override the location Wine uses for a prefix with the WINEPREFIX
environment variable. This is useful if you want to use separate configurations for different Windows programs. The first time a program is run with a new Wine prefix, Wine will automatically create a directory with a bare C-drive and registry.
For example, if you run one program with $ env WINEPREFIX=~/.win-a wine program-a.exe
, and another with $ env WINEPREFIX=~/.win-b wine program-b.exe
, the two programs will each have a separate C-drive and separate registries.
Z:
is mapped to /
, regardless of the Wine prefix).To create a default prefix without running a Windows program or other GUI tool you can use:
$ env WINEPREFIX=~/.customprefix wineboot -u
WINEARCH
Wine will start an 64-bit environment by default. You can change this behavior using the WINEARCH
environment variable. Rename your ~/.wine
directory and create a new Wine environment by running $ WINEARCH=win32 winecfg
. This will get you a 32-bit Wine environment. Not setting WINEARCH
will get you a 64-bit one.
You can combine this with WINEPREFIX
to make a separate win32
and win64
environment:
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg $ WINEPREFIX=~/win64 winecfg
You can also use WINEARCH
in combination with other Wine programs, such as winetricks (using Steam as an example):
WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam
To have them permanently defined for bash configuration ~/.bashrc do:
export WINEPREFIX=$HOME/.config/wine/ export WINEARCH=win32
Graphics drivers
You need to install the 32-bit version of your graphics driver. Please install the package that is listed in the OpenGL (Multilib) column in the table in Xorg#Driver installation.
A good sign that your drivers are inadequate or not properly configured is when Wine reports the following in your terminal window:
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly
Sound
By default sound issues may arise when running Wine applications. Ensure only one sound device is selected in winecfg.
- If you want to use the ALSA driver in Wine, you will need to install lib32-alsa-lib and lib32-alsa-plugins.
- If you want to use the PulseAudio driver in Wine, you will need to install the lib32-libpulse package.
- If you want to use the OSS driver in Wine, you will need to install the lib32-alsa-oss package. The OSS driver in the kernel will not suffice.
- Games that use advanced sound systems (e.g. TESV: Skyrim) may additionally require installations of lib32-openal.
If winecfg still fails to detect the audio driver (Selected driver: (none)), configure it via the registry. For example, in a case where the microphone wasn't working in a 32-bit Windows application on a 64-bit stock install of wine-1.9.7, this provided full access to the sound hardware (sound playback and mic): open regedit, look for the key HKEY_CURRENT_USER → Software → Wine → Drivers, and add a string called Audio and give it the value alsa. Also, it may help to recreate the prefix.
MIDI support
MIDI was a quite popular system for video games music in the 90's. If you are trying out old games, it is not uncommon that the music will not play out of the box. Wine has excellent MIDI support. However you first need to make it work on your host system, as explained in MIDI. Last but not least you need to make sure Wine will use the correct MIDI output.
Other libraries
- Some applications (e.g. Office 2003/2007) require the MSXML library to parse HTML or XML, in such cases you need to install lib32-libxml2.
- Some applications that play music may require lib32-mpg123.
- Some applications that use a color management engine (e.g. pdf viewers, image viewers, etc) may require lib32-lcms2.
- Some applications that use native image manipulation libraries may require lib32-giflib and lib32-libpng.
- Some applications that require encryption support may require lib32-gnutls.
- Some applications require 32-bit video codecs or the program crashes. Install extra/gst-plugins-{base,good,bad,ugly}, multilib/lib32-gst-plugins-{base,good}, lib32-gst-plugins-badAUR and lib32-gst-plugins-uglyAUR.
Fonts
If Wine applications are not showing easily readable fonts, you may not have any fonts installed. To easily link all of the system fonts so they are accessible from wine:
cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts && for i in /usr/share/fonts/**/*.{ttf,otf}; do ln -s "$i" ; done
Another possibility is to install Microsoft's Truetype fonts into your wine prefix. See MS Fonts. If this does not help, try running winetricks corefonts
first, then winetricks allfonts
as a last resort.
After running such programs, kill all Wine servers and run winecfg
. Fonts should be legible now.
If the fonts look somehow smeared, import the following text file into the Wine registry with regedit:
[HKEY_CURRENT_USER\Software\Wine\X11 Driver] "ClientSideWithRender"="N"
See also Font configuration#Applications without fontconfig support.
When a Windows application installer creates a shortcut Wine creates a .desktop
file instead. The default locations for those files in Arch Linux are:
- Desktop shortcuts are put in
~/Desktop
- Start menu shortcuts are put in
~/.local/share/applications/wine/Programs/
.desktop
files in /usr/share/applications
. See WineHQ bug 11112
wine winemenubuilder
may be of some use.By default, installation of Wine does not create desktop menus/icons for the software which comes with Wine (e.g. for winecfg, winebrowser, etc). These instructions will add entries for these applications.
First, install a Windows program using Wine to create the base menu. After the base menu is created, you can create the following files in ~/.local/share/applications/wine/
:
wine-browsedrive.desktop
[Desktop Entry] Name=Browse C: Drive Comment=Browse your virtual C: drive Exec=wine winebrowser c: Terminal=false Type=Application Icon=folder-wine Categories=Wine;
wine-uninstaller.desktop
[Desktop Entry] Name=Uninstall Wine Software Comment=Uninstall Windows applications for Wine Exec=wine uninstaller Terminal=false Type=Application Icon=wine-uninstaller Categories=Wine;
wine-winecfg.desktop
[Desktop Entry] Name=Configure Wine Comment=Change application-specific and general Wine options Exec=winecfg Terminal=false Icon=wine-winecfg Type=Application Categories=Wine;
And create the following file in ~/.config/menus/applications-merged/
:
wine.menu
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN" "http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd"> <Menu> <Name>Applications</Name> <Menu> <Name>wine-wine</Name> <Directory>wine-wine.directory</Directory> <Include> <Category>Wine</Category> </Include> </Menu> </Menu>
If these settings produce a ugly/non-existent icon, it means that there are no icons for these launchers in the icon set that you have enabled. You should replace the icon settings with the explicit location of the icon that you want. Clicking the icon in the launcher's properties menu will have the same effect. A great icon set that supports these shortcuts is GNOME-colors.
Menu entries created by Wine are located in ~/.local/share/applications/wine/Programs/
. Remove the program's .desktop entry to remove the application from the menu.
In addition to remove unwanted extensions binding by Wine, execute the following commands (taken from the Wine website):
$ rm ~/.local/share/mime/packages/x-wine* $ rm ~/.local/share/applications/wine-extension* $ rm ~/.local/share/icons/hicolor/*/*/application-x-wine-extension* $ rm ~/.local/share/mime/application/x-wine-extension*
Mono and Gecko
when initializing a new wineprefix wine will ask to install mono and gecko. or if the packages wine-mono and wine_gecko are installed wine will silently copy about 450 mb of mono and gecko files in the wineprefix.
to prevent wine from asking to install mono and gecko start wine like this:
WINEDLLOVERRIDES=mscoree=d;mshtml=d wine somewineapp
Printing
In order to use your installed printers (both local and network) with wine applications in win32 prefixes (e.g. MS Word), install the lib32-libcups package, reboot wine (wineboot) and restart your wine application.
Usage
See Wine FAQ and Wine User's Guide for general information on Wine usage.
See Wine Application Database (AppDB) for information on running Windows applications in Wine.
Tips and tricks
Wineconsole
Often you may need to run .exe's to patch game files, for example a widescreen mod for an old game, and running the .exe normally through Wine might yield nothing happening. In this case, you can open a terminal and run the following command:
$ wineconsole cmd
Then navigate to the directory and run the .exe file from there.
Winetricks
Winetricks is a script to allow one to install base requirements needed to run Windows programs. Installable components include DirectX 9.x, MSXML (required by Microsoft Office 2007 and Internet Explorer), Visual Runtime libraries and many more.
Install the winetricks package (or alternatively winetricks-gitAUR). Then run it with:
$ winetricks
CSMT patch
Since 2013 Wine developers have been experimenting with stream/worker thread optimizations. You may experience an enormous performance improvement by using this experimental patched Wine versions. Many games may run as fast as on Windows or even faster. This Wine patch is known as CSMT patch and works with NVidia and AMD graphics cards.
Wine-staging includes CSMT support (included again since version 1.9.10), and can be installed with the wine-staging package.
CSMT support needs to be enabled in winecfg
(Staging tab) before it can be used.
Further information:
- Phoronix Forum discussion with the CSMT developer Stefan Dösinger
- Here you find some game videos running with CSMT enabled
Unregister existing Wine file associations
By default, Wine takes over as the default application for a lot of formats. Some (e.g. vbs
or chm
) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. gif
, jpeg
, txt
, js
) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.
Wine's file associations are set in ~/.local/share/applications/
as {{ic|wine-extension-{extension}.desktop}} files. Delete the files corresponding to the extensions you want to unregister. Or, to remove all wine extensions:
$ rm -f ~/.local/share/applications/wine-extension*.desktop $ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*
Next, remove the old cache:
$ rm -f ~/.local/share/applications/mimeinfo.cache $ rm -f ~/.local/share/mime/packages/x-wine* $ rm -f ~/.local/share/mime/application/x-wine-extension*
And, update the cache:
$ update-desktop-database ~/.local/share/applications $ update-mime-database ~/.local/share/mime/
Alternatively you can delete all wine related stuff:
$ find ~/.local/share -name "*wine*" | xargs --no-run-if-empty rm -r
And update the cache as above.
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.
Prevent new Wine file associations
To prevent wine from creating any file associations edit your $WINEPREFIX/system.reg
file, Search for winemenubuilder
and remove -a
, so you'll get:
$WINEPREFIX/system.reg
[Software\\Microsoft\\Windows\\CurrentVersion\\RunServices] "winemenubuilder"="C:\\windows\\system32\\winemenubuilder.exe -r"
This has to be done for each WINEPREFIX which should not update file associations.
You can disable winemenubuilder for all WINEPREFIXes by setting an environment variable:
$ export WINEDLLOVERRIDES="winemenubuilder.exe=d"
Dual Head with different resolutions
If you have issues with dual-head setups and different display resolutions you are probably missing lib32-libxrandr.
Also installing lib32-libxinerama might fix dual-head issues with wine.
Changing the language
Some programs may not offer a language selection, they will guess the desired language upon the sytem locales. Wine will transfer the current environment (including the locales) to the application, so it should work out of the box. If you want to force a program to run in a specific locale (which is fully generated on your system), you can call Wine with the following setting:
$ LC_ALL=xx_XX.encoding wine /path/to/program
For instance
$ LC_ALL=it_IT.UTF-8 wine /path/to/program
Using Wine as an interpreter for Win16/Win32 binaries
It is also possible to tell the kernel to use Wine as an interpreter for all Win16/Win32 binaries:
# echo ':DOSWin:M::MZ::/usr/bin/wine:' > /proc/sys/fs/binfmt_misc/register
To make the setting permanent, create the /etc/binfmt.d/wine.conf
file with the following content:
/etc/binfmt.d/wine.conf
# Start WINE on Windows executables :DOSWin:M::MZ::/usr/bin/wine:
systemd automatically mounts the /proc/sys/fs/binfmt_misc
filesystem using proc-sys-fs-binfmt_misc.mount
(and automount) and runs the systemd-binfmt.service
to load your settings.
Try it out by running a Windows program:
$ chmod +x exefile.exe $ ./exefile.exe
If all went well, exefile.exe should run.
16-bit programs
Upon running older Windows 9x programs, the following error may be encountered:
modify_ldt: Invalid argument err:winediag:build_module Failed to create module for "krnl386.exe", 16-bit LDT support may be missing. err:module:attach_process_dlls "krnl386.exe16" failed to initialize, aborting
In this case, running the following may fix it:
# echo 1 > /proc/sys/abi/ldt16
Source: Fedora Mailing List
Burning optical media
To burn CDs or DVDs, you will need to load the sg
kernel module.
Proper mounting of optical media images
Some applications will check for the optical media to be in drive. They may check for data only, in which case it might be enough to configure the corresponding path as being a CD-ROM drive in winecfg. However, other applications will look for a media name and/or a serial number, in which case the image has to be mounted with these special properties.
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). CDEmu will handle it correctly.
Force OpenGL mode in games
Many games have an OpenGL mode which may perform better than their default DirectX mode. While the steps to enable OpenGL rendering is application specific, many games accept the -opengl
parameter.
$ wine /path/to/3d_game.exe -opengl
You should of course refer to your application's documentation and Wine's AppDB for such application specific information.
Show FPS overlay in games
Wine features an embedded FPS monitor which works for all graphical applications if the environment variable WINEDEBUG=fps
is set. This will output the framerate to stdout. You can display the FPS on top of the window thanks to osd_cat
from the xosd package. See winefps.sh for a helper script.
Microsoft Office
Install the wine-mono wine_gecko samba and lib32-libxml2 packages.
See Wine AppDB page for more information.
Running Wine under a separate user account
It may be desirable to run Wine under a specifically created user account in order to reduce concerns about Windows applications having access to your home directory.
First, create a user account for Wine:
# useradd -m -s /bin/bash wineuser
Afterwards, in order to open Wine applications using this new user account you need to add the new user to the X server permissions list:
$ xhost +SI:localuser:wineuser
Finally, you can run Wine via the following command, which uses env
to launch Wine with the environment variables it expects:
$ sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine arguments
It is possible to automate the process of running Windows applications with Wine via this method by using a shell script as follows:
/usr/local/bin/runaswine
#!/bin/bash xhost +SI:localuser:wineuser sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine "$@"
Wine applications can then be launched via:
$ runaswine "C:\path\to\application.exe"
In order to not be asked for a password each time Wine is run as another user the following entry can be added to the sudoers file: mainuser ALL=(wineuser) NOPASSWD: ALL
. See Sudo#Configuration for more information.
It is recommended to run winecfg
as the Wine user and remove all bindings for directories outside the home directory of the Wine user in the "Desktop Integration" section of the configuration window so no program run with Wine has read access to any file outside the special user's home directory.
Keep in mind that audio will probably be non-functional in Wine programs which are run this way if PulseAudio is used. See PulseAudio/Examples#Allowing multiple users to use PulseAudio at the same time for information about allowing the Wine user to access the PulseAudio daemon of the principal user.
Third-party applications
These have their own communities and websites, and are not supported by greater Wine community. See Wine Wiki for more details.
- CrossOver — Paid, commercialized version of Wine which provides more comprehensive end-user support.
- exe-thumbnailer — Generates thumbnails for Windows executable files (.exe, .lnk, .msi, and .dll).
- PlayOnLinux — Graphical prefix manager for Wine. Contains scripts to assist with program installation and configuration.
- PyWinery — Simple graphical prefix manager for Wine.
- Q4Wine — Graphical prefix manager for Wine. Can export Qt themes into the Wine configuration for better integration.
See also
- Wine Homepage
- Wine Wiki
- Wine Application Database (AppDB) - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)
- Wine Forums - A great place to ask questions after you have looked through the FAQ and AppDB
- Wine - Gentoo Wiki