From: Michael Biebl <biebl@debian.org>
Date: Thu, 18 Jul 2013 20:36:39 +0200
Subject: Start logind on demand via libpam-systemd

Don't make pam_sm_open_session() a NOP if logind is not running. Trying
to access logind via D-Bus will start it on demand.
---
 src/login/pam-module.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/login/pam-module.c b/src/login/pam-module.c
index 13290fd..2486fa5 100644
--- a/src/login/pam-module.c
+++ b/src/login/pam-module.c
@@ -336,10 +336,6 @@ _public_ PAM_EXTERN int pam_sm_open_session(
 
         /* pam_syslog(handle, LOG_INFO, "pam-systemd initializing"); */
 
-        /* Make this a NOP on non-logind systems */
-        if (!logind_running())
-                return PAM_SUCCESS;
-
         if (parse_argv(handle,
                        argc, argv,
                        &controllers, &reset_controllers,
@@ -400,7 +396,8 @@ _public_ PAM_EXTERN int pam_sm_open_session(
 
         bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error);
         if (!bus) {
-                pam_syslog(handle, LOG_ERR, "Failed to connect to system bus: %s", bus_error_message(&error));
+                if (debug)
+                        pam_syslog(handle, LOG_ERR, "Failed to connect to system bus: %s", bus_error_message(&error));
                 r = PAM_SESSION_ERR;
                 goto finish;
         }
