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

Restarting systemd-logind kills x server #29579

Closed
groxxda opened this issue Sep 19, 2017 · 7 comments
Closed

Restarting systemd-logind kills x server #29579

groxxda opened this issue Sep 19, 2017 · 7 comments

Comments

@groxxda
Copy link
Contributor

groxxda commented Sep 19, 2017

Issue description

When I restart systemd-logind, my X server dies. logind is restarted on system upgrades.

Steps to reproduce

  • Start a x session from a display manager that supports passing file descriptors (for example gdm)
  • Open console and run systemctl restart systemd-logind

systemd changelog

https://github.com/systemd/systemd/blob/master/NEWS#L103-L112

          systemd-logind may now be restarted without losing state. It stores
          the file descriptors for devices it manages in the system manager
          using the FDSTORE= mechanism. Please note that further changes in
          other components may be required to make use of this (for example
          Xorg has code to listen for stops of systemd-logind and terminate
          itself when logind is stopped or restarted, in order to avoid using
          stale file descriptors for graphical devices, which is now
          counterproductive and must be reverted in order for restarts of
          systemd-logind to be safe. See
          https://cgit.freedesktop.org/xorg/xserver/commit/?id=dc48bd653c7e101.)

Technical details

  • System: (NixOS: 17.09)
  • systemd: v234
  • gdm: 3.24.2

Journal

/nix/store/rhngsh1xfczlwyx2zgpk487c5cdi3qnz-gdm-3.24.2/libexec/gdm-x-session[4414]: Fatal server error:
/nix/store/rhngsh1xfczlwyx2zgpk487c5cdi3qnz-gdm-3.24.2/libexec/gdm-x-session[4414]: (EE) systemd-logind disappeared (stopped/restarted?)
/nix/store/rhngsh1xfczlwyx2zgpk487c5cdi3qnz-gdm-3.24.2/libexec/gdm-x-session[4414]: (EE)
/nix/store/rhngsh1xfczlwyx2zgpk487c5cdi3qnz-gdm-3.24.2/libexec/gdm-x-session[4414]: Please consult the The X.Org Foundation support
/nix/store/rhngsh1xfczlwyx2zgpk487c5cdi3qnz-gdm-3.24.2/libexec/gdm-x-session[4414]:          at http://wiki.x.org
/nix/store/rhngsh1xfczlwyx2zgpk487c5cdi3qnz-gdm-3.24.2/libexec/gdm-x-session[4414]:  for help.
/nix/store/rhngsh1xfczlwyx2zgpk487c5cdi3qnz-gdm-3.24.2/libexec/gdm-x-session[4414]: (EE) Please also check the log file at "/dev/null" f
/nix/store/rhngsh1xfczlwyx2zgpk487c5cdi3qnz-gdm-3.24.2/libexec/gdm-x-session[4414]: (EE)
@eqyiel
Copy link
Contributor

eqyiel commented Sep 21, 2017

This happens for me too, I think it's related to this: #28053 (comment)

@groxxda
Copy link
Contributor Author

groxxda commented Sep 21, 2017

@eqyiel I can reproduce the error by solely restarting systemd-logind without touching any files.

@eqyiel
Copy link
Contributor

eqyiel commented Sep 22, 2017

@groxxda I see, in any case I'm seeing the same thing as you every time I run nixos-rebuild switch!

@globin
Copy link
Member

globin commented Sep 27, 2017

CC @jtojnar, @teh, @zimbatm

@Mic92
Copy link
Member

Mic92 commented Sep 27, 2017

Maybe the following patch solve it?

diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index ed1f5d20af..dd9ba71044 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -875,7 +875,12 @@ in
     systemd.services.systemd-remount-fs.restartIfChanged = false;
     systemd.services.systemd-update-utmp.restartIfChanged = false;
     systemd.services.systemd-user-sessions.restartIfChanged = false; # Restart kills all active sessions.
-    systemd.services.systemd-logind.restartTriggers = [ config.environment.etc."systemd/logind.conf".source ];
+    # Restarting systemd-logind breaks X11
+    # - upstream commit: https://cgit.freedesktop.org/xorg/xserver/commit/?id=dc48bd653c7e101
+    # - systemd announcement: https://github.com/systemd/systemd/blob/22043e4317ecd2bc7834b48a6d364de76bb26d91/NEWS#L103-L112
+    # - this might be addressed in the future by xorg
+    #systemd.services.systemd-logind.restartTriggers = [ config.environment.etc."systemd/logind.conf".source ];
+    systemd.services.systemd-logind.restartIfChanged = false;
     systemd.services.systemd-logind.stopIfChanged = false;
     systemd.services.systemd-journald.restartTriggers = [ config.environment.etc."systemd/journald.conf".source ];
     systemd.services.systemd-journald.stopIfChanged = false;

@teh
Copy link
Contributor

teh commented Sep 27, 2017

@Mic92's patch is what @zimbatm and I discussed last Sunday as well. I think it's probably the correct solution. I had wanted to investigate what issues a never-restarted logind would cause. The linked commit message says it's OK so +1 from me.

Mic92 added a commit that referenced this issue Sep 27, 2017
@Mic92
Copy link
Member

Mic92 commented Sep 27, 2017

commit was applied.

@Mic92 Mic92 closed this as completed Sep 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants