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

GDM wayland improvements #39615

Merged
merged 3 commits into from May 16, 2018
Merged

GDM wayland improvements #39615

merged 3 commits into from May 16, 2018

Conversation

jtojnar
Copy link
Contributor

@jtojnar jtojnar commented Apr 27, 2018

Motivation for this change

Apparently, Wayland session was not used at all until now by GDM.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@GrahamcOfBorg GrahamcOfBorg added 6.topic: GNOME GNOME desktop environment and its underlying platform 10.rebuild-darwin: 0 10.rebuild-linux: 11-100 labels Apr 27, 2018
@jtojnar jtojnar added this to GNOME/GTK specific in Wayland Apr 27, 2018
@jtojnar jtojnar added this to In Progress in GNOME Apr 27, 2018
@hedning
Copy link
Contributor

hedning commented Apr 28, 2018

Works as expected in a VM. When running it on my usual config and hardware I had to do sudo systemctl restart display-manager.service to get things going (gdm had started on tty7 according to logitctl, but switiching to it manually hung the whole system for some reason).

@jtojnar jtojnar changed the title GNOME wayland improvements GDM wayland improvements May 2, 2018
@hedning
Copy link
Contributor

hedning commented May 2, 2018

Edit: This only happens when using boot.plymouth.enable = true

Tried it again, turns out that I just had to wait a bit and GDM would launch. Looking at the journal it seems the first attempt to launch fails:

mai 02 17:47:57 x1 gsettings[1303]: Using the 'memory' GSettings backend.  Your settings will not be saved or shared with other applications.
...
mai 02 17:47:57 x1 gnome-session[1302]: gnome-session-binary[1302]: WARNING: Could not parse desktop file orca-autostart.desktop or it references a not found TryExec binary
mai 02 17:47:57 x1 gnome-session-binary[1302]: WARNING: Could not parse desktop file orca-autostart.desktop or it references a not found TryExec binary
...
mai 02 17:47:58 x1 .gnome-shell-wr[1341]: Failed to find schema: org.gnome.settings-daemon.plugins.xsettings
mai 02 17:47:58 x1 .gnome-shell-wr[1341]: Failed to apply DRM plane transform 0: Permission denied
mai 02 17:47:58 x1 .gnome-shell-wr[1341]: clutter_actor_get_width: assertion 'CLUTTER_IS_ACTOR (self)' failed
mai 02 17:47:58 x1 .gnome-shell-wr[1341]: clutter_actor_get_height: assertion 'CLUTTER_IS_ACTOR (self)' failed
mai 02 17:47:58 x1 .gnome-shell-wr[1341]: clutter_actor_get_width: assertion 'CLUTTER_IS_ACTOR (self)' failed
mai 02 17:47:58 x1 .gnome-shell-wr[1341]: clutter_actor_get_height: assertion 'CLUTTER_IS_ACTOR (self)' failed
mai 02 17:47:58 x1 org.gnome.Shell.desktop[1341]: wayland-egl: could not open /dev/dri/card0 (Permission denied)

... a bit later ...

mai 02 17:49:28 x1 gnome-session[1302]: gnome-session-binary[1302]: WARNING: Application 'org.gnome.Shell.desktop' failed to register before timeout
mai 02 17:49:28 x1 gnome-session-binary[1302]: WARNING: Application 'org.gnome.Shell.desktop' failed to register before timeout
mai 02 17:49:28 x1 gnome-session-binary[1302]: Unrecoverable failure in required component org.gnome.Shell.desktop
mai 02 17:49:28 x1 gnome-session-f[2090]: Cannot open display: 
mai 02 17:49:28 x1 org.gnome.SettingsDaemon.Clipboard.desktop[2096]: Cannot open display:
mai 02 17:49:28 x1 org.gnome.SettingsDaemon.XSettings.desktop[2091]: Cannot open display:
mai 02 17:49:28 x1 org.gnome.SettingsDaemon.Color.desktop[2098]: Cannot open display:
mai 02 17:49:28 x1 org.gnome.SettingsDaemon.Keyboard.desktop[2103]: Cannot open display:
mai 02 17:49:28 x1 org.gnome.SettingsDaemon.MediaKeys.desktop[2104]: Cannot open display:
mai 02 17:49:28 x1 org.gnome.SettingsDaemon.Power.desktop[2109]: Cannot open display:
mai 02 17:49:28 x1 gnome-session[1302]: gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.XSettings.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.XSettings.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session[1302]: gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Clipboard.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Clipboard.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session[1302]: gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Color.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Color.desktop' exited with code 1
mai 02 17:49:28 x1 org.gnome.SettingsDaemon.Wacom.desktop[2127]: Cannot open display:
mai 02 17:49:28 x1 gnome-session[1302]: gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Keyboard.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Keyboard.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session[1302]: gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.MediaKeys.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.MediaKeys.desktop' exited with code 1
mai 02 17:49:28 x1 org.gnome.SettingsDaemon.Clipboard.desktop[2133]: Cannot open display:
mai 02 17:49:28 x1 org.gnome.SettingsDaemon.XSettings.desktop[2131]: Cannot open display:
mai 02 17:49:28 x1 gnome-session[1302]: gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Power.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Power.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session[1302]: gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Wacom.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Wacom.desktop' exited with code 1
mai 02 17:49:28 x1 org.gnome.SettingsDaemon.Keyboard.desktop[2138]: Cannot open display:
mai 02 17:49:28 x1 gnome-session[1302]: gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.XSettings.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session[1302]: gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.XSettings.desktop' respawning too quickly
mai 02 17:49:28 x1 gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.XSettings.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session-binary[1302]: Unrecoverable failure in required component org.gnome.SettingsDaemon.XSettings.desktop
mai 02 17:49:28 x1 gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.XSettings.desktop' respawning too quickly
mai 02 17:49:28 x1 org.gnome.SettingsDaemon.Color.desktop[2136]: Cannot open display:
mai 02 17:49:28 x1 gnome-session[1302]: gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Clipboard.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session[1302]: gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Clipboard.desktop' respawning too quickly
mai 02 17:49:28 x1 gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Clipboard.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session-binary[1302]: Unrecoverable failure in required component org.gnome.SettingsDaemon.Clipboard.desktop
mai 02 17:49:28 x1 gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Clipboard.desktop' respawning too quickly
mai 02 17:49:28 x1 org.gnome.SettingsDaemon.MediaKeys.desktop[2139]: Cannot open display:
mai 02 17:49:28 x1 gnome-session[1302]: gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Color.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session[1302]: gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Color.desktop' respawning too quickly
mai 02 17:49:28 x1 gnome-session-binary[1302]: Unrecoverable failure in required component org.gnome.SettingsDaemon.Color.desktop
mai 02 17:49:28 x1 gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Color.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Color.desktop' respawning too quickly
mai 02 17:49:28 x1 gnome-session[1302]: gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Keyboard.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session[1302]: gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Keyboard.desktop' respawning too quickly
mai 02 17:49:28 x1 gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Keyboard.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session-binary[1302]: Unrecoverable failure in required component org.gnome.SettingsDaemon.Keyboard.desktop
mai 02 17:49:28 x1 gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Keyboard.desktop' respawning too quickly
mai 02 17:49:28 x1 org.gnome.SettingsDaemon.Power.desktop[2141]: Cannot open display:
mai 02 17:49:28 x1 gnome-session[1302]: gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.MediaKeys.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.MediaKeys.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session[1302]: gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.MediaKeys.desktop' respawning too quickly
mai 02 17:49:28 x1 gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.MediaKeys.desktop' respawning too quickly
mai 02 17:49:28 x1 gnome-session-binary[1302]: Unrecoverable failure in required component org.gnome.SettingsDaemon.MediaKeys.desktop
mai 02 17:49:28 x1 gnome-session-f[2144]: Cannot open display: 
mai 02 17:49:28 x1 gnome-session[1302]: gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Power.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session[1302]: gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Power.desktop' respawning too quickly
mai 02 17:49:28 x1 gnome-session-binary[1302]: Unrecoverable failure in required component org.gnome.SettingsDaemon.Power.desktop
mai 02 17:49:28 x1 gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Power.desktop' exited with code 1
mai 02 17:49:28 x1 gnome-session-binary[1302]: WARNING: App 'org.gnome.SettingsDaemon.Power.desktop' respawning too quickly
mai 02 17:49:28 x1 gnome-session-f[2143]: Cannot open display: 
mai 02 17:49:28 x1 org.gnome.SettingsDaemon.Wacom.desktop[2142]: Cannot open display:
mai 02 17:49:28 x1 gnome-session-f[2149]: Cannot open display: 
mai 02 17:49:28 x1 gnome-session-f[2145]: Cannot open display: 
mai 02 17:49:28 x1 .gsd-smartcard-[2122]: Unable to register client: GDBus.Error:org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying
mai 02 17:49:28 x1 org.gnome.Shell.desktop[1341]: (EE)
mai 02 17:49:28 x1 org.gnome.Shell.desktop[1341]: Fatal server error:
mai 02 17:49:28 x1 org.gnome.Shell.desktop[1341]: (EE) Error sending request: Broken pipe
mai 02 17:49:28 x1 org.gnome.Shell.desktop[1341]: (EE)
mai 02 17:49:28 x1 gdm[1117]: GLib: g_variant_new_string: assertion 'string != NULL' failed
mai 02 17:49:28 x1 systemd-logind[1084]: Removed session c1.
mai 02 17:49:28 x1 systemd[1]: Stopping User Manager for UID 132...

Afterwards systemd tries again and things seems to work.

mai 02 17:49:28 x1 systemd-logind[1084]: New session c2 of user gdm.
mai 02 17:49:28 x1 systemd[2165]: pam_unix(systemd-user:session): session opened for user gdm by (uid=0)
...
...
...
mai 02 17:49:28 x1 gsettings[2204]: Using the 'memory' GSettings backend.  Your settings will not be saved or shared with other applications.
mai 02 17:49:28 x1 gnome-session[2201]: gnome-session-binary[2201]: WARNING: Could not parse desktop file orca-autostart.desktop or it references a not found TryExec binary
mai 02 17:49:28 x1 gnome-session-binary[2201]: WARNING: Could not parse desktop file orca-autostart.desktop or it references a not found TryExec binary
mai 02 17:49:28 x1 .gnome-shell-wr[2208]: Failed to find schema: org.gnome.settings-daemon.plugins.xsettings
mai 02 17:49:28 x1 org.gnome.Shell.desktop[2208]: glamor: EGL version 1.4 (DRI2):

I'm guessing org.gnome.Shell.desktop[1341]: wayland-egl: could not open /dev/dri/card0 (Permission denied) might be the main culprit, and that the gdm service needs another target to avoid launching too early?

(I use boot.plymouth.enable = true; in my config, which probably isn't relevant, but might be).

@hedning
Copy link
Contributor

hedning commented May 2, 2018

Apparently the culprit was plymouth, disabling made things work as expected. I'm guessing that plymouth has control of the display when GDM first tries to launch or something.

@jtojnar
Copy link
Contributor Author

jtojnar commented May 2, 2018

Is that a regression?

Anyway, playing with the session chooser lead me to want to get rid of our Xsession code in favour of the upstream session files – with the XDG_DATA_DIRS GDM patch, I can see them but they fail for some reason. I opened an issue #39871.

@hedning
Copy link
Contributor

hedning commented May 2, 2018

Is that a regression?

Haven't had any issue with plymouth and gdm running in X, so yeah :(

I personally don't care much about having plymouth or not, but I would think it's somewhat common to use?

hedning added a commit to hedning/nixpkgs that referenced this pull request May 2, 2018
This is apparent from the service file directory in plymouth.

Leaving it unspecified caused gdm-wayland to crash on boot, see NixOS#39615.
@hedning
Copy link
Contributor

hedning commented May 2, 2018

Ok, looks like the plymouth service was underspecified. As can bee seen from the service files in the plymouth derivation plymouth-quit-wait.service should be wanted by multi-user.target. Adding this solves the issue for me (and makes the plymouth -> gdm transition smooth, which I'm pretty sure wasn't the case before).

Pretty confident this should do it: hedning@8081ea3

@hedning
Copy link
Contributor

hedning commented May 2, 2018

Ughh, testing it using Slim makes plymouth stick around eating a bunch of cpu 😦

@hedning
Copy link
Contributor

hedning commented May 3, 2018

Ok, tested a bunch of plymouth service configurations in vms.

Configurations which make the plymouth -> gdm transition smooth (ie. the plymouth splash freezes until gdm is ready to display) causes plymouth to not shut down properly when using other display managers.

The problem is probably that to get a smooth transition from plymouth to the display manager the display manager needs to take care of shutting plymouth down at the correct time (eg. with service files: #32556 (comment)). This works with gdm since it's built with plymouth support and will shutdown plymouth (see, gdm.service).

The best short term solution is probably to just make sure that plymouth quits properly with all display managers and not bother trying to fix the longstanding issue with choppy transitions.

This produces a working setup for gdm wayland on my hardware. Tested all the display managers in a VM and plymouth gets shut down properly:

    nixos/plymouth: multi-user.target wants plymouth-quit-wait.service
    
    This is apparent from the service file directory in plymouth:
    ├── multi-user.target.wants
    │   ├── plymouth-quit.service -> ../plymouth-quit.service
    │   └── plymouth-quit-wait.service -> ../plymouth-quit-wait.service
    
    Leaving it unspecified caused gdm-wayland to crash on boot, see #39615.
    
    The change made other display managers not quit plymouth properly however. By
    removing "multi-user.target" from `plymouth-quit.after` this is resolved.

diff --git a/nixos/modules/system/boot/plymouth.nix b/nixos/modules/system/boot/plymouth.nix
index f8fb8a64cb9..e4223bae7d3 100644
--- a/nixos/modules/system/boot/plymouth.nix
+++ b/nixos/modules/system/boot/plymouth.nix
@@ -87,9 +87,10 @@ in
 
     systemd.services.plymouth-kexec.wantedBy = [ "kexec.target" ];
     systemd.services.plymouth-halt.wantedBy = [ "halt.target" ];
+    systemd.services.plymouth-quit-wait.wantedBy = [ "multi-user.target" ];
     systemd.services.plymouth-quit = {
       wantedBy = [ "multi-user.target" ];
-      after = [ "display-manager.service" "multi-user.target" ];
+      after = [ "display-manager.service" ];
     };
     systemd.services.plymouth-poweroff.wantedBy = [ "poweroff.target" ];
     systemd.services.plymouth-reboot.wantedBy = [ "reboot.target" ];

cc @abbradar does this look sane to you, you probably know the most about how plymouth should work in nixos

hedning added a commit to hedning/nixpkgs that referenced this pull request May 4, 2018
This is apparent from the service file directory in plymouth:
├── multi-user.target.wants
│   ├── plymouth-quit.service -> ../plymouth-quit.service
│   └── plymouth-quit-wait.service -> ../plymouth-quit-wait.service

Leaving it unspecified caused gdm-wayland to crash on boot, see NixOS#39615.

The change made other display managers not quit plymouth properly however. By
removing "multi-user.target" from `plymouth-quit.after` this is resolved.
@hedning hedning mentioned this pull request May 4, 2018
8 tasks
Apparently, wayland session were not used at all until now.
Account chooser depends on AccountsService, which is normally enabled by
GNOME module but it was missing when using GDM without GNOME.
@jtojnar jtojnar merged commit 75cc398 into NixOS:master May 16, 2018
GNOME automation moved this from In Progress to Done May 16, 2018
@jtojnar jtojnar deleted the gdm-wayland branch May 16, 2018 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
GNOME
  
Done
Wayland
  
GNOME/GTK specific
Development

Successfully merging this pull request may close these issues.

None yet

3 participants