Error calling StartServiceByName for org.freedesktop.PolicyKit1

I recently had an issue where my /etc directory got wiped out, then semi restored.

I have spent some time reinstalling packages that have files in /etc, and now most things work with the exception of such items as USB automounting, the gdm login screen will not come up, just the no option xdm; utilities such as pkaction will not run.

From messages I see repeated blocks like this


Oct 13 11:57:41 <host> systemd[1]: Started Authorization Manager.
Oct 13 11:58:06 <host> dbus-daemon[1388]: [system] Failed to activate service 'org.freedesktop.PolicyKit1': timed out (service_start_timeout=25000ms)
Oct 13 11:58:06 <host> rtkit-daemon[2572]: Warning: PolicyKit call failed: Failed to activate service 'org.freedesktop.PolicyKit1': timed out (service_start_timeout=25000ms)
Oct 13 11:58:06 <host> dbus-daemon[1388]: [system] Activating via systemd: service name='org.freedesktop.PolicyKit1' unit='polkit.service' requested by ':1.29' (uid=0 pid=2572 comm="/usr/lib/rtkit/rtkit-daemon ")
Oct 13 11:58:06 <host> systemd[1]: Starting Authorization Manager...
Oct 13 11:58:06 <host> polkitd[22640]: Started polkitd version 0.116
Oct 13 11:58:06 <host> polkitd[22640]: Loading rules from directory /etc/polkit-1/rules.d
Oct 13 11:58:06 <host> polkitd[22640]: Loading rules from directory /usr/share/polkit-1/rules.d
Oct 13 11:58:06 <host> polkitd[22640]: Finished loading, compiling and executing 4 rules
Oct 13 11:58:06 <host> polkitd[22640]: Lost the name org.freedesktop.PolicyKit1 - exiting

xsession-errors has similar messages


Oct 11 17:35:14 linux-3wjh dbus-daemon[1388]: [system] Failed to activate service 'org.freedesktop.PolicyKit1': timed out (service_start_timeout=25000ms)
Oct 11 17:35:14 linux-3wjh accounts-daemon[2111]: error getting polkit authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: Failed to activate service 'org.freedesktop.PolicyKit1': timed out (service_start_timeout=25000ms)
Oct 11 17:35:14 linux-3wjh accounts-daemon[2111]: Failed to initialize daemon
Oct 11 17:35:14 linux-3wjh dbus-daemon[1388]: [system] Successfully activated service 'org.freedesktop.Accounts'
Oct 11 17:35:14 linux-3wjh systemd[1]: Started Accounts Service.
Oct 11 17:35:14 linux-3wjh systemd[1]: Startup finished in 2.236s (kernel) + 1.173s (initrd) + 47.493s (userspace) = 1min 12.731s.
Oct 11 17:35:14 linux-3wjh gdm: Failed to list cached users: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name :1.16 was not provided by any .service files
Oct 11 17:35:14 linux-3wjh dbus-daemon[1388]: [system] Activating via systemd: service name='org.freedesktop.Accounts' unit='accounts-daemon.service' requested by ':1.19' (uid=0 pid=2376 comm="gdm-session-worker [pam/gdm-launch-environment] ")
Oct 11 17:35:14 linux-3wjh systemd[1]: Starting Accounts Service...
Oct 11 17:35:14 linux-3wjh dbus-daemon[1388]: [system] Activating via systemd: service name='org.freedesktop.PolicyKit1' unit='polkit.service' requested by ':1.20' (uid=0 pid=2379 comm="/usr/lib/accounts-daemon ")

When I try to run any pkaction command, it times out like


# pkaction |grep login
Error getting authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: Failed to activate service 'org.freedesktop.PolicyKit1': timed out (service_start_timeout=25000ms)

polkit and pkaction have been reinstalled.

Gnome/MATE does actually come up with the desktop.

The error when I try to open a USB drive, from the desktop as user:


Unable to mount usbhdd
Not authorized to perform operation (polkit authority not available and caller is not uid 0)

When you simply re-install any package, the configuration files are not touched, so you retain whatever custom settings you made.
If you want to restore default configurations, you have to install using the “-f” flag to do a “force re-installation” and then your configuration files will be over-written with defaults from the package.

zypper in -f *package_name* 

TSU

@Tsu2: Please read posts and questions first, before replying. The OP clearly states that his /etc was wiped out, so the original configs are gone.

@OP: I think you would be better of with a reinstall. Choices you make during install end up as values of keys in various config files. Same goes for actions taken from various YaST modules. Reinstalling would also give you the chance to use btrfs. In cases like this, it can be a real rescue, i.e. you can return to a btrfs snapshot from before the “accident”, which would have brought back /etc as it was.

