Wine Guide
Wine (a recursive acronym for "Wine Is Not an Emulator") is a compatibility layer that lets Linux run many Windows programs, especially games that don't have ported native support (or open-source game clones) on Linux. It works by converting Windows API calls into Linux syscalls and POSIX calls on the fly. While Wine may not have perfect compatibility with all software, its performance is still unmatched by any other "emulator."
Installation ~
Wine has three different release channels; stable, development, and staging. The development branch (which is the default in Arch/Artix Linux) is good for most people, whilst staging (wine-staging) contains new bugfixes/patches that haven't been integrated into the other branches yet, so it's useful if you know you need specific patches or extra features. Stable is included in stable distributions (such as Debian and its deriatives).
Wine optionally provides a "Mono" and "Gecko" component, which provides support for Microsoft's .NET framework and web rendering respectively. Wine will ask you if you want to install these each time you create a new prefix (unless you've installed the relevant packages from your package manager). It also requires a bunch of 32-bit versions of common libraries for things like audio and graphics to work with 32-bit Windows programs, which are often provided by enabling the correspondent 32-bit repository on your package manager (for example, the "multilib" repository on Arch Linux or the "lib32" repository on Artix Linux).
The installation (on Arch/Artix Linux) is as follows:
pacman -Syu wine wine-mono wine-gecko
For other distributions, I'd suggest reading the official WineHQ wiki for instructions.
Usage ~
Start by going to the directory where the Windows program resides (because most .exe files refer to other files within the same directory):
cd "~/Games/F.E.A.R. Platinum Collection/"
Next, you must utilise multiple "prefixes" (or "bottles"), which are separate Windows environments, for each program you want to run. Using one prefix per program helps prevent settings and libraries from conflicting with each other. This will also give us freedom on where the programs are installed on the disk. A good place to store prefixes is:
mkdir ~/.local/share/wine/
You can set $HOME/.local/share/wine/ as WINEPREFIX in your shell configuration if you want a "default" prefix that shares the same libraries and configurations. To create a new prefix however, set the WINEPREFIX environment variable before the Wine command:
WINEPREFIX="$HOME/.local/share/wine/fear/" wine program.exe
Inside a prefix, Wine creates a fake C:\ Windows drive and also a Z:\ drive that points to your Linux root filesystem. A Wine prefix is just the Windows environment itself; it contains Wine's registry, settings, installed libraries, and other Windows-specific data. The program files don't necessarily have to live inside the prefix.
For program installers, it's usually simplest to install the program inside C:\ (such as C:\fear\) to keep everything self-contained. Don't panic if the installer throws errors, looks stuck, or crashes after it finishes. This is quite common, and it's usually nothing. Run the installer like so:
WINEPREFIX="$HOME/.local/share/wine/fear/" wine setup.exe
If the installer is a .msi file, use msiexec:
WINEPREFIX="$HOME/.local/share/wine/fear/" wine msiexec /i setup.msi
On the other hand, if the program is already extracted or portable, the program files can live anywhere on your Linux filesystem (such as ~/Games/Geometry Dash/), and Wine can run them directly through the Z:\ drive mapping, after you've switched to the directory:
cd "$HOME/Games/Geometry Dash" WINEPREFIX="$HOME/.local/share/wine/gd/" wine gd.exe
When launching a program with wine, make sure you changed into the directory containing the executable! Alternatively, you can use wine start to launch executables or shortcuts (.lnk) directly. If the program is installed inside the prefix, you can run it with these commands, for example:
WINEPREFIX="$HOME/.local/share/wine/fear/" wine start "C:\fear\fear.exe"
WINEPREFIX="$HOME/.local/share/wine/fear/" wine start /unix "$HOME/.local/share/wine/fear/drive_c/users/Public/Desktop/fear.lnk"
If the program lives elsewhere on your Linux filesystem, run it with /unix:
WINEPREFIX="$HOME/.local/share/wine/gd/" wine start /unix "$HOME/Games/Geometry Dash/gd.exe"
Note that the /unix option defines a Filesystem Hierarchy Standard (or "Unix-style") path.
Configuration ~
It's important to familiarize yourself with the Wine configuration in case you ever need to troubleshoot or change options for compatibility. You can access it in a prefix through the winecfg command:
WINEPREFIX="$HOME/.local/share/wine/fear/" winecfg
It spawns a GUI that has a lot of tabs:
- Applications:
- Lets you set Windows versions.
- Defaults (Windows XP for 32-bit prefixes and Windows 7 for 64-bit prefixes) should be fine.
- Libraries:
- Lets you override certain libraries (such as DirectX, .NET, and Visual C++) and choose whether Wine will provide that functionality ("builtin"), or taken from within the prefix environment ("native").
- In most cases, "builtin" libraries work just fine, but if the program installed libraries in the prefix, Wine will still use its bundled versions by default, so you must manually override here if the program is acting weird. However, I'd recommend installing any required libraries using Winetricks (as will be seen below) instead of any other weird method, since Winetricks automatically overrides for you.
- Graphics:
- "Emulate a virtual desktop" is an extremely useful setting if the program doesn't scale properly, crashes, or mouse input is weird. You'll want to set the virtual desktop to be your native screen resolution, so that it'll be in fullscreen (and you should also change the program's resolution to match, so you ensure it scales properly).
- Some of the other settings related to the window manager can also be used for troubleshooting, and they help out in case the Windows program malfunctions with your window manager (since it expects Windows' default window manager, not because your window manager is "buggy").
- Desktop Integration:
- Under this menu, you'll be able to choose mappings for Windows folders (like Desktop, Documents, Pictures, etc.) on your user's home directory. If you're ever annoyed by app data appearing in your home directory's
~/Documents/for whatever reason, this is where you can change it. - Drives:
- Where the aforementioned
C:\andZ:\drives are set, if you ever needed to add another fake drive for any weird reason (you almost never need to, but it's still a niche use-case). - Audio
- Where Wine integrates with your system audio. Defaults should be fine.
- Staging
- Additional settings for the staging branch. Experimental and could break things.
Winetricks ~
Winetricks is a script that allows you to easily install official Windows versions of libraries, and it'll automatically override the "builtin" Wine versions. The script is available by installing winetricks from your package manager:
pacman -S winetricks
I suggest only using Winetricks to install the "native" libraries if the program doesn't work without them; the "builtin" Wine versions often work fine due to the rapid and constant development of Wine, and they usually have better performance.
You can run Winetricks in the command line (make sure to call the target WINEPREFIX first):
WINEPREFIX="$HOME/.local/share/wine/fear/" winetricks
Just running winetricks without any options will launch a cumbersome Qt GUI which lets you install some "tricks," but I strongly suggest learning the command line instead (issue the command winetricks --help to learn more about all of the available options).
To list all of the categories of tricks available, issue:
WINEPREFIX="$HOME/.local/share/wine/fear/" winetricks list
Of all the categories, we'll be using dlls (i.e., Windows libraries) the most. To list all of the tricks under a category (e.g., dlls) and their descriptions, type:
WINEPREFIX="$HOME/.local/share/wine/fear/" winetricks dlls list
When you find the libraries you need, just place each trick after the base winetricks command:
WINEPREFIX="$HOME/.local/share/wine/fear/" winetricks vcrun2019 vcrun2017 vcrun2015
In the above example, I installed various versions of the Visual C++ Redistributable (the best ways to find out what libraries a program or game uses would be the installer and PCGamingWiki). Other useful "tricks" are:
corefonts; the standard Windows fonts like Arial, Times New Roman, and Verdana (usually not needed in a game, but other programs might need them).sandbox; removes the link between the Wine user folders and your Linux home directory (helpful if your home directory gets messy, but some programs may behave weirdly if they expect real Desktop/Documents paths).settings fontsmooth=rgb; font smoothing (for RGB displays), which makes text look sharper and smoother.
DXVK ~
DXVK is another compatibility layer. It will, on-the-fly, convert the 3D component of DirectX (9, 10, and 11) into Vulkan instructions. DXVK will improve the performance of DirectX games under Linux, compared to the "builtin" Wine version, and it's my preferred implementation of Direct3D which I usually install right after the game (if compatible, of course). Just be warned that some anti-cheat systems may detect modified DirectX and ban you!
Before using DXVK, make sure your GPU supports Vulkan. You can verify this with the following command (provided by the vulkan-tools package):
vulkaninfo | less
If Vulkan information about your GPU appears, DXVK should work correctly (otherwise, forget about DXVK or anything Vulkan-related for now).
DXVK is distributed as a set of 32/64-bit .dll libraries that must be installed into your Wine prefix and overridden. Historically, setting up DXVK was either through dxvk-bin on the AUR or through a setup-dxvk.sh installer script (from the official GitHub releases), run like this (with the uninstall command to uninstall):
WINEPREFIX="$HOME/.local/share/wine/fear" ./setup-dxvk.sh install
Thankfully, this manual installation is no longer necessary since DXVK is provided in Winetricks!
WINEPREFIX="$HOME/.local/share/wine/fear/" winetricks dxvk
If the game uses a supported version of DirectX, it should create a fear_d3dXX.log file in the current working directory. This log shows which Direct3D version was used and records what happened during rendering.
GameMode ~
GameMode is a useful tool that enables Linux kernel optimizations whilst a game is running (it isn't a Wine-specific tool, so it can also be used on native Linux games). It can be installed (along with its 32-bit counterpart for older 32-bit games) from your package manager:
pacman -S gamemode lib32-gamemode
To use it, just add gamemoderun before your game in the command line:
WINEPREFIX="$HOME/.local/share/wine/gd/" gamemoderun wine gd.exe
Once the game is running, you can open another terminal and run gamemoded -s to see if it's active. The defaults are pretty fine for most use-cases.
Gamescope ~
From time-to-time, you may experience strange scaling issues or discrepancies with the mouse cursor behavior. Traditionally, this could be solved using the "Emulating a virtual desktop" option under winecfg, but we now have a solution (for both X11 and Wayland), which is Valve's SteamOS Gamescope microcompositor:
pacman -S gamescope
Basically, it runs your game in an environment that is isolated from your main desktop, but it runs "nested" on top of your current desktop, so you don't have to login to a new desktop session. This is incredibly useful for isolating game bugs in your chosen window manager or compositor, and you have full control over the screen resolution (this is known as a "spoofed" monitor, where you can upscale a low resolution game, limit the refresh rate, and force the game into fullscreen). Of course, just like DXVK, it uses Vulkan, so make sure your card is compatible (as seen above).
When running Gamescope commands (which are too many to cover, run gamescope --help for the full list), here are some important ones to keep in mind:
-wand-h- The screen resolution (width and height) that your game will run in.-Wand-H- This is the resolution of your spoofed monitor.-f- Make Gamescope fullscreen.-r- Refresh-rate limit.
Generally, the lowercase -w and -h should be set to the highest your game can handle (but not above your physical monitor), while the uppercase -W and -H should be the native resolution of your monitor. An example command:
WINEPREFIX="$HOME/.local/share/wine/gd" gamescope -f -r 60 -w 800 -h 600 -W 1920 -H 1080 -- gamemoderun wine gd.exe
Gamescope will now scale the old game's 800 x 600 display to fill the whole screen.
Application Launcher ~
Once the game works, it's a good idea to put the full command into a ~/.local/share/applications/). A good example looks like so:
[Desktop Entry] Type=Application Name=F.E.A.R. First Encounter Assault Recon GenericName=WINE Exec=env WINEPREFIX=/home/[username]/.local/wine/fear gamescope -f -r 60 -w 1920 -h 1080 -- gamemoderun wine start /unix "/home/[username]/.local/wine/fear/drive_c/ProgramData/Microsoft/Windows/Start Menu/Programs/GOG.com/F.E.A.R. Platinum Collection/F.E.A.R. First Encounter Assault Recon.lnk" Path=/home/[username]/.local/wine/fear/drive_c/fear Categories=Game
Note that you need to prepend env before your WINEPREFIX variable here!
Troubleshooting ~
If the game doesn't work correctly (or at all), you can try:
- Emulating a desktop (or using Gamescope if your GPU supports it).
- Launching different executables and shortcuts bundled with the program.
- Uninstalling DXVK.
- Installing libraries with Winetricks (the installer and PCGamingWiki are good resources to find out which ones are missing, sometimes just a simple web search).
- Research game-specific tweaks or workarounds on compatibility databases such as WineHQ AppDB, which is sometimes littered with outdated reports, or the more popular ProtonDB for Valve's Proton, which is just Wine with heavy patches and DXVK).
If all else fails, consider trying Proton (through Steam) if the program is a game. For non-Steam games, community builds such as GE-Proton (by GloriousEggroll) can sometimes provide hacks and workarounds that aren't yet available in either Wine or Valve's official Proton releases.