Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sway (1.6) / wlroots (0.13.0) broke screen sharing and gnome3 pinentry popups #119445

Closed
etu opened this issue Apr 14, 2021 · 8 comments · Fixed by #122605
Closed

sway (1.6) / wlroots (0.13.0) broke screen sharing and gnome3 pinentry popups #119445

etu opened this issue Apr 14, 2021 · 8 comments · Fixed by #122605
Labels
0.kind: bug Something is broken

Comments

@etu
Copy link
Contributor

etu commented Apr 14, 2021

Describe the bug
The recent update of sway and wlroots seems to have broken screen sharing as well as gnome3 pinentry popups.

To Reproduce
Steps to reproduce the behavior:

I've built a system on 311ceed (current nixos-unstable, there neither of the mentioned things works).

But if I build a system on 04a2b26 (previous unstable, there both of the mentioned things works.).

I've then checked out 04a2b26 and copied the folders pkgs/development/libraries/wlroots/ and pkgs/applications/window-managers/sway/ from master into my checkout and built a system based on the old unstable but with only those two packages updated. Then it's still broken. So it's at least isolated to those two packages.

Expected behavior
I expect screen sharing to work.

I also expect to be able to unlock my security key from places where the ncurses interface doesn't work (like within Emacs).

Additional context
Here's my complete sway setup: https://github.com/etu/nixconfig/blob/main/modules/my-sway.nix#L465-L516

Notify maintainers
cc @primeos @Synthetica9 @Ma27

Metadata

  • system: "x86_64-linux"
  • host os: Linux 5.11.9, NixOS, 21.05.git.04a2b269d89M (Okapi)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.10
  • channels(root): ""
  • nixpkgs: /etc/nixos/nix/nixos-unstable

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute: sway wlroots
# a list of nixos modules affected by the problem
module:
@etu etu added the 0.kind: bug Something is broken label Apr 14, 2021
@Ma27
Copy link
Member

Ma27 commented Apr 14, 2021

Related: #112914.

@primeos
Copy link
Member

primeos commented Apr 14, 2021

I can confirm the gnome3 pinentry (gcr-prompter) issue (wasn't aware of it but can reproduce it).

I'm not using screen sharing on Wayland (yet) so unfortunately I cannot have a look into that.
cc @minijackson (xdg-desktop-portal-wlr): FYI, in case you use Sway and can reproduce this.

Edit: Might be unrelated but yesterday I've also had a swaylock crash:

swaylock[70568]: swaylock: ../main.c:1183: main: Assertion `state.compositor && state.layer_shell && state.shm' failed.
systemd-coredump[70617]: Process 70568 (swaylock) of user 1001 dumped core.

Another thing that changed with Sway 1.6: $WAYLAND_DISPLAY now "defaults" to wayland-1 (https://github.com/swaywm/sway/blob/1.6/sway/server.c#L166) while it was previously wayland-0. This shouldn't matter (edit: nope, turns out that it does really matter :o :D) but I didn't reboot my system and noticed that at least the dbus-daemon still has WAYLAND_DISPLAY=wayland-0 (if the environment from that process is inherited to start gcr-prompter then that would certainly seem like a problem but only then). That's all I can say for today.

@jakobrs
Copy link
Contributor

jakobrs commented Apr 14, 2021

xdg-desktop-portal-wlr.service fails to start for me on nixos-unstable; presumably this is why screen sharing doesn't work. This appears in journalctl:

Apr 14 20:02:20 girafarig systemd[1244]: Starting Portal service (wlroots implementation)...
Apr 14 20:02:20 girafarig xdg-desktop-portal-wlr[1363]: 2021/04/14 20:02:20 [ERROR] - wayland: failed to connect to display
Apr 14 20:02:20 girafarig systemd[1244]: xdg-desktop-portal-wlr.service: Main process exited, code=exited, status=1/FAILURE
Apr 14 20:02:20 girafarig systemd[1244]: xdg-desktop-portal-wlr.service: Failed with result 'exit-code'.
Apr 14 20:02:20 girafarig systemd[1244]: Failed to start Portal service (wlroots implementation).

@etu
Copy link
Contributor Author

etu commented Apr 14, 2021

@jakobrs I've have the same errors on latest unstable, may be related to $WAYLAND_DISPLAY as @primeos mentioned.

@etu

This comment has been minimized.

@primeos
Copy link
Member

primeos commented Apr 15, 2021

Ok, so I've had a closer look at this and all of my issues where surprisingly related to the $WAYLAND_DISPLAY change.

I've executed dbus-update-activation-environment WAYLAND_DISPLAY and now the Gnome3 Pinentry (gcr-prompter) works again. I guess that should fix the screen sharing issues too.

There are two things that surprised me:

  1. I'd assume some of you did reboot and in my case dbus-deamon should've had the correct WAYLAND_DISPLAY due to our dbus-run-session (which should've caused my dbus-daemon to be "restarted" as well)
  2. My systemd unit for swaylock uses neither D-Bus nor does it hard-code WAYLAND_DISPLAY

So I wondered where the wayland-0 comes from so I had a quick look at the Wayland source-code and, indeed, it's the default if $WAYLAND_DISPLAY isn't set: https://gitlab.freedesktop.org/wayland/wayland/-/blob/1.19.0/src/wayland-client.c#L969

So it seems like Sway's WAYLAND_DISPLAY change is much more severe than I though and causes (all of) these regressions (but the change makes sense as this reveals that it was basically always "broken" as it worked with a default value instead of properly via WAYLAND_DISPLAY).

For a quick fix it should be enough to add exec dbus-update-activation-environment WAYLAND_DISPLAY to your ~/.config/sway/config (I already had exec systemctl --user import-environment WAYLAND_DISPLAY DISPLAY DBUS_SESSION_BUS_ADDRESS SWAYSOCK in there, which is useful as well). However, to fix this properly we need to find a nice solution for Nixpkgs.

etu added a commit to etu/nixconfig that referenced this issue Apr 15, 2021
This is to make sure screen sharing works after the upgrade to sway 1.6.

See the issue here: NixOS/nixpkgs#119445
sternenseemann added a commit to openlab-aux/vuizvui that referenced this issue Apr 16, 2021
Sway updates it's WAYLAND_DISPLAY variable in a way dbus doesn't pick up
on. Fix is taken from here:
NixOS/nixpkgs#119445 (comment)
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/screen-sharing-with-wayland-gnome/12449/4

@flokli flokli mentioned this issue Apr 29, 2021
10 tasks
primeos added a commit to primeos/nixpkgs that referenced this issue May 11, 2021
The default config.in template contains
"include @sysconfdir@/sway/config.d/*" but we've dropped it to better
support non-NixOS (which seems like a mistake in retrospect).
This restores that behaviour and extends the default configuration via
nixos.conf to fix NixOS#119445.

Note: The security configurations (security.d) where dropped entirely
(but maybe they'll return).
@primeos
Copy link
Member

primeos commented May 11, 2021

However, to fix this properly we need to find a nice solution for Nixpkgs.

I've looked into that and opened #122605 as a potential fix (though it will only work for new users / when using the default /etc/sway/config as we've unfortunately removed include /etc/sway/config.d/* until now). Feedback is welcome.

primeos added a commit to primeos/nixpkgs that referenced this issue May 13, 2021
This test is important to confirm that $WAYLAND_DISPLAY is correctly
imported via "dbus-update-activation-environment --systemd" which is
done by default since NixOS#122605 (00e8e5b).
It ensures that the gnome3-pinentry pop-ups work as expected to avoid
regressions like NixOS#119445 (which also broke screen sharing).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants