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.

Warning:

Installation

Wine can be installed by enabling the multilib repository and installing the wine (development), wine-stableAUR (stable) or wine-staging (testing) package. Wine Staging is a patched version of Wine, which contains bug fixes and features that have not been integrated into the stable or development branch yet.

See also #Graphics drivers and #Sound for additional requirements.

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.

Third-party applications

These have their own communities and websites, and are not supported by the main Wine community. See Wine Wiki for more details.

  • Proton Compatibility tool made for Steam based on Wine and additional components. See ProtonDB for compatibility list.
https://github.com/ValveSoftware/Proton || protonAUR
  • PyWinery Simple graphical prefix manager for Wine.
https://github.com/ergoithz/pywinery || pywineryAUR

Configuration

Configuring Wine is typically accomplished using:

  • winecfg is a GUI configuration tool for Wine, which can be started by running .
  • regedit is Wine's registry editing tool, which can be started by running . See WineHQ's article on Useful Registry Keys.
  • control is Wine's implementation of the Windows Control Panel, which can be started by running .
  • See WineHQ's List of Commands for the full list.

WINEPREFIX

By default, Wine stores its configuration files and installed Windows programs in . 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 (the C-drive).

You can override the location Wine uses for a prefix with the 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 , and another with env WINEPREFIX=~/.win-b wine program-b.exe, the two programs will each have a separate C-drive and separate registries.

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 a 64-bit environment by default. You can change this behavior using the environment variable. Rename your directory and create a new Wine environment by running . This will get you a 32-bit Wine environment. Not setting will get you a 64-bit one.

You can combine this with to make a separate and environment:

$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg
$ WINEPREFIX=~/win64 winecfg

You can also use in combination with other Wine programs, such as winetricks (using Steam as an example):

WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam

In order to see the architecture of an existing prefix you can check its registry file. The command below reads the system registry of the prefix and returns or depending on the architecture type:

$ grep '#arch' ~/.wine/system.reg

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.

Install the correct packages for the audio driver you want to use:

Additional packages:

  • Games that use advanced sound systems (e.g. TESV: Skyrim) may additionally require installations of .

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 was not 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 dependencies

Some applications may require additional packages :

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

Wine uses FreeType to render fonts, and FreeType's defaults changed a few releases ago. Try using this environment setting for wine programs:

FREETYPE_PROPERTIES="truetype:interpreter-version=35"

Another possibility is to install Microsoft's TrueType fonts into your wine prefix. If this does not help, try running first, then as a last resort.

After running such programs, kill all Wine servers and run . Fonts should be legible now.

If the fonts look somehow smeared, import the following text file into the Wine registry with regedit:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]
"ClientSideWithRender"="N"

For high resolution displays, you can adjust dpi values in winecfg.

See also Font configuration#Applications without fontconfig support.

Enable font smoothing

A good way to improve wine font rendering is to enable cleartype font smoothing. To enable "Subpixel smoothing (ClearType) RGB":

$ WINE=${WINE:-wine} WINEPREFIX=${WINEPREFIX:-$HOME/.wine} $WINE regedit /tmp/fontsmoothing.reg 2> /dev/null

For more information, check the original answer

Desktop launcher menus

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
  • Start menu shortcuts are put in
Tip: If menu items were not created while installing software or have been lost, wine winemenubuilder may be of some use.

Creating menu entries for Wine utilities

By default, installation of Wine does not create desktop menus/icons for the software which comes with Wine (e.g. for winecfg, winebrowser, etc). This can be achieved by installing or meta-package (the latter has no additional dependencies), otherwise 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/:

And create the following file in :

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 .

Removing menu entries

Menu entries created by Wine are located in . 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:

$ 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*

Sometimes you should also remove wine-*.menu files from to completely remove items from Wine submenu in KDE.

Appearance

A similar to XP-looking theme can be downloaded. To install it, see this upstream wiki article. Lastly, use winecfg to select it.

Wine staging users may instead want to try enabling the option Enable GTK3 Theming under the Staging section of winecfg for a theme that matches the current GTK theme.

Printing

In order to use your installed printers (both local and network) with wine applications in win32 prefixes (e.g. MS Word), install the package, reboot wine (wineboot) and restart your wine application.

Networking

After installation, the lib32-gnutls package may need to be installed for applications making TLS or HTTPS connections to work.

For ICMP (ping), Wine may need the network access as described in the WineHQ FAQ:

# setcap cap_net_raw+epi /usr/bin/wine-preloader

If issues arise after this (such as an unhandled exception or privileged instruction), remove via:

# setcap -r /usr/bin/wine-preloader

Usage

See Wine User's Guide for general information on Wine usage.

See Wine Application Database (AppDB) for additional information on specific Windows applications in Wine.

Wayland

Currently Wine does not support Wayland directly, but you can use XWayland instead.

There are some efforts to support Wayland though:

  • Experimental Wayland driver for Wine, which supports using OpenGL- and Windows GDI-applications. See this and this wine-devel maillist entries.
  • wine-wayland: a custom version of Wine, which supports Wayland via Vulkan (so it supports only: DirectX 9, 10 and 11 via #DXVK and Vulkan-compatible applications).

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 package (or alternatively ). Then run it with:

$ winetricks

For using GUI you can install either (GTK) or (Qt).

CSMT

CSMT is a technology used by Wine to use a separate thread for the OpenGL calls to improve performance noticeably. Since Wine 3.2, CSMT is enabled by default.

Note that CSMT may actually hurt performance for some applications - if this is the case, disable it by runing wine regedit and set the DWORD value for HKEY_CURRENT_USER -> Software > Wine > Direct3D > csmt to 0x00 (disabled).

Further information:

Phoronix Forum discussion with the CSMT developer Stefan Dösinger

Force OpenGL mode in games

Some games might 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 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.

VKD3D-Proton

VKD3D-Proton is a fork of VKD3D which aims to implement the full Direct3D 12 API using Vulkan. The project serves as the development effort for Direct3D 12 support in Proton improving performance and compatibility for DirectX 12 games.

To use it, install . Then run the following command to activate it in your Wineprefix (by default ):

$ WINEPREFIX=your-prefix setup_vkd3d_proton install

DXVK

DXVK is a promising new implementation for DirectX 9, 10 & 11 over Vulkan. This should allow for greater performance, and in some cases, even better compatibility. Battlefield 1 for example, only runs under DXVK. On the other hand, DXVK does not support all Wine games (yet).

To use it, install . Then run the following command to activate it in your Wineprefix (by default ):

$ WINEPREFIX=your-prefix setup_dxvk install

While using DXVK with a dual graphics setup, Wine prefers the dedicated GPU. On laptops for power saving, this can be overridden:

$ VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/your_gpu.json wine executable

Gallium Nine

With the open-source gallium-based drivers (mostly AMD and Intel cards) there is a Gallium Direct3D state tracker that aims to provide nearly-native performance for DirectX 9. In most cases it has less visual glitches than the upstream wine and doubles the performances. It consumes much less CPU time than CSMT.

Install wine-nine to use it. This is a standalone package that can be installed with any Wine version. Use to check if it is enabled.

For older Intel graphics (gen4-7: GMA 3000, GMA 4500, HD 2000-5000; year 2006-2014) Crocus Gallium driver should be used instead of i965 since Mesa 21.2. Export the following environment variable before running Wine:

MESA_LOADER_DRIVER_OVERRIDE=crocus

Unregister existing Wine file associations

By default, Wine takes over as the default application for a lot of formats. Some (e.g. or ) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. , jpeg, , ) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.

Wine's file associations are set in as 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/

Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.

Prevent Wine from creating filetype associations

This method prevents the creation of filetype associations but retains the creation of XDG .desktop files (that you might see e.g. in menus).

If you want to stop wine from creating filetype associations via winecfg you have to uncheck the "Manage File Associations" checkbox under the Desktop Integration tab. See Wine FAQ

To make the same change via registry add the string with value under:

HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations

You might have to create the key FileOpenAssociations first!

To make this change via the command-line, run the following command:

$ wine reg add "HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations" /v Enable /d N

If you want to apply this by default for new WINEPREFIXES, edit and add this line for example under the section:

HKCU,"Software\Wine\FileOpenAssociations","Enable",2,"N"

To prevent a package upgrade from overriding the modified file, create a pacman hook to make the change automatically:

/etc/pacman.d/hooks/stop-wine-associations.hook
[Trigger]
Operation = Install
Operation = Upgrade
Type = Path
Target = usr/share/wine/wine.inf

[Action]
Description = Stopping Wine from hijacking file associations...
When = PostTransaction
Exec = /bin/sh -c '/usr/bin/grep -q "HKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"" /usr/share/wine/wine.inf || /usr/bin/sed -i "s/\[Services\]/\[Services\]\nHKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"/g" /usr/share/wine/wine.inf'

