pam_systemd delays SSH login - required?

11,842

I had the same problem with Debian Jessie 8 and found another solution here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=770135#46

The command systemctl restart systemd-logind.service or a complete reboot fixed the ssh login delay for me.

Share:
11,842

Related videos on Youtube

Daniel Schneller
Author by

Daniel Schneller

I am a software developer and operations guy. In an earlier life I programmed lots of Java for more than 10 years. Then I focused on mobile development on iOS and Android, but more recently I have moved on towards infrastructure and cloud topics. Currently most of my time is spent with AWS, Terraform, Packer, Consul, several databases, and Ansible, building and improving the infrastructure of CenterDevice, our cloud document management platform. Apart from this I spend my time with everything tech, mostly Linux and macOS, and other insanities ;) Disclaimer: Anything posted here is my personal and private view of things. I do not speak on behalf of my employer or their opinions.

Updated on September 18, 2022

Comments

  • Daniel Schneller
    Daniel Schneller almost 2 years

    On our Saucy servers (13.10) we are seeing long delays when logging into the systems via SSH. I figured out it is related to the line

    session optional        pam_systemd.so
    

    in /etc/pam.d/common-session.

    When I comment that line, login is immediate.

    The /var/log/auth.log output that accompanies any delayed login attempts looks like this:

    May 21 17:33:58 control02 sshd[18488]: Accepted publickey for daniel.schneller from 10.102.2.9 port 35763 ssh2
    May 21 17:33:58 control02 sshd[18488]: pam_unix(sshd:session): session opened for user daniel.schneller by (uid=0)
    May 21 17:34:23 control02 sshd[18488]: pam_systemd(sshd:session): Failed to create session: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
    

    I could not find any definite documentation yet whether or not I need the module at all. I could, of course, leave it commented out, because it seems to only wait for a timeout anyway at the moment, but I would rather understand the underlying cause and fix that, if at all possible, to prevent problems down the road.

    • Michael Miller
      Michael Miller about 10 years
      The libpam-systemd package is installed by default on desktop systems but I think not on server installs. Is this a desktop or server install? Are the dbus and systemd-logind upstart jobs running? Does the SSH login get a valid logind session? The timeout seems like a dbus timeout communicating with logind.