Contents

Wine Environment Variables

WINEPREFIX

Wine uses a virtual C: drive instead of your real C: drive. The directory in which this is located is called a wineprefix.

When you open any application using Wine, it will use the default location for wineprefix which is ~/.wine , but you can change this location by using WINEPREFIX environment variable.

You can find more about wineprefix in this link » [link]

How to use WINEPREFIX

Open the terminal, and type this command:

1
WINEPREFIX=[the-location-of-the-wineprefix]/[wineprefix-name] wine [the-location-of-the-executable-file]/[filename.exe]
Example

If you want to install 7z1900-x64.exe using Wine on a wineprefix at the home folder with the name wine-test, you can use this command:

1
WINEPREFIX=~/wine-test wine ~/Downloads/7z1900-x64.exe
Notes
  • If you define a wineprefix that does not exist, Wine will create a new wineprefix with the name and location you defined.
  • Wine creates 64 bit wineprefix by default which can be used to run 64 bit applications, and 32 bit applications as well, but there are some significant bugs that prevent many 32 bit applications from working in a 64 bit wineprefix. To solve this issue, you can create a new 32 bit wineprefix using the WINEARCH environment variable.

WINEARCH

WINEARCH environment variable can be used to define the architacture of the wineprefix you want to create (32bit, or 64bit). It is mostly used to create 32 bit wineprefix which is needed to install and to run 32 bit applications.

How to create 32bit wineprefix

Open the terminal, and type this command:

1
WINEARCH=win32 WINEPREFIX=~/wine-new winecfg

WINEDLLOVERRIDES

Wine uses its internal builtin DLLs by default, but It is not always possible to run an application on builtin DLLs. Sometimes native DLLs simply work better. Although these DLL overrides can be set using winecfg, you might want to use the WINEDLLOVERRIDES environment variable to set them.

When DXVK is installed on a wineprefix, d3d9, d3d10core, and dxgi will be set to native, so if you want to set all of them to builtin with a certain game, you can open the terminal, and type this command:

1
WINEDLLOVERRIDES="d3d9,d3d11,d3d10core,dxgi=b" wine [the-location-of-the-executable-file]/[filename.exe]

There are 4 different override options to choose from

Override option What it does
b (Builtin): Use the DLL provided by Wine
n (Native): Use the DLL provided by Windows
b,n (Builtin then Native): Try to load Builtin DLL first, and if it fails, load Native DLL
n,b (Native then Builtin): Try to load Native DLL first and if it fails, load Builtin DLL

WINE

Winetricks uses the default wine installed on your Linux distro, but you can use custom wine build by using WINE enviornment variable like this example:

1
WINE=~/Downloads/wine-5.11-staging-amd64/bin/wine winetricks

WINEESYNC

  • Wine Esync is used to increase performance a little bit with some games, but it could crash your games during loading or during playing the game, so it is recommended to use Wine Fsync instead.

  • Wine Esync is not included in Wine-Staging anymore, but it is included in Wine-TKG, and Wine-GE.

  • WINEESYNC is turned off by default in Wine, and in order to use it, you need first to check if your Linux distro supports it before enabling it, or your will get an error like this: eventfd: Too many open files and then things start crashing, because you’ve probably run out of file descriptors. Esync creates one eventfd descriptor for each synchronization object, and some games may use a large number of these.

Note

Linux by default limits a process to 4096 file descriptors which probably was reasonable back in the 90s but is not anymore. Fortunately Linux distros like: Debian, Ubuntu, and Linux distros that are based on Debian or Ubuntu have a reasonable number of file descriptors by default. I do not know what other Linux distros that increased the default limit to a reasonable number, but if you want to check, open the terminal, and type this command:

ulimit -Hn

If it returns with a number like: 1048576, then you are safe, but if it returns with a lower number, you need to increase it.

How to increase the limit of eventfd file descriptors

Click here to expand
  1. Open the terminal, and type this command:
