Slow KDE-login possibly caused by rtkit-daemon failing to start

Since about a week, I’ve been experiencing very slow logins. It takes about five minutes for the menu-bar to appear on the KDE desktop. This happend after a system update around a week ago (September 9).

It seems like the login is trying to start rtkit-daemon, which consistently fails to start, with an error “eventfd(): Too many open files”.
I see this error repeated in the log a number of times, until it gives up starting rtkit-daemon and finally displays the desktop.

I’ve tried to raise the max number of open files allowed, but that didn’t make the error go away.
Has anyone else been experiencing problems with slow logins or rtkit failing to start during the last week or so?

Perhaps someone has any ideas of a workaround or bugfix?

most likely a pulse audio issue what the issue is who knows
I’d say run an update and see if it fixes things

zypper up

if not try removing the pulse audio config files

rm -rf ~/.config/pulse

then reboot
or try pavucontrol to fix things

Thanks for the hints.
I’ve applied the latest updates, removed ~/.config/pulse (and also ~/.pulse and ~/.pulse-cookie), in fact, I’ve even tried logging in with a new and clean user.
I also installed pavucontrol as you suggested.

Unfortuantley it didn’t help.

This is what I see repeated in the syslog from rtkit:


2017-09-18T17:24:54.813518+02:00 linux-nm5f systemd[1]: Starting RealtimeKit Scheduling Policy Service...
2017-09-18T17:24:54.872784+02:00 linux-nm5f dbus[1190]: [system] Successfully activated service 'org.freedesktop.RealtimeKit1'
2017-09-18T17:24:54.873065+02:00 linux-nm5f rtkit-daemon[2939]: Successfully called chroot.
2017-09-18T17:24:54.873341+02:00 linux-nm5f systemd[1]: Started RealtimeKit Scheduling Policy Service.
2017-09-18T17:24:54.873526+02:00 linux-nm5f rtkit-daemon[2939]: Successfully dropped privileges.
2017-09-18T17:24:54.873653+02:00 linux-nm5f rtkit-daemon[2939]: Successfully limited resources.
2017-09-18T17:24:54.873820+02:00 linux-nm5f rtkit-daemon[2939]: eventfd() failed: Too many open files
2017-09-18T17:24:54.873937+02:00 linux-nm5f rtkit-daemon[2939]: Demoting known real-time threads.
2017-09-18T17:24:54.874049+02:00 linux-nm5f rtkit-daemon[2939]: Demoted 0 threads.
2017-09-18T17:24:54.874761+02:00 linux-nm5f dbus[1190]: [system] Activating via systemd: service name='org.freedesktop.RealtimeKit1' 
unit='rtkit-daemon.service'
2017-09-18T17:24:54.875751+02:00 linux-nm5f systemd[1]: Started RealtimeKit Scheduling Policy Service.
2017-09-18T17:24:54.901545+02:00 linux-nm5f systemd[1]: rtkit-daemon.service: Main process exited, code=exited, status=1/FAILURE
2017-09-18T17:24:54.901881+02:00 linux-nm5f systemd[1]: rtkit-daemon.service: Unit entered failed state.
2017-09-18T17:24:54.902052+02:00 linux-nm5f systemd[1]: rtkit-daemon.service: Failed with result 'exit-code'.
2017-09-18T17:25:19.890794+02:00 linux-nm5f dbus[1190]: [system] Failed to activate service 'org.freedesktop.RealtimeKit1': timed out

Before the updates last week, there were no rtkit-related errors in the syslog.

As indicated already, pulseaudio uses rtkit, and pulseaudio is started during login.

I’ve tried to raise the max number of open files allowed, but that didn’t make the error go away.

And how exactly did you do that?

Maybe you’d need to actually raise the allowed number of processes though (in /etc/security/limits.conf).
I.e. try to raise the values in these two lines:

# harden against fork-bombs*               hard    nproc           1700

*               soft    nproc           1200


The nproc limits are quite low in Leap 42.3, and there already are bug reports about that.

Has anyone else been experiencing problems with slow logins or rtkit failing to start during the last week or so?

Works fine here.
But if it is about the nproc limit, it likely depends on what else is started during login.
If you keep applications running on logout, they will get restarted on login. And especially Chromium is notorious for using a lot of processes…

In /etc/security/limits.conf I’ve added:


*               hard    nofile          16384
*               soft    nofile          16384

But if it is about the nproc limit, it likely depends on what else is started during login.
If you keep applications running on logout, they will get restarted on login. And especially Chromium is notorious for using a lot of processes…

Thanks, I’ll try that the next reboot. However I don’t keep applications running on logout and I don’t have any database servers or application servers running on this machine, so I don’t expect much of a difference.

I’m also recently experiencing this problem on leap 42.2, i.e. getting
rtkit-daemon]: eventfd() failed: Too many open files
on journalctl -u rtkit-daemon -l

I fail to see, how increasing the processes limit will help for that error and doubt very much increasing nofiles in /etc/security/limits.conf will help either, as the log contains just a line above “Successfully limited resources.”.

In http://git.0pointer.net/rtkit.git/tree/rtkit-daemon.c there seems a coded limit of 50:
{ .id = RLIMIT_NOFILE, .name = “RLIMIT_NOFILE”, .value = 50 }

However as to why it suddenly needs more than this is beyond me…

Thanks.

That was just a suggestion, because there are problems with the too low process limit in Leap.
Many things in Linux are treated like files, so it might just be a misleading error message…

Of course the actual problem might just as well be something else completely.

I’m also on Leap 42.2 here but, without any Realtime Kit issues:

In systemd:

rtkit-daemon.service                    disabled

(It’s started by Pulse Audio when a user logs in.)


 > systemctl status rtkit-daemon.service
● rtkit-daemon.service - RealtimeKit Scheduling Policy Service
   Loaded: loaded (/usr/lib/systemd/system/rtkit-daemon.service; disabled; vendor preset: disabled)
   Active: active (running) since Di 2017-09-19 08:16:41 CEST; 2h 58min ago
 Main PID: 4682 (rtkit-daemon)
    Tasks: 3 (limit: 512)
   CGroup: /system.slice/rtkit-daemon.service
           └─4682 /usr/lib/rtkit/rtkit-daemon
 > 

Systemd Journal – this-boot:


Sep 19 08:16:41 xxx dbus[1167]: [system] Activating via systemd: service name='org.freedesktop.RealtimeKit1' unit='rtkit-daemon.service'
Sep 19 08:16:41 xxx systemd[1]: Starting RealtimeKit Scheduling Policy Service...
Sep 19 08:16:41 xxx dbus[1167]: [system] Successfully activated service 'org.freedesktop.RealtimeKit1'
Sep 19 08:16:41 xxx systemd[1]: Started RealtimeKit Scheduling Policy Service.
Sep 19 08:16:41 xxx rtkit-daemon[4682]: Successfully called chroot.
Sep 19 08:16:41 xxx rtkit-daemon[4682]: Successfully dropped privileges.
Sep 19 08:16:41 xxx rtkit-daemon[4682]: Successfully limited resources.
Sep 19 08:16:41 xxx rtkit-daemon[4682]: Running.
Sep 19 08:16:41 xxx rtkit-daemon[4682]: Canary thread running.
Sep 19 08:16:41 xxx rtkit-daemon[4682]: Successfully made thread 4681 of process 4681 (/usr/bin/pulseaudio) owned by 'yy' high priority at nice level -11.
Sep 19 08:16:41 xxx rtkit-daemon[4682]: Supervising 1 threads of 1 processes of 1 users.
Sep 19 08:16:41 xxx rtkit-daemon[4682]: Watchdog thread running.
Sep 19 08:16:41 xxx polkitd[2897]: Registered Authentication Agent for unix-session:4 (system bus name :1.39 [/usr/lib64/libexec/polkit-kde-authentication-agent-1], object path /org/kde/PolicyKit1/AuthenticationAgent, locale de_DE.UTF-8)
Sep 19 08:16:41 xxx rtkit-daemon[4682]: Supervising 1 threads of 1 processes of 1 users.
Sep 19 08:16:41 xxx rtkit-daemon[4682]: Successfully made thread 4715 of process 4681 (/usr/bin/pulseaudio) owned by 'yy' RT at priority 5.
Sep 19 08:16:41 xxx rtkit-daemon[4682]: Supervising 2 threads of 1 processes of 1 users.
Sep 19 08:16:41 xxx rtkit-daemon[4682]: Supervising 2 threads of 1 processes of 1 users.
Sep 19 08:16:41 xxx rtkit-daemon[4682]: Successfully made thread 4726 of process 4681 (/usr/bin/pulseaudio) owned by 'yy' RT at priority 5.
Sep 19 08:16:41 xxx rtkit-daemon[4682]: Supervising 3 threads of 1 processes of 1 users.
Sep 19 08:16:41 xxx rtkit-daemon[4682]: Supervising 3 threads of 1 processes of 1 users.
Sep 19 08:16:41 xxx rtkit-daemon[4682]: Successfully made thread 4729 of process 4681 (/usr/bin/pulseaudio) owned by 'yy' RT at priority 5.
Sep 19 08:16:41 xxx rtkit-daemon[4682]: Supervising 4 threads of 1 processes of 1 users.

