From 873662b8addd6d0b1daaa3feaa8766b5d2507563 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 15 Oct 2013 13:15:33 +0200 Subject: [PATCH] slim: Work around broken PAM session handling Previously logging in via SLiM more than once didn't work because SLiM doesn't clean up its PAM session properly (that is, in a child rather than in the parent). Thus the slim process becomes part of the user session's cgroup, among other things. This patch causes SLiM to exit after the session has finished, after which systemd will restart display-manager.service. Fixes NixOS/nixops#137. --- nixos/modules/services/x11/xserver.nix | 5 +++++ pkgs/applications/display-managers/slim/default.nix | 5 +++++ .../display-managers/slim/run-once.patch | 12 ++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 pkgs/applications/display-managers/slim/run-once.patch diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix index d42d7caaa06b..6e470e65e351 100644 --- a/nixos/modules/services/x11/xserver.nix +++ b/nixos/modules/services/x11/xserver.nix @@ -527,6 +527,11 @@ in ''; script = "${cfg.displayManager.job.execCmd}"; + + serviceConfig = { + Restart = "always"; + RestartSec = "200ms"; + }; }; services.xserver.displayManager.xserverArgs = diff --git a/pkgs/applications/display-managers/slim/default.nix b/pkgs/applications/display-managers/slim/default.nix index 750efdc6ea4c..0b5bcccfb21a 100644 --- a/pkgs/applications/display-managers/slim/default.nix +++ b/pkgs/applications/display-managers/slim/default.nix @@ -13,6 +13,11 @@ stdenv.mkDerivation rec { [ # Allow the paths of the configuration file and theme directory to # be set at runtime. ./runtime-paths.patch + + # Exit after the user's session has finished. This works around + # slim's broken PAM session handling (see + # http://developer.berlios.de/bugs/?func=detailbug&bug_id=19102&group_id=2663). + ./run-once.patch ]; preConfigure = "substituteInPlace CMakeLists.txt --replace /etc $out/etc --replace /lib $out/lib"; diff --git a/pkgs/applications/display-managers/slim/run-once.patch b/pkgs/applications/display-managers/slim/run-once.patch new file mode 100644 index 000000000000..78f1454a883e --- /dev/null +++ b/pkgs/applications/display-managers/slim/run-once.patch @@ -0,0 +1,12 @@ +diff -ru -x '*~' slim-1.3.6-orig/app.cpp slim-1.3.6/app.cpp +--- slim-1.3.6-orig/app.cpp 2013-10-15 11:02:55.629263422 +0200 ++++ slim-1.3.6/app.cpp 2013-10-15 13:00:10.141210784 +0200 +@@ -816,7 +822,7 @@ + StopServer(); + RemoveLock(); + while (waitpid(-1, NULL, WNOHANG) > 0); /* Collects all dead childrens */ +- Run(); ++ exit(OK_EXIT); + } + + void App::KillAllClients(Bool top) {