I actually did a reinstallation from the DVD ISO, not an upgrade install; and I noticed that most of my affected files (the restored ones all curiously had an odd date attached) were still intact.

OK, I did zypper in -f to gpg2, polkit, gconf-polkit, polkit-gnome, polkit-kde-agent-5, and systemd packages.

I still get the no-options xdm login screen (DM=gdm, WM=mate-sessions in /etc/alternatives) and this when I try to access the USB


Unable to mount usbhdd
Not authorized to perform operation (polkit authority not available and caller is not uid 0)

FYI, mounting from the CLI as root works.

xsession-errors:


(package-update-indicator:2552): package-update-indicator-WARNING **: 10:10:40.891: failed to instantiate backend: Error calling StartServiceByName for org.freedesktop.PackageKit: Timeout was reached
Connection failure: Timeout
mate-session[2278]: WARNING: Could not make DBUS call: Failed to activate service 'org.freedesktop.PolicyKit1': timed out (service_start_timeout=25000ms)


** (mate-panel:2483): WARNING **: 10:11:04.778: Could not ask session manager if shut down is available: Timeout was reached
mate-session[2278]: WARNING: Could not make DBUS call: Failed to activate service 'org.freedesktop.PolicyKit1': timed out (service_start_timeout=25000ms)
mate-session[2278]: WARNING: Could not make DBUS call: Rejected send message, 2 matched rules; type="method_call", sender=":1.24" (uid=1000 pid=2278 comm="/usr/bin/mate-session ") interface="org.freedesktop.login1.Manager" member="CanSuspend" error name="(unset)" requested_reply="0" destination=":1.3" (uid=0 pid=1406 comm="/usr/lib/systemd/systemd-logind ")
mate-session[2278]: WARNING: Could not make DBUS call: Rejected send message, 2 matched rules; type="method_call", sender=":1.24" (uid=1000 pid=2278 comm="/usr/bin/mate-session ") interface="org.freedesktop.login1.Manager" member="CanHibernate" error name="(unset)" requested_reply="0" destination=":1.3" (uid=0 pid=1406 comm="/usr/lib/systemd/systemd-logind ")

Also still see the same repeated lines in message as previously posted.

Looking into some other threads, they recommend to run this command to see what registered actions are active, but I can not even see this:


# pkaction --verbose
Error getting authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: Failed to activate service 'org.freedesktop.PolicyKit1': timed out (service_start_timeout=25000ms)

Is there any way to figure out why pkaction can not run any of the normal commands?

I have compared rules and permissions files to a secondary disk, installed on this same system that works fine trying to see what may be different. polkit-* and the rules in /etc/polkit-1/rules.d are identical.

Any ideas on this? I really need to get this fixed as I can not install app like VirtualBox Extension Pack without this type of error

The installer failed with exit code 127: Error getting authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: Failed to activate service 'org.freedesktop.PolicyKit1': timed out (service_start_timeout=25000ms).

I have reinstalled these packages:


zypper in -f polkit
zypper in -f polkit-gnome
zypper in -f polkit-default-privs
zypper in -f polkit-kde-agent-5
zypper in -f gpg2
zypper in -f gconf-polkit
zypper in -f mate-polkit
zypper in -f polkit-default-privs
zypper in -f systemd
zypper in -f dbus-1-x11



yet I can not install certain apps or mount USB keys, except at root.

Currently, my DM=KDM, WM=mate.session.

From another thread I saw, I ran


# getent passwd polkitd >/dev/null && echo -e "\e1;32mpolkitd user already exists\e0m" || { useradd -r -g polkitd -d / -s /sbin/nologin -c "User for polkitd" polkitd && echo -e "\e1;33mAdded missing polkitd user\e0m" || echo -e "\e1;31mAdding polkitd user FAILED\e0m"; }


polkitd user already exists

followed by


rpm -Va polkit\* && echo -e "\e1;32mpolkit* rpm verification passed\e0m" || { echo -e "\e1;33mResetting polkit* rpm user/group ownership & perms\e0m"; rpm --setugids polkit polkit-pkla-compat; rpm --setperms polkit polkit-pkla-compat; }




S.5....T.  c /etc/dbus-1/system.d/org.freedesktop.PolicyKit1.conf
S.5....T.  c /etc/pam.d/polkit-1
Resetting polkit* rpm user/group ownership & perms

Rebooted, but the issue persists.