Vanilla Leap 42.2 – Apache and Samba servers are running – ‘/etc/security/limits.conf’ only has the default “harden against fork-bombs”


*               hard    nproc           1700
*               soft    nproc           1200
root            hard    nproc           3000
root            soft    nproc           1850

[HR][/HR]Suggestion: check the user’s ‘~/.cache/’ directory and the user files in ‘/tmp/’ and ‘/var/tmp/’ – there may be some extraneous files present from a previous crash or whatever.

Please post the (user) CLI output of ‘ulimit’ and ‘ulimit -a’.
On this vanilla Leap 42.3 Laptop – no servers running and, the “rtkit-daemon” journal entries are the same as those for the Leap 42.2 system posted previously – the outputs are:


 > ulimit 
unlimited
 > ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 28471
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1200
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
 > 

Just out of interest, I git cloned the RealtimeKit sources from http://git.0pointer.net/rtkit.git/tree/ and built it, then run the resulting executabe directly from the shell


2017-09-19T18:19:28.326658+02:00 linux-nm5f rtkit-daemon[12405]: Successfully called chroot.
2017-09-19T18:19:28.327006+02:00 linux-nm5f rtkit-daemon[12405]: Successfully dropped privileges.
2017-09-19T18:19:28.327244+02:00 linux-nm5f rtkit-daemon[12405]: Successfully limited resources.
2017-09-19T18:19:28.327445+02:00 linux-nm5f rtkit-daemon[12405]: Running.
2017-09-19T18:19:28.327644+02:00 linux-nm5f rtkit-daemon[12405]: Canary thread running.
2017-09-19T18:19:28.327855+02:00 linux-nm5f rtkit-daemon[12405]: Watchdog thread running.

No eventfd() crash.

Then executing the old /usr/lib/rtkit/rtkit-daemon from the shell. Immediate crash:


2017-09-19T18:22:14.405969+02:00 linux-nm5f rtkit-daemon[12417]: Successfully called chroot.
2017-09-19T18:22:14.406155+02:00 linux-nm5f rtkit-daemon[12417]: Successfully dropped privileges.
2017-09-19T18:22:14.406266+02:00 linux-nm5f rtkit-daemon[12417]: Successfully limited resources.
2017-09-19T18:22:14.406324+02:00 linux-nm5f rtkit-daemon[12417]: eventfd() failed: Too many open files
2017-09-19T18:22:14.406349+02:00 linux-nm5f rtkit-daemon[12417]: Demoting known real-time threads.
2017-09-19T18:22:14.406373+02:00 linux-nm5f rtkit-daemon[12417]: Demoted 0 threads.

Interesting…

Please show the ‘rtkit-daemon’ versions you currently have on your system.
What I have here on a vanilla Leap 42.3 Laptop with a functioning Realtime Kit is:


 > /usr/lib/rtkit/rtkit-daemon --version
rtkit-daemon 0.11
 > 

The source code of the rtkit-daemon (version 0.11) used Leap 42.3 still has the following “Drop removed ControlGroup stanza” code in ‘rtkit-daemon.service.in’:


# Work around the fact that the Linux currently doesn't assign any RT
# budget to CPU control groups that have none configured explicitly
ControlGroup=cpu:/

But, there’s an openSUSE Patch in the openSUSE Package RPM which removes this code segment:“rtkit-0.11_git201205151338/rtkit-daemon.service.in”
There’s a couple of other patches in the openSUSE RPM as well as and also . . .

Both the one I built from sources and the one installed identifies themselves as version 0.11.
The file sizes are very different though:


-rwxr-xr-x 1 root root 114304 Sep 19 18:28 /usr/lib/rtkit/rtkit-daemon
-rwxr-xr-x 1 root root  56592 Sep 19 18:28 /usr/lib/rtkit/rtkit-daemon.bak

The bigger one is the one I built from sources.

