35

I keep getting the following error messages in the syslog of one of my servers:

# tail /var/log/syslog
Oct 29 13:48:40 myserver dbus[19617]: [system] Failed to activate service 'org.freedesktop.login1': timed out
Oct 29 13:48:40 myserver dbus[19617]: [system] Activating via systemd: service name='org.freedesktop.login1' unit='dbus-org.freedesktop.login1.service'
Oct 29 13:49:05 myserver dbus[19617]: [system] Failed to activate service 'org.freedesktop.login1': timed out
Oct 29 13:49:05 myserver dbus[19617]: [system] Activating via systemd: service name='org.freedesktop.login1' unit='dbus-org.freedesktop.login1.service'

They seem to correlate to FTP Logins on the ProFTPd daemon:

# tail /var/log/proftpd/proftpd.log
2015-10-29 13:48:40,433 myserver proftpd[17872] myserver.example.com (remote.example.com[192.168.22.33]): USER switch: Login successful.
2015-10-29 13:48:40,460 myserver proftpd[17872] myserver.example.com (remote.example.com[192.168.22.33]): FTP session closed.
2015-10-29 13:48:40,664 myserver proftpd[17881] myserver.example.com (remote.example.com[192.168.22.33]): FTP session opened.
2015-10-29 13:49:05,687 myserver proftpd[17881] myserver.example.com (remote.example.com[192.168.22.33]): USER switch: Login successful.
2015-10-29 13:49:05,705 myserver proftpd[17881] myserver.example.com (remote.example.com[192.168.22.33]): FTP session closed.
2015-10-29 13:49:05,908 myserver proftpd[17915] myserver.example.com (remote.example.com[192.168.22.33]): FTP session opened.

The FTP logins themselves seem to work without problems for the user, though. I've got a couple of other servers also running ProFTPd but so far never got these errors.

They might be related to a recent upgrade from Debian 7 to Debian 8 though.

Any ideas what the message want to tell me or even what causes them?

I already tried restarting the dbus and proftpd daemons and even the server and made sure that the DBUS socket /var/run/dbus/system_bus_socket is existing but so far the messages keep coming.

EDIT: The output of journalctl as requested in the comment:

root@myserver:/home/chammers# systemctl status -l dbus-org.freedesktop.login1.service
● systemd-logind.service - Login Service
   Loaded: loaded (/lib/systemd/system/systemd-logind.service; static)
   Active: active (running) since Tue 2015-10-27 13:23:32 CET; 1 weeks 0 days ago
     Docs: man:systemd-logind.service(8)
           man:logind.conf(5)
           http://www.freedesktop.org/wiki/Software/systemd/logind
           http://www.freedesktop.org/wiki/Software/systemd/multiseat
 Main PID: 467 (systemd-logind)
   Status: "Processing requests..."
   CGroup: /system.slice/systemd-logind.service
           └─467 /lib/systemd/systemd-logind

Oct 28 10:15:25 myserver systemd-logind[467]: New session c3308 of user switch.
Oct 28 10:15:25 myserver systemd-logind[467]: Removed session c3308.
Oct 28 10:15:25 myserver systemd-logind[467]: New session c3309 of user switch.
Oct 28 10:15:25 myserver systemd-logind[467]: Removed session c3309.
Oct 28 10:15:25 myserver systemd-logind[467]: New session c3310 of user switch.
Oct 28 10:15:25 myserver systemd-logind[467]: Removed session c3310.
Oct 28 10:15:25 myserver systemd-logind[467]: New session c3311 of user switch.
Oct 28 10:15:25 myserver systemd-logind[467]: Removed session c3311.
Oct 28 10:19:52 myserver systemd-logind[467]: New session 909 of user chammers.
Oct 28 10:27:11 myserver systemd-logind[467]: Failed to abandon session scope: Transport endpoint is not connected

And more journalctl output:

