Linux/wine
Wine
sudo dpkg --add-architecture i386 sudo apt update sudo apt install --install-recommends winehq-staging
Rebuild Wine Prefix (~/.wine)
wineboot -u
Test new wine prefix:
WINEPREFIX=~/my_new_prefix wine your_executable.exe
Test wine with executable:
xvfb-run -a wine your_executable.exe
Reconfig your wine prfix:
rm -rf .wine winecfg # or if headless... xvfg-run wincfg
Debug Wine
If you are still stuck, you can generate a cleaner log file to parse by running your app with standard Wine debugging output:
WINEDEBUG=-all,err+all wine your_application.exe
Clean Prefix
# Remove the broken configuration directory rm -rf ~/.wine
# Initialize a clean, default 64-bit prefix wineboot --init
-- Explicit Clean 64 --
# Create a fresh 64-bit testing environment WINEPREFIX=~/.wine_test WINEARCH=win64 wineboot --init
# Run the test program in that environment WINEPREFIX=~/.wine_test wine winetest.exe
Wine cmd.exe Test
wine cmd.exe
Wine Console Test
winetest.cpp ::
#include <iostream>
#include <windows.h>
#include <fstream>
#include <string>
int main() {
std::cout << "========================================\n";
std::cout << " Wine Windows Console Test \n";
std::cout << "========================================\n\n";
// 1. Test Windows API Version Detection
std::cout << "[1] Checking Windows API Memory Status...\n";
MEMORYSTATUSEX memInfo;
memInfo.dwLength = sizeof(MEMORYSTATUSEX);
if (GlobalMemoryStatusEx(&memInfo)) {
std::cout << " -> Success! Total Physical Memory: "
<< memInfo.ullTotalPhys / (1024 * 1024) << " MB\n\n";
} else {
std::cout << " -> Failed to retrieve memory status.\n\n";
}
// 2. Test Environment Variables
std::cout << "[2] Checking Environment Variables...\n";
char username[256];
DWORD username_len = sizeof(username);
if (GetUserNameA(username, &username_len)) {
std::cout << " -> Current User: " << username << "\n\n";
} else {
std::cout << " -> Failed to get username.\n\n";
}
// 3. Test File System Write/Read under Wine
std::cout << "[3] Testing File System I/O...\n";
std::string testFilename = "wine_test_file.txt";
std::ofstream outFile(testFilename);
if (outFile.is_open()) {
outFile << "Wine compatibility test successful!";
outFile.close();
std::cout << " -> Successfully wrote to " << testFilename << "\n";
std::ifstream inFile(testFilename);
std::string fileContent;
if (std::getline(inFile, fileContent)) {
std::cout << " -> Successfully read: \"" << fileContent << "\"\n";
}
inFile.close();
// Clean up
DeleteFileA(testFilename.c_str());
} else {
std::cout << " -> Failed file I/O test.\n";
}
std::cout << "\n";
// 4. Test Registry Read (Optional but good for Wine)
std::cout << "[4] Testing Registry Access (HKLM)...\n";
HKEY hKey;
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
char prodName[256];
DWORD bufferSize = sizeof(prodName);
if (RegQueryValueExA(hKey, "ProductName", NULL, NULL, (LPBYTE)prodName, &bufferSize) == ERROR_SUCCESS) {
std::cout << " -> Reported OS: " << prodName << "\n\n";
} else {
std::cout << " -> Opened key, but failed to read ProductName.\n\n";
}
RegCloseKey(hKey);
} else {
std::cout << " -> Failed to open registry key.\n\n";
}
std::cout << "Tests completed. Press ENTER to exit.";
std::cin.get();
return 0;
}
On Linux cross compile with:
x86_64-w64-mingw32-g++ -o winetest.exe winetest.cpp -static
# apt install g++-mingw-w64-x86-64-posix # version 13.2.0-6ubuntu1+26.1, or # apt install g++-mingw-w64-x86-64-win32 # version 13.2.0-6ubuntu1+26.1
On Windows compile with:
cl /EHsc winetest.cpp
Rune in wine:
wine winetest.exe xvfb-run -a wine winetest.exe
Issues
/dev/dri permission issue
Errors in wine log:
$ wine winetest.exe ... libEGL warning: failed to open /dev/dri/renderD128: Permission denied libEGL warning: failed to open /dev/dri/renderD128: Permission denied libEGL warning: failed to open /dev/dri/card1: Permission denied libEGL warning: failed to open /dev/dri/renderD128: Permission denied libEGL warning: failed to open /dev/dri/renderD128: Permission denied libEGL warning: failed to open /dev/dri/card1: Permission denied
Probably benign, but if you want, you can add the user to the "video" and "render" group, and that should fix both of these. (it did for me)
$ grep steam /etc/group video:x:44:steam render:x:109:steam steam:x:1005:
explorer process failed to start
Error in wine logs:
$ wine winetest.exe ... 00f0:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 00f0:err:winediag:nodrv_CreateWindow L"The explorer process failed to start." 00f0:err:systray:initialize_systray Could not create tray window
I ignored these, although running with xvfb-run got rid of these, but had other issues
Could not get DRI3 device
When running with xvfb-run...
$ xvfb-run wine winetest.exe ... libEGL warning: DRI3 error: Could not get DRI3 device libEGL warning: Ensure your X server supports DRI3 to get accelerated rendering X connection to :99 broken (explicit kill or server shutdown). X connection to :99 broken (explicit kill or server shutdown). X connection to :99 broken (explicit kill or server shutdown).
I ignored these... but....
Running with "-a" option did seem to fix most of these, just left a single "explicit kill" message only...
$ xvfb-run -a wine winetest.exe ... X connection to :99 broken (explicit kill or server shutdown).