Skip to content
Search

Wine

lastmod 2026-03-25created 2014-02-1954 edits

Wine is a compatibility layer for running Microsoft Windows-only programs on Unix-like operating systems.

About

Wine (originally an acronym for "Wine Is Not an Emulator") is a compatibility layer capable of running Windows applications on several POSIX-compliant operating systems, such as Linux, Mac OSX, & BSD. Instead of simulating internal Windows logic like a virtual machine or emulator, Wine translates Windows API calls into POSIX calls on-the-fly, eliminating the performance and memory penalties of other methods and allowing you to cleanly integrate Windows applications into your desktop.

How to install

ArchLinux

On ArchLinux, you need to enable the multilib repository.

$ sudo pacman -S wine

If you use Internet Explorer:

$ sudo pacman -S wine-gecko

If you use .NET:

$ sudo pacman -S wine-mono

Ubuntu

Search for installable packages:

sudo apt search wine

You get a list like this:

  • wine/jammy,jammy,now 6.0.3~repack-1 all [installed,automatic] - Windows API implementation - standard suite
  • wine-binfmt/jammy,jammy 6.0.3~repack-1 all - Register Wine as the interpreter for Windows executables
  • wine-development/jammy,jammy 6.0+repack-1ubuntu1 all - Windows API implementation - standard suite
  • wine-stable/jammy,jammy,now 3.0.1ubuntu1 all [installed] - Windows API implementation (transitional package)
  • wine32/jammy,now 6.0.3~repack-1 i386 [installed,automatic] - Windows API implementation - 32-bit binary loader
  • wine32-development/jammy 6.0+repack-1ubuntu1 i386 - Windows API implementation - 32-bit binary loader
  • wine32-development-preloader/jammy 6.0+repack-1ubuntu1 i386 - Windows API implementation - prelinked 32-bit binary loader
  • wine32-development-tools/jammy 6.0+repack-1ubuntu1 i386 - Windows API implementation - 32-bit developer tools
  • wine32-preloader/jammy 6.0.3~repack-1 i386 - Windows API implementation - prelinked 32-bit binary loader
  • wine32-tools/jammy 6.0.3~repack-1 i386 - Windows API implementation - 32-bit developer tools
  • wine64/jammy,now 6.0.3~repack-1 amd64 [installed,automatic] - Windows API implementation - 64-bit binary loader
  • wine64-development/jammy 6.0+repack-1ubuntu1 amd64 - Windows API implementation - 64-bit binary loader
  • wine64-development-preloader/jammy 6.0+repack-1ubuntu1 amd64 - Windows API implementation - prelinked 64-bit binary loader
  • wine64-development-tools/jammy 6.0+repack-1ubuntu1 amd64 - Windows API implementation - 64-bit developer tools
  • wine64-preloader/jammy 6.0.3~repack-1 amd64 - Windows API implementation - prelinked 64-bit binary loader
  • wine64-tools/jammy 6.0.3~repack-1 amd64 - Windows API implementation - 64-bit developer tools
  • winetricks/jammy,jammy 0.0+20210206-2 all - simple tool to work around common problems in Wine

For now, install the stable version and winetricks:

sudo apt install wine-stable winetricks

winecfg

A GUI configuration tool for Wine; you can start it by running winecfg.

On first install, it installs packages such as mono for .NET and geko for Embedding HTML.

regedit

The registry editing tool of Wine; you can start it by running regedit. See WineHQ's article on useful registry keys.

control

An implementation of the Windows Control Panel for Wine, which you can start by running Wine control.

For the full list, see WineHQ's list of commands.

How to kill all wine processes

wineserver -k

You can force-kill them with:

wineserver -k9

Rebooting wine

wineboot

How to remove everything

Completely remove Wine packages and settings:

sudo apt purge --autoremove wine wine64 wine32 winetricks winehq-stable winehq-staging winehq-devel -y
sudo apt autoremove -y

Remove Wine user data:

# Wine prefix (설치된 Windows 앱, DirectX, .NET 등 모두 포함)
rm -rf ~/.wine

# 추가 Wine prefix가 있다면
rm -rf ~/Games  # Lutris 등에서 생성한 경우

# Wine 관련 설정/캐시
rm -rf ~/.local/share/wine
rm -rf ~/.local/share/applications/wine*
rm -rf ~/.local/share/desktop-directories/wine*
rm -rf ~/.local/share/icons/hicolor/*/apps/wine*
rm -rf ~/.config/menus/applications-merged/wine*
rm -rf ~/.cache/wine
rm -rf ~/.cache/winetricks

Check for custom prefixes:

# WINEPREFIX 환경변수 확인
grep -r "WINEPREFIX" ~/.bashrc ~/.zshrc ~/.profile 2>/dev/null

# 용량 큰 Wine prefix 찾기
find ~ -name "drive_c" -type d 2>/dev/null

If you also used Lutris, PlayOnLinux, etc.

# Lutris
rm -rf ~/.local/share/lutris

# PlayOnLinux
rm -rf ~/.PlayOnLinux

Deleting ~/.wine is the key — every Windows component installed through Wine, such as DirectX, .NET Framework, and fonts, lives there.

Fonts

If Wine applications do not show easily readable fonts, the fonts may not be installed. To easily link all system fonts so that wine can access them:

cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts
find /usr/share/fonts/ -iname '*.otf' -o -iname '*.ttf' -exec ln -s {} \;

Installing and configuring NanumGothic

sudo apt install fonts-nanum

cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts

dpkg -L fonts-nanum | grep --color=never -i '\.ttf$' | xargs -i ln -s {}

sed -i 's/"MS Shell Dlg"="Tahoma"/"MS Shell Dlg"="NanumGothic"/' ~/.wine/system.reg
sed -i 's/"MS Shell Dlg 2"="Tahoma"/"MS Shell Dlg 2"="NanumGothic"/' ~/.wine/system.reg

Displaying Korean fonts

Download fonts with winetricks. (Check the ~/.wine/drive_c/windows/Fonts folder.)

winetricks corefonts
winetricks allfonts

In the ~/.wine/system.reg file, the "MS Shell Dlg" entry is probably set to Tahoma. Change it to Gulim.

Restart wine:

wineboot

Change the environment variable to LANG=ko_KR.utf8.

Either the method above, or

setting FontSubstitute in the registry to NanumGothic still works. The path is:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes

Winetricks

Winetricks is a script that can install the basic requirements needed to run Windows programs. Installable components include DirectX 9.x, MSXML (required by Microsoft Office 2007 and Internet Explorer), the Visual Runtime libraries, and more.

sudo pacman -S winetricks

Optional dependencies for wine

  • giflib
  • lib32-giflib
  • libpng
  • lib32-libpng
  • libldap
  • lib32-libldap
  • gnutls
  • lib32-gnutls
  • mpg123
  • lib32-mpg123
  • openal
  • lib32-openal
  • v4l-utils
  • lib32-v4l-utils
  • libpulse
  • lib32-libpulse
  • alsa-plugins
  • lib32-alsa-plugins
  • alsa-lib
  • lib32-alsa-lib
  • libjpeg-turbo
  • lib32-libjpeg-turbo
  • libxcomposite
  • lib32-libxcomposite
  • libxinerama
  • lib32-libxinerama
  • ncurses
  • lib32-ncurses
  • opencl-icd-loader
  • lib32-opencl-icd-loader
  • libxslt
  • lib32-libxslt
  • gst-plugins-base-libs
  • lib32-gst-plugins-base-libs
  • vkd3d
  • lib32-vkd3d
  • sdl2
  • lib32-sdl2
  • libgphoto2
  • sane
  • gsm
  • cups
  • samba
  • dosbox

Wine Application Database (AppDB)

minit (Game)

Installed:

  • d3dcompiler_42
  • d3dcompiler_43
  • d3dcompiler_46
  • d3dcompiler_47
  • d3dx10
  • d3dx11
  • d3dx9

How it works

Wine is a compatibility layer that makes Windows programs runnable on POSIX-compatible OSes (Linux, macOS, BSD)

Valve's Steam Deck also uses a Wine-based solution

=== WINE = Wine Is Not an Emulator ===

  • Emulation is slow, and Linux/macOS can in fact run Windows binaries natively (with a little help)
  • Detailed explanation, using a debugger, of how Linux/Windows binaries work

Hello, Wine!

  • Basically, Wine is a "Dynamic Loader" for Windows executables
  • It is a native Linux binary that knows how to handle EXEs and DLLs
  • Wine reads a Windows executable into memory, parses it to work out its dependencies, and jumps to the code to be executed
  • This alone is enough to run Windows binaries, but there are exceptions

System Calls

  • System calls, called syscalls, are what make Wine complicated
  • syscalls are implemented in the OS, not contained in executables or libraries
  • The syscalls provided by the OS are the OS API
    • Linux: read, write, open, brk, getpid,..
    • Windows: NtReadFile, NtCreateProcess, NtCreateMutant,..
  • System calls differ from ordinary function calls in code. For example, something like opening a file must be handled in the kernel because it tracks File Descriptors
  • So application code needs a way to "interrupt" itself and hand control to the kernel ("Context Switch")
  • The set of functions the OS provides and how they are called differ from OS to OS
    • On Linux, calling read() requires putting the file descriptor in register %rdi, the buffer pointer in %rsi, and the number of bytes to read in %rdx
    • But Windows has no read() function in the kernel
  • Running the same code that prints "Hello World!" on Linux/Windows
    • Linux calls puts from libc.so, Windows calls printf from ucrtbase.dll
    • On Linux these days it is common to link statically, including the puts implementation in the binary, so libc.so is not used at run time
  • On Windows, at least until recently, "only Malware used system calls directly"
    • Ordinary applications always rely on kernel32.dll/kernelbase.dll/ntdll.dll and never talk to the kernel directly

Runtime translation of Syscalls

  • What if we intercept syscalls?
  • What if, when the application calls NtWriteFile(), we step in, call write(), and return the result in the format the binary expects?
  • Providing a custom version of ucrtbase.dll would make this possible, but it causes complicated problems
  • Instead, modify ntdll.dll, which sits between the binary and the kernel
  • Recent versions of Wine consist of ntdll.dll (PE binary) and ntdll.so (ELF binary)
    • The dll is a thin layer that simply redirects calls to the ELF side
    • The ELF has a special function called __wine_syscall_dispatcher that works the magic of converting the current stack from Windows to Linux, or vice versa
  • This syscall dispatcher is the bridge connecting the Windows world and the Linux world
    • It handles calling conventions, allocates stack space, moves registers, and so on
    • Once execution reaches ntdll.so and passes into the Linux binary, we can use the whole Linux API

That's all?

  • It sounds very easy, but..
    • The Windows API is enormous, poorly documented, and has known/unknown bugs that must be preserved as they are. Most Wine code is implementations of various Windows DLLs
    • There are many ways to make syscalls, and technically there is no way to stop applications from calling syscalls directly
    • (Remember that Windows games do all kinds of crazy things)
    • The Linux kernel has a special mechanism to handle this, which of course adds complexity
    • The 32bit vs 64bit issue is also nonsense. There are countless 32-bit games, and they will not be re-released as 64-bit. Wine supports both, which also adds complexity
    • wine-server has not even been mentioned here. It is a separate process created by Wine that maintains kernel "state" (file descriptors, mutexes, etc.)
    • Want to run games? You have to handle DirectX, PulseAudio, input devices, and so on, which is a huge amount of work
  • Wine has been in development for a long time and has come a long way. Today it can run recent games such as Cyberpunk 2077 or Elden Ring without any problems
  • Sometimes Wine even performs better than Windows

Docker + Wine

Troubleshooting

FATAL ERROR in Vertex Shader compilation

################################################################################
FATAL ERROR in Vertex Shader compilation
ShaderName: shdSwap

memory:67:22: error: syntax error, unexpected NEW_IDENTIFIER

at gml_Object_UberCont_Draw_77
################################################################################

Or:

################################################################################
FATAL ERROR in Vertex Shader compilation
ShaderName: shaderTemplate

D3DXCompile failed - result

at gml_Object_objControlerN_Draw_64
################################################################################

I installed the following:

  • d3dcompiler_42
  • d3dcompiler_43
  • d3dcompiler_46
  • d3dcompiler_47
  • d3dx10
  • d3dx11
  • d3dx9

Call from 7B010BE6 to unimplemented function mfplat.dll.MFCreateTempFile, aborting

In KakaoTalk, clicking a profile throws this error...

wine: Call from 7B010BE6 to unimplemented function mfplat.dll.MFCreateTempFile, aborting

Wine Mono is not installed

03b4:err:mscoree:CLRRuntimeInfo_GetRuntimeHost Wine Mono is not installed

Install Mono.

An Error has occurred while loading imports

See Winetricks#An Error has occurred while loading imports for details.

See also

Favorite site

Articles

References


  1. How_Wine_works_101_-_Reboot_and_Shine.pdf ↩

  2. How_to_install_DirectX_in_Linux_using_Wine.pdf ↩

author Zer0 sitemap