I recently setup a Ubuntu 18.04 server for CI and builds. Once setup, I had "ssh" sessions always taking 25s to complete, which seemed odd. Turns out, of course, this is a bloody timeout in dbus and systemd's interacting with such. Why, you may ask, would systemd be involved here? Well, it's because it's fucking stupid. that's why! The first indicator I had was, after tracing the ssh daemon, was this gem in auth.log:
Mar 11 00:43:43 castafiore sshd: pam_systemd(sshd:session): Failed to create session: Connection timed out
pam_systemd eh? So, I edited the following files, removing the optional systemd lines:
/etc/pam.d/common-session /etc/pam.d/runuser-l /etc/pam.d/systemd-user
#session optional pam_systemd.so
Please systemd, when will you go back and just do the one thing you were good at, and supposed to do; replace init.d.