Please check the openSUSE repository you are using to retrieve the ‘rtkit’ package – it should be <http://download.opensuse.org/distribution/leap/42.3/repo/oss/suse/>.

Please perform a forced re-install of the ‘rtkit’ package from the main OSS openSUSE Leap 42.3 repository.

It may be that, the RPM database and Zypper caches are not quite as the should be; therefore the following is advised before the forced re-install of the ‘rtkit’ package is performed:

  • “zypper clean --all”
  • “zypper refresh --services”
  • “zypper refresh --force”
  • “rpm --rebuilddb”
  • “rpm --verify”

With the openSUSE Packet Search <https://software.opensuse.org/search>, check that the Leap 42.3 ‘rtkit’ RPM package has the same content as the code you built from the Git repositories. <https://software.opensuse.org/package/rtkit?search_term=rtkit> <https://download.opensuse.org/repositories/openSUSE:/Leap:/42.3/standard/x86_64/rtkit-0.11_git201205151338-13.4.x86_64.rpm>.

Please be aware that you should use the openSUSE Build Service (a public instance of the Open Build Service (OBS)) to compile code and build packages suitable for use on openSUSE systems: <https://build.opensuse.org/>.

I followed your suggestion including a forced reinstall of rtkit:


> zypper lr
Repository priorities are without effect. All enabled repositories share the same priority.

#  | Alias                             | Name                                    | Enabled | GPG Check | Refresh
---+-----------------------------------+-----------------------------------------+---------+-----------+--------
 1 | google-chrome                     | google-chrome                           | Yes     | (r ) Yes  | Yes    
 2 | http-ftp.uni-erlangen.de-689734d7 | Packman Repository                      | Yes     | (r ) Yes  | Yes    
 3 | http-opensuse-guide.org-fee2cf2e  | libdvdcss repository                    | Yes     | (r ) Yes  | Yes    
 4 | openSUSE-Leap-42.3-Update         | openSUSE-Leap-42.3-Update               | Yes     | (r ) Yes  | Yes    
 5 | openSUSE-Leap-42.3-Update-Non-Oss | openSUSE-Leap-42.3-Update-Non-Oss       | Yes     | (r ) Yes  | Yes    
 6 | repo-debug-update                 | openSUSE-leap/42.3-Update-Debug         | No      | ----      | ----   
 7 | repo-debug-update-non-oss         | openSUSE-leap/42.3-Update-Debug-Non-Oss | No      | ----      | ----   
 8 | repo-non-oss                      | openSUSE-leap/42.3-Non-Oss              | Yes     | (r ) Yes  | Yes    
 9 | repo-oss                          | openSUSE-leap/42.3-Oss                  | Yes     | (r ) Yes  | Yes    
10 | repo-source                       | openSUSE-leap/42.3-Source               | No      | ----      | ----  


> zypper info rtkit
Loading repository data...
Reading installed packages...


Information for package rtkit:
------------------------------
Repository     : openSUSE-leap/42.3-Oss             
Name           : rtkit                              
Version        : 0.11_git201205151338-13.4          
Arch           : x86_64                             
Vendor         : openSUSE                           
Installed Size : 128.1 KiB                          
Installed      : Yes                                
Status         : up-to-date                         
Source package : rtkit-0.11_git201205151338-13.4.src
Summary        : Realtime Policy and Watchdog Daemon
Description    :                                    
    RealtimeKit is a D-Bus system service that changes the
    scheduling policy of user processes/threads to SCHED_RR (i.e. realtime
    scheduling mode) on request. It is intended to be used as a secure
    mechanism to allow real-time scheduling to be used by normal user
    processes.



Seems correct to me.

I also rebuilt the source rpm from https://download.opensuse.org/repositories/openSUSE:/Leap:/42.3/standard/src/rtkit-0.11_git201205151338-13.4.src.rpm. The resulting rtkit-daemon is (as expected) executing with the same eventfd() error.

And yes, there seems to be some differences to the code of the src.rpm compared with the git repo. There might also be differences in autconf- and build options that affects this issue.

With the rtkit from the Leap 42.3 OSS Repository, does the ‘rtkit-daemon’ start correctly or, not?

If so, then, there’s an issue with the openSUSE build of the “rtkit” package which has been provoked by your machine (other machines, mine included, do not seem to be able to flag this issue) and, therefore, you should submit an openSUSE Bug Report against the “rtkit” package build.

FYI, I’ve now filed a bug report (https://bugzilla.opensuse.org/show_bug.cgi?id=1059723)