Nov 03 16:21:19 myserver dbus[19617]: [system] Failed to activate service 'org.freedesktop.login1': timed out
Nov 03 16:21:19 myserver proftpd[23417]: pam_systemd(proftpd:session): Failed to create session: Activation of org.freedesktop.login1 timed out
Nov 03 16:21:19 myserver proftpd[23418]: pam_systemd(proftpd:session): Failed to create session: Activation of org.freedesktop.login1 timed out
Nov 03 16:21:19 myserver proftpd[23417]: pam_unix(proftpd:session): session closed for user switch
Nov 03 16:21:19 myserver proftpd[23418]: pam_unix(proftpd:session): session closed for user switch
Nov 03 16:21:19 myserver proftpd[23420]: pam_unix(proftpd:session): session opened for user switch by (uid=0)
Nov 03 16:21:19 myserver dbus[19617]: [system] Activating via systemd: service name='org.freedesktop.login1' unit='dbus-org.freedesktop.login1.service'
Nov 03 16:21:19 myserver proftpd[23421]: pam_unix(proftpd:session): session opened for user switch by (uid=0)
  • What does systemctl status -l dbus-org.freedesktop.login1.service report when run as root? Does anything stand out in the output of journalctl (especially around the times of the error messages)? – Ferenc Wágner Oct 31 '15 at 8:14
  • I've added the output of systemctl/journalctl above. – lathspell Nov 3 '15 at 15:28
  • 1
    Does restarting logind (systemctl restart systemd-logind) help? – Ferenc Wágner Nov 4 '15 at 11:19
  • So far it did help for the day. I've now rebooted the server to see if the problem comes back as a simple reboot never helped before I reported the problem here. – lathspell Nov 5 '15 at 11:46
  • The restart seems to have fixed the problem. Almost disappointing ;) What did it do that a simple "shutdown -r now" couldn't fix? Thanks for you help! – lathspell Nov 6 '15 at 10:02
21

Restart logind:

# systemctl restart systemd-logind

Beware that restarting dbus will break their connection again.

| improve this answer | |
  • This solves the problem only temporarily. After a while (months) the same problem reappears. – Ortomala Lokni Feb 10 '17 at 15:14
  • 3
    # systemctl restart systemd-logind Failed to restart systemd-logind.service: Connection timed out See system logs and 'systemctl status systemd-logind.service' for details. – Dalibor Filus Jan 11 '18 at 12:05
  • And did you see them, @DaliborFilus? – Ferenc Wágner Jan 12 '18 at 0:16
  • ≤systemctl status php7.0-fpm did tell me the same thing, so I figured running systemctl status is pointless at that time. This was a production server, I had to act quickly. Will try next time. – Dalibor Filus Jan 12 '18 at 12:38
  • 1
    Fixed it here, where the real pain point was really slow SSH login. In my case, the issue might be related to a recent systemd update, and no reboot thereafter. needs-restarting (still) says systemd needs a reboot. – Nicolas Melay Aug 27 '18 at 0:08
7

Reboot was the only solution that worked for me. I killed the runaway dbus process and other things failed.

This is what happened when i tried to reload httpd-

Error getting authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: GDBus.Error:org.freedesktop.DBus.Error.TimedOut: Activation of org.freedesktop.PolicyKit1 timed out (g-dbus-error-quark, 20)
Failed to reload httpd.service: Connection timed out

Centos7 is buggy.

| improve this answer | |
2

Restarting only systemd-logind service is not enough, it just postpones the main problem.

Seems like this is caused by too many files pilled up under '/run/systemd/system/', created by the service and not properly cleaned up, especially on hosts with a lot of logins. Eventually after some time you would start seeing some weird behavior like hostnamectl not reporting a thing, or timedatectl reports Failed to query server: Connection timed out and other odd things. As well the symptoms reported originally.

One workaround is to delete all 'session-*.scope' files and to restart systemd. Restarting the host is not necessary in that case. This probably is related to a bug in systemd and dbus, hopefully in next updates they will be fixed.

| improve this answer | |
  • Any idea what is "too many"? We're having this issue on RHEL 7.8 with only 511 files under /run/systemd/system. – jblaine Jun 24 at 19:11
1

I was faced with the same issue today and i found out that it was initially caused by a service eating up all available memory. I found the related log lines, which made clear that it is caused by memory allocation in the /var/log/messages log.

systemd: Starting Session 750154 of user root.
systemd: Failed to fork: Cannot allocate memory
systemd: Assertion 'pid >= 1' failed at src/core/unit.c:1997, function unit_watch_pid(). Aborting.
systemd: Caught <ABRT>, cannot fork for core dump: Cannot allocate memory
systemd: Freezing execution.
dbus[697]: [system] Failed to activate service 'org.freedesktop.systemd1': timed out

To find out the service using most of the memory I executed this:

ps aux --sort=-%mem

To solve the issue i first tried to free the memory, but still systemd-logind was not able to start up. Therefore I had to reboot the server and the issue was solved.

| improve this answer | |
0

On my DietPi instance, I got this filling up the log files when I enabled the serial console. The problem was that systemd-logind.service was masked. This was an easy fix:

sudo systemctl unmask systemd-logind.service
sudo systemctl start systemd-logind.service
| improve this answer | |
-2

Just reinstall systemd.

apt install --reinstall systemd

this resolve the issue for me on many VMs

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.