Yes,
And the @OP said “semi restored” whatever that might mean.
So,
My recommendation specifically addresses the specific application(s) if that is all that needs to be repaired.
Your suggestion to re-install would probably be the appropriate solution if the problem is more extensive than the specified applications.

In any case,
I see that the latest post by the @OP is that trying these suggestions have not worked so far.

TSU

Pls post your repository list which can be displayed with the following command

zypper ls -d

It’s good that you reoinstalled your polkit authentication agents, but I wonder if the problem is not the agents themselves but authorizing policy kit functionality which is based on ordinary system authentication.

TSU

I have done a reinstall, both an upgrade as well as a full install, the issue has persisted.

The requested outputs:


# zypper ls -d
#  | Alias                     | Name                               | Enabled | GPG Check | Refresh | Priority | Type   | URI
---+---------------------------+------------------------------------+---------+-----------+---------+----------+--------+------------------------------------------------------------------------------------
1  | download.nvidia.com-leap  | nVidia Graphics Drivers            | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.nvidia.com/opensuse/leap/15.2
2  | openSUSE-Leap-15.2-1      | openSUSE-Leap-15.2-1               | No      | ----      | ----    |   99     | rpm-md | hd:/?device=/dev/disk/by-id/usb-SanDisk_Cruzer_Glide_4C530000200806115255-0:0-part2
3  | opensuse-guide.org-repo   | Libdvdcss Repository               | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://opensuse-guide.org/repo/openSUSE_Leap_15.2/
4  | packman.inode.at-suse     | Packman Repository                 | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://packman.inode.at/suse/openSUSE_Leap_15.2/
5  | repo-debug                | Debug Repository                   | No      | ----      | ----    |   99     | rpm-md | http://download.opensuse.org/debug/distribution/leap/15.2/repo/oss/
6  | repo-debug-non-oss        | Debug Repository (Non-OSS)         | No      | ----      | ----    |   99     | rpm-md | http://download.opensuse.org/debug/distribution/leap/15.2/repo/non-oss/
7  | repo-debug-update         | Update Repository (Debug)          | No      | ----      | ----    |   99     | rpm-md | http://download.opensuse.org/debug/update/leap/15.2/oss/
8  | repo-debug-update-non-oss | Update Repository (Debug, Non-OSS) | No      | ----      | ----    |   99     | rpm-md | http://download.opensuse.org/debug/update/leap/15.2/non-oss/
9  | repo-non-oss              | Non-OSS Repository                 | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.2/repo/non-oss/
10 | repo-non-oss_1            | Non-OSS Repository                 | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.2/repo/non-oss/
11 | repo-oss                  | Main Repository                    | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.2/repo/oss/
12 | repo-oss_1                | Main Repository                    | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.2/repo/oss/
13 | repo-source               | Source Repository                  | No      | ----      | ----    |   99     | rpm-md | http://download.opensuse.org/source/distribution/leap/15.2/repo/oss/
14 | repo-source-non-oss       | Source Repository (Non-OSS)        | No      | ----      | ----    |   99     | rpm-md | http://download.opensuse.org/source/distribution/leap/15.2/repo/non-oss/
15 | repo-update               | Main Update Repository             | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.2/oss
16 | repo-update-non-oss       | Update Repository (Non-Oss)        | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.2/non-oss/
17 | repo-update-non-oss_1     | Update Repository (Non-Oss)        | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.2/non-oss/
18 | repo-update_1             | Main Update Repository             | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.2/oss

I think that the *oss_1 and *non-oss_1 were inserted from the last reinstallation. I just now noticed they were there…

Cleaned up


