Solved: How to address Redhat Bug polkit using high cpu in Linux ?
Today in this post, we will see how to fix high CPU utilization by polkit daemon on RHEL 7.X bug.
I. Bug Details
# top PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 19315 polkitd 20 0 620156 12660 4188 S 11.9 0.2 22190:34 polkitd
II. Solution
The issue is solved by updating the accountsservice daemon.
Detailed and official instructions can be found at: https://access.redhat.com/solutions/3819902
Its resolved with accountsservice-0.6.50-5.el7 or above.
III. Instructions
a. Check out the CPU usage before update.
Before, when the server is impacted. 81% CPU is idle.
[root@ngelinux001 ~]# top top - 08:50:29 up 157 days, 18:13, 7 users, load average: 2.20, 1.70, 1.16 Tasks: 387 total, 1 running, 351 sleeping, 31 stopped, 4 zombie %Cpu(s): 9.4 us, 9.4 sy, 0.0 ni, 81.2 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 8009500 total, 361836 free, 3196664 used, 4451000 buff/cache KiB Swap: 8388604 total, 7816956 free, 571648 used. 4303432 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 19315 polkitd 20 0 620140 13244 4260 S 10.9 0.2 22818:24 polkitd 8294 dbus 20 0 63828 5220 1816 S 2.6 0.1 5849:52 dbus-daemon 9552 nscd 20 0 844624 1344 912 S 2.0 0.0 2:12.05 nscd
b. Update the rpm package now.
[root@ngelinux001 yum.repos.d]# yum update accountsservice.x86_64 0.6.50-7.el7 Loaded plugins: aliases, changelog, kabi, langpacks, product-id, search-disabled-repos, subscription-manager, tmprepo, verify, : versionlock This system is not registered with an entitlement server. You can use subscription-manager to register. Loading support for Red Hat kernel ABI No Match for argument: 0.6.50-7.el7 No package 0.6.50-7.el7 available. Resolving Dependencies --> Running transaction check ---> Package accountsservice.x86_64 0:0.6.50-2.el7 will be updated --> Processing Dependency: accountsservice = 0.6.50-2.el7 for package: accountsservice-libs-0.6.50-2.el7.i686 --> Processing Dependency: accountsservice = 0.6.50-2.el7 for package: accountsservice-libs-0.6.50-2.el7.x86_64 ---> Package accountsservice.x86_64 0:0.6.50-7.el7 will be an update --> Running transaction check ---> Package accountsservice-libs.i686 0:0.6.50-2.el7 will be updated ---> Package accountsservice-libs.x86_64 0:0.6.50-2.el7 will be updated ---> Package accountsservice-libs.i686 0:0.6.50-7.el7 will be an update ---> Package accountsservice-libs.x86_64 0:0.6.50-7.el7 will be an update --> Finished Dependency Resolution Dependencies Resolved ================================================================================================================================ Package Arch Version Repository Size ================================================================================================================================ Updating: accountsservice x86_64 0.6.50-7.el7 base2 99 k Updating for dependencies: accountsservice-libs i686 0.6.50-7.el7 base2 80 k accountsservice-libs x86_64 0.6.50-7.el7 base2 81 k Transaction Summary ================================================================================================================================ Upgrade 1 Package (+2 Dependent packages) Total download size: 259 k Is this ok [y/d/N]:
c. Check out polkit service status.
[root@ngelinux001 ~]# service polkit status Redirecting to /bin/systemctl status polkit.service ● polkit.service - Authorization Manager Loaded: loaded (/usr/lib/systemd/system/polkit.service; static; vendor preset: enabled) Active: active (running) since Fri 2022-01-28 15:40:06 IST; 5 months 5 days ago Docs: man:polkit(8) Main PID: 19315 (polkitd) CGroup: /system.slice/polkit.service └─19315 /usr/lib/polkit-1/polkitd --no-debug Jan 28 15:40:06 ngelinux001 polkitd[19315]: Loading rules from directory /usr/share/polkit-1/rules.d Jan 28 15:40:06 ngelinux001 polkitd[19315]: Finished loading, compiling and executing 10 rules Jan 28 15:40:06 ngelinux001 polkitd[19315]: Acquired the name org.freedesktop.PolicyKit1 on the system bus Jan 28 15:40:06 ngelinux001 systemd[1]: Started Authorization Manager. Jan 28 15:40:06 ngelinux001 polkitd[19315]: Registered Authentication Agent for unix-process:19310:380526 (system bus ...UTF-8) Jan 28 15:40:06 ngelinux001 polkitd[19315]: Unregistered Authentication Agent for unix-process:19310:380526 (system bu...m bus) Jan 28 15:47:36 ngelinux001 polkitd[19315]: Registered Authentication Agent for unix-session:c1 (system bus name :1.77...UTF-8) Feb 17 15:47:50 ngelinux001 polkitd[19315]: Registered Authentication Agent for unix-process:16780:173226938 (system b...UTF-8) Feb 17 15:47:50 ngelinux001 polkitd[19315]: Unregistered Authentication Agent for unix-process:16780:173226938 (system...m bus) Feb 21 19:48:45 ngelinux001 polkitd[19315]: Registered Authentication Agent for unix-session:c2 (system bus name :1.22...UTF-8) Hint: Some lines were ellipsized, use -l to show in full.
d. Restart the service
[root@ngelinux001 ~]# service polkit restart Redirecting to /bin/systemctl restart polkit.service [root@ngelinux001 ~]#
e. Check out if the CPU usage is fine now.
After making changes, 98% CPU is idle. [root@ngelinux001 ~]# top top - 09:09:44 up 157 days, 18:33, 7 users, load average: 0.06, 0.15, 0.46 Tasks: 386 total, 1 running, 350 sleeping, 31 stopped, 4 zombie %Cpu(s): 1.2 us, 0.2 sy, 0.0 ni, 98.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 8009500 total, 380456 free, 3172232 used, 4456812 buff/cache KiB Swap: 8388604 total, 7824124 free, 564480 used. 4327632 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 22244 amanve 20 0 758208 86236 4600 S 1.3 1.1 1437:07 gsd-color 12788 amanve 20 0 751760 43280 4356 S 1.0 0.5 1016:59 gsd-color 6483 root 20 0 160168 2496 1552 R 0.3 0.0 0:00.06 top 19324 root 20 0 425792 9916 2792 S 0.3 0.1 67:00.26 zasa 1 root 20 0 125860 3968 2328 S 0.0 0.0 61:19.98 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:03.01 kthreadd