client
client copied to clipboard
cannot open display: :0 on Wayland session
Hello,
trying to start keybase-gui on Swaywm. Here's what appears in my journal: Sep 13 18:14:46 defiant systemd[939]: Starting Keybase GUI... Sep 13 18:14:46 defiant systemd[939]: Started Keybase GUI. Sep 13 18:14:48 defiant electron[16757]: cannot open display: :0 Sep 13 18:14:48 defiant systemd[939]: keybase.gui.service: Main process exited, code=exited, status=1/FAILURE Sep 13 18:14:48 defiant systemd[939]: keybase.gui.service: Failed with result 'exit-cod
my log id: c6eec7e406877d920c9d941c
THX Frank
Hmm. What is your $DISPLAY
?
DISPLAY=:0
I assume you're using the Arch community packages? @eli-schwartz any ideas?
Swaywm is a Wayland compositor, it does not use X11. I don't use Wayland myself, so I'm not familiar with the best way to make sure an application is successfully started under XWayland.
I think that Electron applications require XWayland due to continuing lack of support in libchromiumcontent (and more generally, in the Chromium browser) for native Wayland.
...
Do you have xwayland disable
specified in your Swaywm configuration?
Yes I am using the package from the community repo.
x11wayland is not disabled in my config, xeyes for example is launching without any issues.
Can you open a command line and run this command not in systemd:
electron /usr/share/keybase-app
I found this https://github.com/swaywm/sway/issues/4050 and when I change GDK_BACKEND to x11 keybase-ui launches with GDK_BACKEND=wayland I'm getting this error for your suggested command: (electron:9920): Gtk-WARNING **: 10:40:34.478: cannot open display: :0
Do not set GDK_BACKEND=wayland
globally. This is known to break apps.
Instead, don't set anything. GTK will automatically choose the most appropriate backend.
@zimbipw I don't know anything about wayland but you can set this environment variable only for keybase-gui.service
using a systemd drop-in unit.
that's pretty cool, thanks for the hint. However, I guess rather sooner than later you will need to look into supporting Wayland sessions
I guess rather sooner than later you will need to look into supporting Wayland sessions
No, it's the other way around. Keybase doesn't need to do anything. However users need to make sure DISPLAY
and WAYLAND_DISPLAY
are correctly set when Keybase starts. This can be achieved by running systemctl --user import-environment
on compositor startup.
@zimbipw
For X11, the default xinitrc.d already sets up the necessary environment variables in the systemd user session. There is a downstream bug report for Arch Linux to do the same in our swaywm packaging as well, which will probably solve your issue: https://bugs.archlinux.org/task/63021
I had this same issue and was able to fix it by creating a ~/.config/environment.d/.conf file:
$ cat ~/.config/environment.d/.conf
DISPLAY=:0
WAYLAND_DISPLAY=wayland-0
As detailed here.
I'm not sure if this command would have the same effect and could be placed in the sh script /usr/bin/keybase-gui
?:
$ systemctl --user import-environment DISPLAY WAYLAND_DISPLAY
The $DISPLAY
variable is controlled by the file .config/keybase/keybase.autogen.env
. It's also taken care of by /etc/X11/xinit/xinitrc.d/50-systemd-user.sh before that.
If your wayland session uses sway, then it is handled by /etc/sway/conf.d/10-systemd.conf
Try
export DISPLAY=$WAYLAND_DISPLAY
export GDK_BACKEND=wayland
Exporting the Wayland display as the X11 one won't work.
Exporting the Wayland display as the X11 one won't work.
that worked with gtk3-demo, so sometimes for some reason it does on some apps. didn't research it enough yet though.
It likely just makes the client fail to connect to X11, because DISPLAY
is set to a bogus value.
yeah, looks like it might be so
Install the xorg-xhost
package, that should do the trick!
I had this same issue and was able to fix it by creating a ~/.config/environment.d/.conf file:
$ cat ~/.config/environment.d/.conf DISPLAY=:0 WAYLAND_DISPLAY=wayland-0
As detailed here.
I'm not sure if this command would have the same effect and could be placed in the sh script
/usr/bin/keybase-gui
?:$ systemctl --user import-environment DISPLAY WAYLAND_DISPLAY
This issue recurs for me every now and then. Every time its a different solution that makes it work, like this one helped me the last time. Today, this too did not work, but launching it from the root terminal did the job (not with sudo). All the env variables I know are the same in both root and user. Can someone tell me what am I missing here?