See Pacman#Hooks for more information.

Execute Windows binaries with Wine implicitly

The package installs a binfmt file which will allows you to run Windows programs directly, e.g. will launch as if you had typed . Service starts by default on boot, if you have not rebooted after installing Wine you can start to use it right away.

Dual Head with different resolutions

If you have issues with dual-head setups and different display resolutions you are probably missing .

Also installing might fix dual-head issues with wine (for example, unclickable buttons and menus of application in the right most or bottom most monitor, not redrawable interface of application in that zone, dragging mouse cursor state stucked after leaving application area).

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 disc 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 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.

Show FPS overlay in games

Wine features an embedded FPS monitor which works for all graphical applications if the environment variable is set. This will output the framerate to stdout. You can display the FPS on top of the window thanks to from the package. See winefps.sh for a helper script.

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

Now switch to another TTY and start your X WM or DE as you normally would or keep reading...

Note: The following approach only works when enabling root for Xorg. See Xorg#Rootless Xorg for more information on how to execute the xhost command under your main user.

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 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:

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: . See Sudo#Configuration for more information.

It is recommended to run 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 share a PulseAudio daemon for information about allowing the Wine user to access the PulseAudio daemon of the principal user.

Temp directory on tmpfs

To prevent Wine from writing its temporary files to a physical disk, one can define an alternative location, like tmpfs. Remove Wine's default directory for temporary files and creating a symlink:

$ rm -r ~/.wine/drive_c/users/$USER/Temp ~/.wine/drive_c/windows/temp
$ ln -s /tmp/ ~/.wine/drive_c/users/$USER/Temp
$ ln -s /tmp/ ~/.wine/drive_c/windows/temp

Prevent installing Mono/Gecko

If Gecko and/or Mono are not present on the system nor in the Wine prefix, Wine will prompt to download them from the internet. If you do not need Gecko and/or Mono, you might want to disable this dialog, by setting the environment variable to .

Vulkan

The default Wine Vulkan ICD loader works fine for most applications, but does not support advanced features, like Vulkan layers. To use these features, you have to install the official Vulkan SDK, see step 2-4 on the original Vulkan patches author's GitHub page.

Remove Wine file bindings

For security reasons it may be useful to remove the preinstalled Wine bindings so Windows applications cannot be launched directly from a file manager or from the browser (Firefox offers to open EXE files directly with Wine!). If you want to do this, you may add the following to the [options] section in

NoExtract = usr/lib/binfmt.d/wine.conf
NoExtract = usr/share/applications/wine.desktop

WineASIO

If you need professional audio support under wine you can use which provides an ASIO interface for wine that you can then use with JACK.

In order to use wineasio you must add yourself to the user group.

Next you need to register wineasio in your desired wine prefix. Register the 32-bit and/or 64-bit version as needed:

$ regsvr32 /usr/lib32/wine/i386-windows/wineasio.dll
$ wine64 regsvr32 /usr/lib/wine/x86_64-windows/wineasio.dll

Troubleshooting

See Wine User's Guide and Wine FAQ (especially its Troubleshooting section) for general tips.

Also refer to the Wine AppDB for an advice on specific applications.

XWayland problems

If you use Wine under XWayland, you can activate the option for "Emulating a virtual desktop" in the Graphics Tab in winecfg, to avoid problems with:

  • flickering;
  • wrong window location;
  • wrong mouse cursor location and clicks;
  • keyboard detection.

Keyboard input not working

This could be caused by the window manager not switching focus. In the Graphics tab of winecfg, disable the 'Allow the window manager...' options, or set windowed mode with 'Emulate a virtual desktop'.

  • Some suggest to toggle all the Window settings, click Apply, then change them back. If that does not work, try the above.

If the keyboard does not work after unfocusing the application, try editing the registry:

  • Under , add a string value and set it to .
  • Alternatively, you can use winetricks to set the value:
gollark: https://what-if.xkcd.com/imgs/a/54/mars_netherlands.png
gollark: All the basic infrastructure to run other stuff is around, you can run... basically whatever else... over TCP/IP and it should work.
gollark: Nobody is stopping you from running Gopher or something instead.
gollark: Yet another reason to just block (almost) all advertising!
gollark: You can just say "I'll search (for) that", no need to bring particular companies into this.

See also

This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.