# zypper ls -d
#  | Alias                     | Name                               | Enabled | GPG Check | Refresh | Priority | Type   | URI
---+---------------------------+------------------------------------+---------+-----------+---------+----------+--------+------------------------------------------------------------------------------------
1  | download.nvidia.com-leap  | nVidia Graphics Drivers            | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.nvidia.com/opensuse/leap/15.2
2  | openSUSE-Leap-15.2-1      | openSUSE-Leap-15.2-1               | No      | ----      | ----    |   99     | rpm-md | hd:/?device=/dev/disk/by-id/usb-SanDisk_Cruzer_Glide_4C530000200806115255-0:0-part2
3  | opensuse-guide.org-repo   | Libdvdcss Repository               | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://opensuse-guide.org/repo/openSUSE_Leap_15.2/
4  | packman.inode.at-suse     | Packman Repository                 | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://packman.inode.at/suse/openSUSE_Leap_15.2/
5  | repo-debug                | Debug Repository                   | No      | ----      | ----    |   99     | rpm-md | http://download.opensuse.org/debug/distribution/leap/15.2/repo/oss/
6  | repo-debug-non-oss        | Debug Repository (Non-OSS)         | No      | ----      | ----    |   99     | rpm-md | http://download.opensuse.org/debug/distribution/leap/15.2/repo/non-oss/
7  | repo-debug-update         | Update Repository (Debug)          | No      | ----      | ----    |   99     | rpm-md | http://download.opensuse.org/debug/update/leap/15.2/oss/
8  | repo-debug-update-non-oss | Update Repository (Debug, Non-OSS) | No      | ----      | ----    |   99     | rpm-md | http://download.opensuse.org/debug/update/leap/15.2/non-oss/
9  | repo-non-oss              | Non-OSS Repository                 | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.2/repo/non-oss/
10 | repo-oss                  | Main Repository                    | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.2/repo/oss/
11 | repo-source               | Source Repository                  | No      | ----      | ----    |   99     | rpm-md | http://download.opensuse.org/source/distribution/leap/15.2/repo/oss/
12 | repo-source-non-oss       | Source Repository (Non-OSS)        | No      | ----      | ----    |   99     | rpm-md | http://download.opensuse.org/source/distribution/leap/15.2/repo/non-oss/
13 | repo-update               | Main Update Repository             | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.2/oss
14 | repo-update-non-oss       | Update Repository (Non-Oss)        | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.2/non-oss

With respect to a previous response about focusing on a single affected application, let’s choose pkaction from the polkit package, which seems to be a root level requirement for everything else.

The command fails with any command sequence:


# pkaction --verbose
Error getting authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: Failed to activate service 'org.freedesktop.PolicyKit1': timed out (service_start_timeout=25000ms)


# pkaction |grep login
Error getting authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: Failed to activate service 'org.freedesktop.PolicyKit1': timed out (service_start_timeout=25000ms)

it is from


# zypper if polkit
Loading repository data...
Reading installed packages...




Information for package polkit:
-------------------------------
Repository     : Main Repository
Name           : polkit
Version        : 0.116-lp152.1.4
Arch           : x86_64
Vendor         : openSUSE
Installed Size : 341.0 KiB
Installed      : Yes
Status         : up-to-date
Source package : polkit-0.116-lp152.1.4.src
Summary        : PolicyKit Authorization Framework
Description    : 
    PolicyKit is a toolkit for defining and handling authorizations.
    It is used for allowing unprivileged processes to speak to privileged
    processes.

Message from when this command is run


ct 21 10:56:20 linux-3wjh dbus-daemon[918]: [system] Failed to activate service 'org.freedesktop.PolicyKit1': timed out (service_start_timeout=25000ms)
Oct 21 10:56:20 linux-3wjh rtkit-daemon[2135]: Warning: PolicyKit call failed: Failed to activate service 'org.freedesktop.PolicyKit1': timed out (service_start_timeout=25000ms)
Oct 21 10:56:20 linux-3wjh dbus-daemon[918]: [system] Activating via systemd: service name='org.freedesktop.PolicyKit1' unit='polkit.service' requested by ':1.23' (uid=0 pid=2135 comm="/usr/lib/rtkit/rtkit-daemon ")
Oct 21 10:56:20 linux-3wjh systemd[1]: Starting Authorization Manager...
Oct 21 10:56:20 linux-3wjh polkitd[16879]: Started polkitd version 0.116
Oct 21 10:56:20 linux-3wjh polkitd[16879]: Loading rules from directory /etc/polkit-1/rules.d
Oct 21 10:56:20 linux-3wjh polkitd[16879]: Loading rules from directory /usr/share/polkit-1/rules.d
Oct 21 10:56:20 linux-3wjh polkitd[16879]: Finished loading, compiling and executing 4 rules
Oct 21 10:56:20 linux-3wjh polkitd[16879]: Lost the name org.freedesktop.PolicyKit1 - exiting

from /var/run


drwxrwx---  2 polkituser polkituser   40 Oct 18 17:49 PolicyKit

I checked what should have been running with


~> ps aux | grep polkit
user  24368  0.0  0.0   8688   828 pts/4    S+   13:14   0:00 grep --color=auto polkit

and see that I appear to not have polkitd nor polkit-*-authentication-agent-1 by same user of the session.

I tried to manually start polkitd

# Exec=/usr/lib/polkit-1/polkitd

Still no process and see in messages