1
sudo nano /etc/security/limits.conf
  1. Add this line:
1
* hard nofile 1048576
  1. Press ctrl + x to close the file, and press Y, then enter to confirm the changes.

  2. Restart your session.

But on Linux distributions using systemd (most of Linux distros use systemd), the settings in /etc/security/limits.conf will be overridden by systemd’s own settings.

If you run ulimit -Hn and it returns a lower number than the one you have previously set, then you need to add this line:

1
DefaultLimitNOFILE=1024:1048576

in both /etc/systemd/system.conf and /etc/systemd/user.conf

Then use this command:

1
sudo systemctl daemon-reexec

and restart your session.

How to use WINEESYNC

WINEESYNC is not enabled by default, you need to enable it manually when launching Wine like this:

Open the terminal, and type this command:

1
WINEESYNC=1 wine [the_location_of_the_executable_file]/[filename.exe]

After you open any application with WINESYNC enabled, you will see a terminal message like this:

esync: up and running.

Notes
  • WINEESYNC environment variable can only be used with Wine-Staging.

  • You do not need to enable WINEESYNC with Proton, because It is enabled by default.

  • If you open one application with WINEESYNC enabled, and wineserver still working in the background, you can not open another application without enabling WINEESYNC for this application as well, or it will fail to start, but you can kill wineserver using this command from the terminal:

1
wineserver -k

or this command:

1
pkill wineserver

More information about Wine Esync can be found in this link » https://github.com/zfigura/wine/blob/esync/README.esync


WINEFSYNC

Valve offers fsync as a replacement for esync, because esync relies on the kernel’s eventfd() functionality which needs special setup and can cause file descriptor exhaustion problems in event-hungry applications.

Notes
  • There is an enhanced version of FSYNC which requires Linux Kernel 5.17, or newer.

  • Wine-Staging does not include the fsync patchset (It was included before, but it is not included anymore), so you either use Wine-TKG, or Wine-GE.

How to use WINEFSYNC

Open the terminal, and type this command:

1
WINEFSYNC=1 wine [the_location_of_the_executable_file]/[filename.exe]

After you open any application with WINEFSYNC enabled, you will see a terminal message like this:

fsync: up and running.


DRI_PRIME

If you use a laptop with a dedicated AMD GPU, you will need to use DRI_PRIME environment variable to run any OpenGL games using your dedicated GPU on any Linux distribution, or when you try to run Direct3D game using WineD3D. It is not needed when you use a Desktop PC, or when running Vulkan games, or games running through DXVK, because they use your dedicated GPU by default, so if you run a Vulkan games, or you have DXVK installed inside a wineprefix, you do not need to use DRI_PRIME environment variable.

How to use DRI_PRIME

1
DRI_PRIME=1 wine [the-location-of-the-executable-file]/[filename.exe]
Notes
  • This command only works with AMD dGPUs only.

  • If you use a laptop with a dedicated Nvidia GPU, you need to use Nvidia PRIME instead.

Nvidia PRIME

Vulkan

For Vulkan games, and games running through DXVK use this env variable:

1
__NV_PRIME_RENDER_OFFLOAD=1 wine [the_location_of_the_executable_file]/[filename.exe]

OpenGL

For OpenGL games, and games running through WineD3D use this env variable:

1
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia wine [the_location_of_the_executable_file]/[filename.exe]

GameMode

GameMode optimizes Linux system performance on demand. It is made by Feral Interactive which ports native games for Linux and MacOS. (You need to install GameMode first before using it). For more information follow this link » https://github.com/FeralInteractive/gamemode

How to use GameMode

Open the terminal, and type this command:

1
gamemoderun wine [the_location_of_the_executable_file]/[filename.exe]

vkBasalt

vkBasalt is a vulkan post processing layer for linux. It is similar to ReShade (You need to install vkBasalt first before using it). For more information follow this link » https://github.com/DadSchoorse/vkBasalt

How to use vkBasalt

Open the terminal, and type this command:

1
ENABLE_VKBASALT=1 wine [the_location_of_the_executable_file]/[filename.exe]

AMD FSR

You can use AMD FSR on any Windows Vulkan game, or a game running through DXVK or VKD3D, but you need an AMD GPU.

Note
AMD FSR has not been supported by Wine, or Proton yet, you need to use either wine-tkg, or Proton-GE.

How to use AMD FSR

Open the terminal, and type this command:

1
WINE_FULLSCREEN_FSR=1 wine [the_location_of_the_executable_file]/[filename.exe]

You can control image sharpness using this variable » WINE_FULLSCREEN_FSR_STRENGTH=[N]

[N] can be replaced by a number from 5 to 0 (5 is the minimum, and 0 is the maximum)

Example
1
WINE_FULLSCREEN_FSR=1 WINE_FULLSCREEN_FSR_STRENGTH=3 wine [the_location_of_the_executable_file]/[filename.exe]
Tip
If you do not use WINE_FULLSCREEN_FSR_STRENGTH=[N], the default value will be used » 5

MangoHud

MangoHud is a Vulkan and OpenGL overlay for monitoring FPS, temperatures, CPU/GPU load and more (You need to install MangoHud first before using it). For more information follow this link » https://github.com/flightlessmango/MangoHud

How to use MangoHud

Open the terminal, and type this command:

1
mangohud wine [the_location_of_the_executable_file]/[filename.exe]

OpenGL

You need to add MANGOHUD_DLSYM=1 before mangohud env variable for some OpenGL games that may also need dlsym hooking (most of them need it).

1
MANGOHUD_DLSYM=1 mangohud wine [the_location_of_the_executable_file]/[filename.exe]

Mesa overlay

Mesa overlay displays GPU name, driver version, FPS, and frametime (This overlay only works only with Vulkan games and games running through DXVK, and it only works with AMD and Intel GPUs).

How to use Mesa overlay

Open the terminal, and type this command:

1
VK_INSTANCE_LAYERS=VK_LAYER_MESA_overlay wine [the-location-of-the-executable-file]/[filename.exe]

Gallium HUD

Gallium is another HUD from Mesa which works only with OpenGL games.

How to use Gallium HUD

Open the terminal, and type this command:

1
GALLIUM_HUD=simple,fps wine [the_location_of_the_executable_file]/[filename.exe]

DXVK HUD

DXVK HUD displays many useful information like fps, frametimes, GPU load, and VRAM. For more information follow this link » https://github.com/doitsujin/dxvk

How to use DXVK HUD

Open the terminal, and type this command:

1
DXVK_HUD=fps wine [the_location_of_the_executable_file]/[filename.exe]

PULSE_LATENCY_MSEC

This environment variable that can be used to delay the sound to fix sound issues like the constant crackling sounds that happens with some games like Battlefield 1, and The Elder Scrolls - Skyrim - Special Edition.

How to use PULSE_LATENCY_MSEC

Open the terminal, and type this command:

1
PULSE_LATENCY_MSEC=60 wine [the_location_of_the_executable_file]/[filename.exe]

WINE_LARGE_ADDRESS_AWARE

This environment variable can prevent 32bit games running through dxvk from crashing after reaching 4gb of RAM.

WINE_LARGE_ADDRESS_AWARE

1
WINE_LARGE_ADDRESS_AWARE=1 wine [the-location-of-the-executable-file]/[filename.exe]

How to use Windows command line arguments

You can use Windows command line arguments on Wine by adding them after the executable of the game.

Example

The Medium (video game) uses DX11 by default, but if you want to change it to DX12, you can use the command line arguments -dx12 by following these steps:

Open the terminal, and type this code:

1
wine [the-location-of-the-executable-file]/Medium.exe -dx12


If you have any questions, write it down below, or you can contact me directly by my E-mail account.

If you want to get notified when we post a new content by adding our RSS feed to your feed list, or by joining our Telegram channel.