Closed romangg closed 8 months ago
In GitLab by @magiblot on Oct 6, 2020, 23:26
From a Plasma Wayland session with Disman working out-of-the-box:
[magiblot@ArchLinux ~]$ ps aux | grep disman
magiblot 5586 0.1 0.1 445684 23348 ? Ssl 23:21 0:00 /usr/lib/disman_backend_launcher
[magiblot@ArchLinux ~]$ qdbus org.kwinft.disman
/
/backend
[magiblot@ArchLinux ~]$ /usr/lib/disman_backend_launcher
disman.backendlauncher: Cannot register Disman service. Another launcher already running?
In GitLab by @magiblot on Oct 6, 2020, 23:51
Ah, here it is. For some reason, Disman tries to create a Wayland connection even though this is a X11 session. Then it crashes:
In GitLab by @magiblot on Oct 7, 2020, 24:01
Valgrind shows the program crashes after a beyond-bounds access.
In GitLab by @magiblot on Oct 7, 2020, 01:20
With the fix in !19 applied, Disman does no longer crash. However, since it seems to fail at creating a Wayland connection, it stays resident without providing any functionality (note the missing /backend
entry):
[magiblot@ArchLinux ~]$ qdbus org.kwinft.disman
/
So, even though disman_backend_launcher
is running, System Settings still complains about not finding a Disman backend.
In GitLab by @magiblot on Oct 7, 2020, 18:02
Disman chooses the Wayland backend because the WAYLAND_DISPLAY variable is actually set:
DISMAN_BACKEND: (nil)
WAYLAND_DISPLAY: 0x7ffeab11bba0 ("wayland-0")
DISPLAY: 0x7ffeab11bccd (":0")
select: wayland
Which makes no sense at a first glance. Both WAYLAND_DISPLAY and DISPLAY variables are unset when checking from the console (after exiting Plasma Wayland).
But when you logout from the Wayland session the disman_backend_process was actually killed right? It's weird indeed that the env variable is still present for the D-Bus service.
In GitLab by @magiblot on Oct 7, 2020, 18:50
From what I can see, the disman_backend_launcher
process does not outlive the Plasma session.
In GitLab by @magiblot on Oct 7, 2020, 23:30
I can confirm that the WAYLAND_DISPLAY
environment variable is already set by the time disman_backend_launcher
is launched (i.e. its not set by mistake from within Disman). I don't think I can determine the cause of this.
A good workaround is to export DISMAN_BACKEND=randr
in .xinitrc
.
In GitLab by @magiblot on Oct 7, 2020, 23:34
On the other hand, adding unset WAYLAND_DISPLAY
in .xinitrc
before startplasma-x11
does not change the result.
In GitLab by @magiblot on Oct 8, 2020, 24:23
I realized that after adding export DISMAN_BACKEND=randr
in .xinitrc
, Disman still sees DISMAN_BACKEND=randr
on Wayland. So what's happening here is that someone is backing up environment variables and then applying them on Disman. This is indeed very unexpected and strange.
Another example:
DISMAN_BACKEND=wayland startplasma-wayland
and exit Plasma.DISMAN_BACKEND
variable is not set in the environment or in .xinitrc
. Also make sure that .xinitrc
invokes startplasma-x11
.startx
.DISMAN_BACKEND=wayland
.In GitLab by @magiblot on Oct 8, 2020, 13:45
From what I can gather, systemd
and dbus
services require environment variables to be explicitly imported, since the process starting these services does not inherit the same environment than the process that requests the service to be started.
Assuming that dbus-update-activation-environment
is involved in the process of setting Disman up, here's what can be found in its manpage:
LIMITATIONS
dbus-daemon does not provide a way to unset environment variables after they have been set (although systemd does), so dbus-update-activation-environment does not offer this either.
So there's not much that Disman can do about this. Falling back to X11 if wayland fails might work in the situation described in this issue, but it definitely wouldn't work if both a Wayland and an X11 session were running in parallel (not necessarily Plasma).
Is making DISMAN_IN_PROCESS
the default a good idea?
In GitLab by @magiblot on Oct 8, 2020, 14:02
Setting DISMAN_IN_PROCESS=1
in my environment solves the issue. So if you agree with it, my suggested fix is to make this the default.
In GitLab by @magiblot on Oct 8, 2020, 15:24
I can confirm that this issue is caused by not using dbus-run-session
. In my case I start Plasma sessions directly from the shell, so this is easy to fix for me. But I don't know about people using display managers.
I think in the case of display managers it is very likely that a clean D-Bus session is always setup for when the manager starts a session.
I would consider a display manager broken which does not ensure this.
I wrote a comment to the GTK issue that you did link in Gitter. Thanks for the hint!
As explained there my personal opinion at the moment in regards to the WAYLAND_DISPLAY
environment variable is that using this is the "least worst" option to find out what windowing system we should presume.
Since you could solve the issue with dbus-run-session
(I would say the issue was that the prior D-Bus session was reused and that reused old enthronement variables), shall we close this issue?
In GitLab by @magiblot on Oct 8, 2020, 17:42
Not yet, we should document this case somewhere so that users in the same situation can easily solve it.
In GitLab by @magiblot on Oct 8, 2020, 17:53
Well, yes, the issue can be closed, but not the merge request.
Agree.
Reopening as it can not be assumed a new D-Bus session is started on every new graphical session.
See:
So we need to find a way to reload backend plugins in case the graphical session was closed but the D-Bus session lived on.
mentioned in commit 8ddc15af95103b46dac429988ad4ebe1a1c35a97
In GitLab by @magiblot on Oct 6, 2020, 23:19
Hi there,
I am experiencing the following situations:
DISMAN_IN_PROCESS
environment variable before starting the Plasma X11 session.When Disman is not working on X11, I see the following messages:
No Disman backend found. Please check your Disman installation
in System Settings.dismanctl -o
withoutDISMAN_IN_PROCESS
:ps aux | grep disman
orqdbus org.kwinft.disman /
neither in the X11 session or in the console after a Plasma Wayland session.disman_backend_launcher
:And then the System Settings page works until I close
disman_backend_launcher
.I am using Disman at commit bcc6dbcf10d250d17a6c901c44cf790088925656 and mainline Kwin 5.19.5.
Thanks!