#1006329 xwayland does not update dbus activation environment (DISPLAY, XAUTHORITY) on startup

Package:
xwayland
Source:
xwayland
Description:
X server for running X clients under Wayland
Submitter:
Jameson Graef Rollins
Date:
2025-08-02 09:03:01 UTC
Severity:
important
#1006329#5
Date:
2022-02-23 16:49:33 UTC
From:
To:
For a couple of months now, when I launch sway, many dbus queries
timeout with a log like:

Feb 23 08:43:58 servo org.freedesktop.Notifications[4739]: failed to create display

Issuing the following command seems to fix the issue:

dbus-update-activation-environment --systemd DISPLAY XAUTHORITY

Clearly something should be handling this automatically but is not.
My best guess to what should be handling it is Xwayland, which I think
should be updating dbus with these variables when it launches.

Thanks!

jamie.

#1006329#10
Date:
2022-02-23 19:52:48 UTC
From:
To:
I might be mischaracterizing this as an Xwayland issue.  Maybe it's a
sway issue?  The problem starts before Xwayland is in the picture,
before any X apps are launched.  waybar takes a long time to launch,
gpg-agent, pavucontrol, other things.  They all have these dbus
timeouts, that all seem to be fixed when I run the following command:

dbus-update-activation-environment DISPLAY XAUTHORITY

So maybe it's just the DISPLAY variable that's actually relevant?
Somehow that variable is defined by sway before Xwayland is ever
launched, but it's not communicated to my dbus session, since it's
started by systemd --user before I launch sway.

jamie.

#1006329#17
Date:
2022-02-24 10:38:51 UTC
From:
To:
It's definitely not an Xwayland issue; Xwayland (like any other X server) itself doesn't set these environment variables or launch any X11 client processes.
#1006329#22
Date:
2025-08-02 08:54:45 UTC
From:
To:
ordering issue when first logging in after a boot. Sway will set the
environment varables correctly when
/etc/sway/config.d/50-systemd-user.conf is included in
~/.config/sway/config, but this happens _after_ systemd starts
xdg-desktop-portal-gtk. I confirmed this by adding

ExecStartPre=/usr/bin/echo $DISPLAY $WAYLAND_DISPLAY

to the xdg-desktop-portal-gtk unit. After logging in for the first time
after a boot, systemctl --user status xdg-dekstop-portal-gtk looks like
this:

~~~
Aug 02 10:18:05 hostname systemd[2255]: Starting
xdg-desktop-portal-gtk.service - Portal service (GTK/GNOME
implementation)...
Aug 02 10:18:05 hostname (echo)[2382]: xdg-desktop-portal-gtk.service:
Referenced but unset environment variable evaluates to an empty string:
DISPLAY, WAYLAND_DISPLAY
Aug 02 10:18:05 hostname xdg-desktop-por[2383]: cannot open display:
Aug 02 10:18:05 hostname systemd[2255]: xdg-desktop-portal-gtk.service:
Main process exited, code=exited, status=1/FAILURE
Aug 02 10:18:05 hostname systemd[2255]: xdg-desktop-portal-gtk.service:
Failed with result 'exit-code'.
Aug 02 10:18:05 hostname systemd[2255]: Failed to start
xdg-desktop-portal-gtk.service - Portal service (GTK/GNOME implementation).
~~~

After a systemctl --user restart xdg-desktop-portal-gtk the variables
are set:

~~~
Aug 02 10:19:39 hostname systemd[2255]: Starting
xdg-desktop-portal-gtk.service - Portal service (GTK/GNOME
implementation)...
Aug 02 10:19:39 hostname echo[2788]: :0 wayland-1
Aug 02 10:19:39 hostname systemd[2255]: Started
xdg-desktop-portal-gtk.service - Portal service (GTK/GNOME implementation).
~~~

Does anyone have an idea how best to fix this? Do we need to add a
dependency to the xdg-desktop-portal-gtk unit? But what dependency?

Best regards,
-- Martin