Showing posts with label Wine. Show all posts
Showing posts with label Wine. Show all posts

Saturday, May 09, 2026

distrobox: Opening Images in Native GIMP from IrfanView Running Under Wine in Distrobox

I use IrfanView via Wine inside a Distrobox container and wanted its external editor feature to open images directly in native GIMP. IrfanView passes the image path in Windows format (Z:\home\home-folder\Pictures\photo.jpg), so a small Python script handles the conversion and launches GIMP. Sounds simple. It wasn't.

Two things needed fixing before GIMP would even start. First, GIMP's sandboxed image loader (glycin) uses bubblewrap, which cannot create user namespaces inside a container — fixed with GLYCIN_DISABLE_SANDBOX=1. Second, any process launched from the script died the moment the script exited, because Wine kills all child processes when its own child (the Python script) returns.

Even after solving those, GIMP crashed every time it tried to open a file, with a GTK3 assertion failure inside GtkFileChooserWidget. The same command worked perfectly from the shell. The environment variables were identical. The difference turned out to be invisible to env: Wine installs a seccomp filter on its processes, and that filter is inherited by every child process across fork and exec. No amount of environment tweaking or session detachment can clear an inherited seccomp filter. GTK's file chooser widget makes a syscall during initialisation that Wine's filter blocks, and GIMP crashes.

The fix is to launch GIMP as a transient systemd user service with systemd-run --user --no-block. A process started this way is owned by systemd, not Wine — clean process state, no inherited seccomp filter, completely outside Wine's process tree.

#!/usr/bin/python
import os, sys, subprocess

def convert_wine_path(p):
    return p.replace('\\', '/').replace('Z:', '')

env = os.environ.copy()
img_file = convert_wine_path(sys.argv[1]) if len(sys.argv) == 2 else None

cmd = [
    'systemd-run', '--user', '--no-block',
    '--setenv=GLYCIN_DISABLE_SANDBOX=1',
    f'--setenv=DISPLAY={env["DISPLAY"]}',
    f'--setenv=HOME={env["HOME"]}',
    f'--setenv=XDG_RUNTIME_DIR={env["XDG_RUNTIME_DIR"]}',
    '/usr/bin/gimp'
]
if img_file:
    cmd.append(img_file)

subprocess.run(cmd)


Save it somewhere on your Linux filesystem, point IrfanView's external editor to the Z: path equivalent, and it works. The same trick applies to any native Linux app you need to launch cleanly from within Wine.

Tuesday, February 06, 2018

Arch: Wine and GPower

GPower 4.1 installs in wine 3.0 and runs, but freezes after executing calculations due to some problems with drawing the results's plot. To fix the freezing, need to install gdiplus and lib32-gnutls:
winetricks vcrun6 lib32-gnutls gdiplus
This fixes the freezes, although the plots can't be still seen.

Wednesday, July 17, 2013

Arch Linux: Error about msvcr100.dll.wctomb_s in wine 1.6-rc5 when starting Path of Exile.

Sorry, just writing from memory. I had wine 1.6-rc5 on a Arch Linux x64, though wine was set as 32-bit wine environment, i.e. withWINEARCH=win32 winecfgI had problem running Path of Exile client (Client.exe). It was something about unimplemented function msvcr100.dll.wctomb_s. The fix for me was to install Microsoft Visual C++ 2010 winetricks vcrun2010However, this may require you to first install msxml3.