#1093464 spurious error message if XDG_RUNTIME_DIR is not set

Package:
wine
Source:
wine
Submitter:
Bill Allombert
Date:
2025-12-04 16:13:02 UTC
Severity:
normal
Tags:
#1093464#5
Date:
2025-01-18 23:14:17 UTC
From:
To:
Dear Debian Wine party,

I run wine in text mode in a CI cronjob (so XDG_RUNTIME_DIR is not defined).
Since I upgraded wine, it reports a spurious error message:
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
even though I set WINEDEBUG=-all
This causes the output of wine to be broken and break the build.

Cheers,
Bill.

#1093464#10
Date:
2025-04-08 18:37:52 UTC
From:
To:
I believe this message comes from libwayland-client, and cannot easily
be suppressed by a caller.
(https://codesearch.debian.net/search?q=XDG_RUNTIME_DIR+is+invalid+or+not+set+in+the+environment&literal=1)

Some Wayland clients avoid this error message by only attempting to
connect to a Wayland display if there is some sort of evidence that
there ought to be a functioning Wayland session. For example, SDL only
tries to use Wayland if $WAYLAND_DISPLAY is set, or if $XDG_SESSION_TYPE
is set to "wayland". Wine could maybe do similarly.

(Or, your cron job could create a temporary XDG_RUNTIME_DIR for the
duration of running Wine things.)

     smcv

#1093464#15
Date:
2025-11-02 00:40:09 UTC
From:
To:
control: tag -1 patch

I didn't quickly get a headless or other setup to reproduce the
original problem but went ahead and developed a potential fix based on
smcv's suggestion.

Please try the short patch attached, I don't currently have a way to test.

Best wishes,
Mike

#1093464#20
Date:
2025-11-02 00:40:09 UTC
From:
To:
control: tag -1 patch

I didn't quickly get a headless or other setup to reproduce the
original problem but went ahead and developed a potential fix based on
smcv's suggestion.

Please try the short patch attached, I don't currently have a way to test.

Best wishes,
Mike

#1093464#25
Date:
2025-11-11 14:35:42 UTC
From:
To:
Thanks for this info!
FWIW, I do not see why libwayland-client should expect XDG_RUNTIME_DIR to be set.
This seems like a major layering violation. One should be able to use wayland without
using a desktop environment.

Cheers,

#1093464#30
Date:
2025-12-04 16:00:08 UTC
From:
To:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=914822

Well, XDG_RUNTIME_DIR has nothing to do with desktop environments, not
even with graphical displays. It is set by pam_systemd at login time,
e.g. also via ssh without a graphical display. See the pam_systemd(8)
man page.

Note that wine uses /run/user/$UID (which is normally identical to
$XDG_RUNTIME_DIR) even when XDG_RUNTIME_DIR is unset, as I can see
changes under "/run/user/$UID/wine". Since $XDG_RUNTIME_DIR is
"automatically created the first time a user logs in and removed on
the user's final logout" (pam_systemd(8) man page), I'm wondering
whether wine is correct anyway: this directory may be removed while
wine is still running in the background.

#1093464#35
Date:
2025-12-04 16:11:07 UTC
From:
To:
The error also occurs when running /usr/bin/wine64-stable directly,
without the wine package installed.