Oct 21 13:15:03 linux-3wjh logrotate: ALERT exited abnormally with [1]
Oct 21 13:15:03 linux-3wjh logrotate: logrotate_script: line 1: /etc/init.d/syslog: No such file or directory
Oct 21 13:15:03 linux-3wjh logrotate: error: error running shared postrotate script for '/var/log/warn /var/log/messages /var/log/allmessages /var/log/localmessages /var/log/firewall /var/log/acpid /var/log/NetworkManager '
Oct 21 13:15:03 linux-3wjh rtkit-daemon[2135]: Warning: PolicyKit call failed: 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.
Oct 21 13:15:03 linux-3wjh dbus-daemon[918]: [system] Failed to activate service 'org.freedesktop.PolicyKit1': timed out (service_start_timeout=25000ms)
Oct 21 13:15:03 linux-3wjh dbus-daemon[918]: [system] Activating via systemd: service name='org.freedesktop.PolicyKit1' unit='polkit.service' requested by ':1.23' (uid=0 pid=2135 comm="/usr/lib/rtkit/rtkit-daemon ")
Oct 21 13:15:03 linux-3wjh systemd[1]: Starting Authorization Manager...
Oct 21 13:15:03 linux-3wjh polkitd[24580]: Started polkitd version 0.116
Oct 21 13:15:03 linux-3wjh polkitd[24580]: Loading rules from directory /etc/polkit-1/rules.d
Oct 21 13:15:03 linux-3wjh polkitd[24580]: Loading rules from directory /usr/share/polkit-1/rules.d
Oct 21 13:15:03 linux-3wjh polkitd[24580]: Finished loading, compiling and executing 4 rules
Oct 21 13:15:03 linux-3wjh polkitd[24580]: Lost the name org.freedesktop.PolicyKit1 - exiting
Oct 21 13:15:03 linux-3wjh systemd[1]: Started Authorization Manager.

I am guessing some king of permissions issue somewhere that needs to be corrected?

The polkit process keeps continually restarting, each of the below lines about 20 seconds apart

# ps aux |grep polkit
root     16502  0.0  0.0   8688   864 pts/0    S+   16:10   0:00 grep --color=auto polkit

# ps aux |grep polkit
root     16519  0.0  0.0   8688   816 pts/0    S+   16:10   0:00 grep --color=auto polkit

# ps aux |grep polkit
root     16556  0.0  0.0   8688   916 pts/0    S+   16:11   0:00 grep --color=auto polkit

How can I determine why polkit can not successfully start?

Hi
That’s just you running the ps aux command… polkitd isn’t running…


systemctl status polkit.service 

From the requested command:


# systemctl status polkit.service

● polkit.service - Authorization Manager
   Loaded: loaded (/usr/lib/systemd/system/polkit.service; static; vendor preset: disabled)
   Active: inactive (dead) since Sun 2020-10-25 22:41:07 EDT; 5s ago
     Docs: man:polkit(8)
  Process: 4940 ExecStart=/usr/lib/polkit-1/polkitd (code=exited, status=0/SUCCESS)
 Main PID: 4940 (code=exited, status=0/SUCCESS)


Oct 25 22:41:07 linux polkitd[4940]: 22:41:07.227: Loading rules from directory /usr/share/polkit-1/rules.d
Oct 25 22:41:07 linux polkitd[4940]: Finished loading, compiling and executing 4 rules
Oct 25 22:41:07 linux polkitd[4940]: 22:41:07.228: Finished loading, compiling and executing 4 rules
Oct 25 22:41:07 linux polkitd[4940]: Entering main event loop
Oct 25 22:41:07 linux polkitd[4940]: Connected to the system bus
Oct 25 22:41:07 linux polkitd[4940]: 22:41:07.229: Lost the name org.freedesktop.PolicyKit1 - exiting
Oct 25 22:41:07 linux polkitd[4940]: Shutting down
Oct 25 22:41:07 linux polkitd[4940]: Lost the name org.freedesktop.PolicyKit1 - exiting
Oct 25 22:41:07 linux polkitd[4940]: Exiting with code 0
Oct 25 22:41:07 linux systemd[1]: Started Authorization Manager.

Read an Internet post that the error you’re throwing can be caused if the service name is invoked by a custom rule before the main rules are read and loaded.
Did you do anything noteworthy around the time your error started appearing?
Some tries…

  1. inspect the rules in the two locations described… Inspect timestamps and any reference to org.freedesktop.PolicyKit1
/etc/polkit-1/rules.d
/usr/share/polkit-1/rules.d
  1. If you’re installed on BTRFS, try rolling back to a day/time prior to when you noticed your error.

TSU