Bug 16577 - polkit-kde-agent doesn't start at login
Summary: polkit-kde-agent doesn't start at login
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 5
Hardware: x86_64 Linux
Priority: Normal major
Target Milestone: ---
Assignee: Luc Menut
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-12 15:22 CEST by papoteur
Modified: 2015-11-02 20:51 CET (History)
3 users (show)

See Also:
Source RPM: polkit-kde-agent-1-0.99.1-2.mga5
CVE:
Status comment:


Attachments

Description papoteur 2015-08-12 15:22:23 CEST
Description of problem:
Click on MCC icon has no effect.
After checking what polkit is running, I see that polkit agent isn't running.
This is not the case at each boot. Yesterday, it was OK, but not the boot before and today.


Version-Release number of selected component (if applicable):
# rpm -qa|grep polkit
lib64polkit-qt-gui-1_1-0.112.0-6.mga5
polkit-0.113-1.mga5
lib64polkit-qt-agent-1_1-0.112.0-6.mga5
lib64polkit-qt-core-1_1-0.112.0-6.mga5
lib64polkit-gir1.0-0.113-1.mga5
polkit-kde-agent-1-0.99.1-2.mga5
polkit-kde-kcmodules-1-0.98.1-6.mga5
lib64polkit1_0-0.113-1.mga5

Using KDE
Mageia 5 installed by upgrading.

# /usr/lib64/kde4/libexec/polkit-kde-authentication-agent-1
unnamed app(6811): KUniqueApplication: Cannot find the D-Bus session server:  "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." 

unnamed app(6810): KUniqueApplication: Pipe closed unexpectedly. 

Some others users reported the same problem:
http://www.mageialinux-online.org/forum/topic-20750+mot-de-passe-root-non-reconnu-avec-interface-graphique.php
http://www.mageialinux-online.org/forum/topic-20717+mcc-et-type-de-clavier-non-fonctionnel.php
http://www.mageialinux-online.org/forum/topic-20681+ccm-et-option-installation-logiciel-du-menu-ne-fonctionnent-plus.php



Reproducible: 

Steps to Reproduce:
David Walser 2015-08-12 15:25:37 CEST

CC: (none) => mageia
Assignee: bugsquad => lmenut

Comment 1 Luc Menut 2015-08-28 09:23:43 CEST
(In reply to papoteur from comment #0)
> Description of problem:
> Click on MCC icon has no effect.
> After checking what polkit is running, I see that polkit agent isn't running.
> This is not the case at each boot. Yesterday, it was OK, but not the boot
> before and today.
> 
...
> 
> # /usr/lib64/kde4/libexec/polkit-kde-authentication-agent-1
> unnamed app(6811): KUniqueApplication: Cannot find the D-Bus session server:
> "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." 
> 
> unnamed app(6810): KUniqueApplication: Pipe closed unexpectedly. 
> 

I can reproduce bug 16396, but not this one.
Are you sure polkit-kde-authentication-agent-1 was not running ?
The error message could indicate that it's running, but has some issue.

Considering that we have several reports of issues with authentication since the update to polkit 0.113 in various DE, we probably have a more general issue somewhere in the polkit stack. Not sure polkit-kde-authentication-agent-1 is the culprit.

When authentication fails, could you give the output of
  cat /run/systemd/users/$(id -u)
Comment 2 Florian Hubold 2015-10-04 17:15:10 CEST
Please at least provide the output of all 3 of the following commands, you seem to have an issue with dbus, that's why the agent doesn't run.

cat /run/systemd/users/$(id -u)
ps -ef|grep -v grep|grep -iE "polkit|dbus"
systemctl status polkit.service -a

Your issue seems completely different. And currently we only have 2 actual bigger polkit issues. Bug 16319 which basically is a packaging bug or a systemd flaw in that it doesn't restart polkit after an update. And bug 16396 which is related to a recent polkit/systemd change, and basically we were missing a patch. Thanks to Luc for finding that one :)

CC: (none) => doktor5000

Comment 3 papoteur 2015-10-05 08:43:05 CEST
Hello Florian,
I do not have the problem yet. But I give you the results of the commands you cite:
# ps -ef|grep -v grep|grep -iE "polkit|dbus"
message+   991     1  0 oct.01 ?       00:00:12 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
polkitd   1120     1  0 oct.01 ?       00:00:01 /usr/lib/polkit-1/polkitd --no-debug
yves      1822     1  0 oct.01 ?       00:00:00 /usr/bin/dbus-launch --exit-with-session --sh-syntax
yves      1837     1  0 oct.01 ?       00:00:04 /usr/bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session
yves      3303     1  0 oct.01 ?       00:00:01 /usr/lib64/kde4/libexec/polkit-kde-authentication-agent-1
yves      3436  3427  0 oct.01 ?       00:00:01 /usr/bin/dbus-daemon --config-file=/etc/at-spi2/accessibility.conf --nofork --print-address 3
[root@Netbook-M4 /]# systemctl status polkit.service -a
â polkit.service - Authorization Manager
   Loaded: loaded (/usr/lib/systemd/system/polkit.service; static)
   Active: active (running) since jeu. 2015-10-01 08:41:06 CEST; 3 days ago
     Docs: man:polkit(8)
 Main PID: 1120 (polkitd)
   CGroup: /system.slice/polkit.service
           ââ1120 /usr/lib/polkit-1/polkitd --no-debug

oct. 01 08:41:05 Netbook-M4 polkitd[1120]: Started polkitd version 0.113
oct. 01 08:41:06 Netbook-M4 polkitd[1120]: Loading rules from directory /etc/polkit-1/rules.d
oct. 01 08:41:06 Netbook-M4 polkitd[1120]: Loading rules from directory /usr/share/polkit-1/rules.d
oct. 01 08:41:06 Netbook-M4 polkitd[1120]: Finished loading, compiling and executing 3 rules
oct. 01 08:41:06 Netbook-M4 polkitd[1120]: Acquired the name org.freedesktop.PolicyKit1 on the system bus
oct. 01 08:42:01 Netbook-M4 polkitd[1120]: Registered Authentication Agent for unix-session:c1 (system bus name :1.55 [/usr/lib64/kde4/libexec/polkit-kde-authentication-agent-1], object path /org/kde/PolicyKit1/AuthenticationAgent, locale fr_FR.UTF-8)
oct. 02 09:28:51 Netbook-M4 polkitd[1120]: Operator of unix-session:c1 successfully authenticated as unix-user:root to gain TEMPORARY authorization for action org.mageia.drakconf.pkexec.run for unix-process:633:8929826 [/usr/bin/perl /usr/bin/drakconf] (owned by unix-user:yves)
oct. 04 17:06:40 Netbook-M4 polkitd[1120]: Operator of unix-session:c1 successfully authenticated as unix-user:root to gain TEMPORARY authorization for action org.mageia.isodumper.pkexec.run for unix-process:24933:28956809 [/bin/sh /usr/bin/isodumper] (owned by unix-user:yves)

I remember to have a try to downgrade the version of polkit to 0.112, but it is yet 0.113.
Comment 4 Florian Hubold 2015-10-05 13:08:16 CEST
Well, I don't see the problem you initially reported. /usr/lib64/kde4/libexec/polkit-kde-authentication-agent-1 is running, and you have already used it successfully to run MCC and isodumper.

Ever confirmed: 1 => 0
Status: NEW => UNCONFIRMED

Comment 5 Rémi Verschelde 2015-10-05 13:13:56 CEST
(In reply to papoteur from comment #0)
> # /usr/lib64/kde4/libexec/polkit-kde-authentication-agent-1
> unnamed app(6811): KUniqueApplication: Cannot find the D-Bus session server:
> "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." 
> 
> unnamed app(6810): KUniqueApplication: Pipe closed unexpectedly. 

Judging by the # and the error message, I believe you tried to run the authentication agent as root, and I guess it's not meant to be. You get the same kind of "missing D-Bus session server" if you try e.g. to run dolphin as root ("su", might work with "su -").
Comment 6 papoteur 2015-10-05 13:29:20 CEST
(In reply to Rémi Verschelde from comment #5)
> (In reply to papoteur from comment #0)
> > # /usr/lib64/kde4/libexec/polkit-kde-authentication-agent-1
> > unnamed app(6811): KUniqueApplication: Cannot find the D-Bus session server:
> > "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." 
> > 
> > unnamed app(6810): KUniqueApplication: Pipe closed unexpectedly. 
> 
> Judging by the # and the error message, I believe you tried to run the
> authentication agent as root, and I guess it's not meant to be. You get the
> same kind of "missing D-Bus session server" if you try e.g. to run dolphin
> as root ("su", might work with "su -").

I think you're right.
Thus, we can close.
Comment 7 Rémi Verschelde 2015-10-05 18:28:39 CEST
Closing as INVALID then, though you did experience a polkit-related issue in comment 0 so it's maybe more a duplicate of another current polkit bug. Don't know which one though, hence the INVALID.

Resolution: (none) => INVALID
Status: UNCONFIRMED => RESOLVED

Comment 8 papoteur 2015-10-15 13:54:51 CEST
I encounter again the problem.

cat /run/systemd/users/$(id -u)
# This is private data. Do not parse.
NAME=yves
STATE=active
RUNTIME=/run/user/500
SERVICE=user@500.service
SLICE=user-500.slice
DISPLAY=c1
REALTIME=1444630237970491
MONOTONIC=43901608
SESSIONS=c1
SEATS=seat0
ACTIVE_SESSIONS=c1
ONLINE_SESSIONS=c1
ACTIVE_SEATS=seat0
ONLINE_SEATS=seat0
[yves@Netbook-M4 ~]$ mcc
==== AUTHENTICATING FOR org.mageia.drakconf.pkexec.run ===
Authentication is required to run Mageia Control Center GUI
Authenticating as: root
Password: 
polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie
==== AUTHENTICATION FAILED ===
Error executing command as another user: Not authorized

This incident has been reported.

ps -ef|grep -v grep|grep -iE "polkit|dbus"
message+   985     1  0 oct.12 ?       00:00:07 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
polkitd   1068     1  0 oct.12 ?       00:00:00 /usr/lib/polkit-1/polkitd --no-debug
yves      1808     1  0 oct.12 ?       00:00:00 /usr/bin/dbus-launch --exit-with-session --sh-syntax
yves      1812     1  0 oct.12 ?       00:00:03 /usr/bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session
yves      3082  3077  0 oct.12 ?       00:00:00 /usr/bin/dbus-daemon --config-file=/etc/at-spi2/accessibility.conf --nofork --print-address 3
[yves@Netbook-M4 ~]$ systemctl status polkit.service -a
â polkit.service - Authorization Manager
   Loaded: loaded (/usr/lib/systemd/system/polkit.service; static)
   Active: active (running) since lun. 2015-10-12 08:10:34 CEST; 3 days ago
     Docs: man:polkit(8)
 Main PID: 1068 (polkitd)
   CGroup: /system.slice/polkit.service
           ââ1068 /usr/lib/polkit-1/polkitd --no-debug
[yves@Netbook-M4 ~]$ /usr/lib64/kde4/libexec/polkit-kde-authentication-agent-1
New PolkitAgentListener  0x175bc20 
Adding new listener  PolkitQt1::Agent::Listener(0x18c8ce0) for  0x175bc20 

My system is not uptodate, in particular, I haven't latest polkit and systemd updates.

Ever confirmed: 0 => 1
Status: RESOLVED => REOPENED
Resolution: INVALID => (none)

Comment 9 Florian Hubold 2015-10-15 21:51:50 CEST
(In reply to papoteur from comment #8)

> My system is not uptodate, in particular, I haven't latest polkit and
> systemd updates.

Please install those and then reboot please.

Apart from this, this time /usr/lib64/kde4/libexec/polkit-kde-authentication-agent-1 seemed to start just fine, no errors.
Comment 10 papoteur 2015-10-16 12:29:48 CEST
After installing the updates and a reboot, the MCC starts form the launcher. 
I wait for next reboots.
Papoteur
Comment 11 papoteur 2015-10-20 17:41:29 CEST
Hello,
System uptodate. Again the problem at this reboot.
ps -ef|grep -v grep|grep -iE "polkit|dbus"
message+  1461     1  0 11:27 ?        00:00:01 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
polkitd   1561     1  0 11:27 ?        00:00:00 /usr/lib/polkit-1/polkitd --no-debug
yves      2175     1  0 11:27 ?        00:00:00 /usr/bin/dbus-launch --exit-with-session --sh-syntax
yves      2211     1  0 11:27 ?        00:00:00 /usr/bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session
yves      5768  5757  0 11:28 ?        00:00:00 /usr/bin/dbus-daemon --config-file=/etc/at-spi2/accessibility.conf --nofork --print-address 3

$ cat /run/systemd/users/$(id -u)
# This is private data. Do not parse.
NAME=yves
STATE=active
RUNTIME=/run/user/500
SERVICE=user@500.service
SLICE=user-500.slice
DISPLAY=c1
REALTIME=1445333250040427
MONOTONIC=243046726
SESSIONS=c1
SEATS=seat0
ACTIVE_SESSIONS=c1
ONLINE_SESSIONS=c1
ACTIVE_SEATS=seat0
ONLINE_SEATS=seat0

$ mcc
==== AUTHENTICATING FOR org.mageia.drakconf.pkexec.run ===
Authentication is required to run Mageia Control Center GUI
Authenticating as: root
Password: 
polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie
==== AUTHENTICATION FAILED ===
Error executing command as another user: Not authorized

This incident has been reported.
$ /usr/lib64/kde4/libexec/polkit-kde-authentication-agent-1
New PolkitAgentListener  0x1a9fc20 
Adding new listener  PolkitQt1::Agent::Listener(0x1bccaa0) for  0x1a9fc20
papoteur 2015-10-20 17:42:03 CEST

Summary: polkit-kde-agent doesn't start => polkit-kde-agent doesn't start at boot

Comment 12 papoteur 2015-10-20 17:50:21 CEST
And:
# journalctl -ab | grep -iE "polkit|policykit"
oct. 20 11:27:25 Netbook-M4 dbus[1461]: [system] Activating via systemd: service name='org.freedesktop.PolicyKit1' unit='polkit.service'
oct. 20 11:27:26 Netbook-M4 polkitd[1561]: Started polkitd version 0.113
oct. 20 11:27:27 Netbook-M4 polkitd[1561]: Loading rules from directory /etc/polkit-1/rules.d
oct. 20 11:27:27 Netbook-M4 polkitd[1561]: Loading rules from directory /usr/share/polkit-1/rules.d
oct. 20 11:27:27 Netbook-M4 polkitd[1561]: Finished loading, compiling and executing 3 rules
oct. 20 11:27:27 Netbook-M4 dbus[1461]: [system] Successfully activated service 'org.freedesktop.PolicyKit1'
oct. 20 11:27:27 Netbook-M4 polkitd[1561]: Acquired the name org.freedesktop.PolicyKit1 on the system bus
oct. 20 17:39:20 Netbook-M4 polkitd[1561]: Registered Authentication Agent for unix-process:10664:2255362 (system bus name :1.71 [/usr/bin/pkexec /usr/libexec/drakconf], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) 
oct. 20 17:39:30 Netbook-M4 polkit-agent-helper-1[10670]: pam_tcb(polkit-1:auth): Authentication passed for root from (uid=500)
oct. 20 17:39:30 Netbook-M4 polkitd[1561]: Operator of unix-process:10664:2255362 FAILED to authenticate to gain authorization for action org.mageia.drakconf.pkexec.run for unix-process:10664:2255362 [/usr/bin/perl /usr/bin/mcc] (owned by unix-user:yves)
oct. 20 17:39:30 Netbook-M4 polkitd[1561]: Unregistered Authentication Agent for unix-process:10664:2255362 (system bus name :1.71, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
oct. 20 17:40:41 Netbook-M4 polkitd[1561]: Registered Authentication Agent for unix-session:c1 (system bus name :1.73 [/usr/lib64/kde4/libexec/polkit-kde-authentication-agent-1], object path /org/kde/PolicyKit1/AuthenticationAgent, locale fr_FR.UTF-8)
[root@Netbook-M4 yves]# journalctl -ab /usr/lib64/kde4/libexec/polkit-kde-authentication-agent-1
-- Logs begin at sam. 2015-01-31 13:43:59 CET, end at mar. 2015-10-20 17:45:36 CEST. --
Comment 13 papoteur 2015-10-20 17:55:47 CEST
An d in .xsession-errors
Error creating textual authentication agent: Error opening current controlling terminal for the process (`/dev/tty'): No such device or address
Error creating textual authentication agent: Error opening current controlling terminal for the process (`/dev/tty'): No such device or address
Comment 14 Florian Hubold 2015-10-20 21:41:29 CEST
Seems pretty similar to bug 16961 as it only affects polkit-kde-authentication-agent-1 and only happens intermittently. To be honest, I've no clue how to debug this further without access to the system.

I'd simply uninstall it via

rpm -e --nodeps polkit-kde-agent-1

and then install any other polkit agent via

urpmi polkit-agent

The following packages provide a polkit agent:

[~] urpmq --whatprovides polkit-agent
lxqt-policykit|lxqt-policykit|polkit-agent-none|polkit-kde-agent-1|mate-polkit|lxqt-policykit|cinnamon|gnome-shell|gnome-shell

See Also: (none) => https://bugs.mageia.org/show_bug.cgi?id=16961

Comment 15 papoteur 2015-10-21 08:31:50 CEST
Hello,
I just checked the content of /etc/xdg/autostart/ and ~/.kde4/autostart/
There is no polkit agent.
Is that relevant ?
The .spec file of polkit-kde-agent-1 include a line:
%{_kde_autostart}/polkit-kde-authentication-agent-1.desktop

Thus, where is this file now?
Comment 16 Dave Hodgins 2015-10-21 21:12:53 CEST
(In reply to papoteur from comment #15)
> Hello,
> I just checked the content of /etc/xdg/autostart/ and ~/.kde4/autostart/
> There is no polkit agent.
> Is that relevant ?
> The .spec file of polkit-kde-agent-1 include a line:
> %{_kde_autostart}/polkit-kde-authentication-agent-1.desktop
> 
> Thus, where is this file now?

/usr/share/autostart/polkit-kde-authentication-agent-1.desktop

CC: (none) => davidwhodgins

Comment 17 papoteur 2015-10-21 22:37:03 CEST
(In reply to Dave Hodgins from comment #16)
> > Thus, where is this file now?
> 
> /usr/share/autostart/polkit-kde-authentication-agent-1.desktop
Ok found it.
The problem is why it doesn't start.  Where to look for ?
Some logs?
Activate debug or log option?
Comment 18 Florian Hubold 2015-10-22 15:48:05 CEST
(In reply to papoteur from comment #15)
> The .spec file of polkit-kde-agent-1 include a line:
> %{_kde_autostart}/polkit-kde-authentication-agent-1.desktop
> 
> Thus, where is this file now?

FWIW, you can expand rpm macros via rpm --eval or rpm -E, so rpm -E "%{_kde_autostart}/polkit-kde-authentication-agent-1.desktop" would have shown you  ;)


And for debugging, that is why I've asked Luc in bug 16961 about this. You should run kdebugdialog and enable all debug messages there, but I'm not sure that helps for this issue. You could try to put a shell script in the Exec=line of /usr/share/autostart/polkit-kde-authentication-agent-1.desktop and the shell script could do something like the following:

#!/bin/bash

echo >> ~/.xsession-errors
echo "====polkit-kde-authentication-agent-1 starting at $(date)====" >> ~/.xsession-errors

/usr/lib64/kde4/libexec/polkit-kde-authentication-agent-1 2>&1 | tee -a ~/.xsession-errors
echo "====polkit-kde-authentication-agent-1 should be running at $(date)====" >> ~/.xsession-errors
echo >> ~/.xsession-errors


Don't forget to make it executable.
And then check your ~/.xsession-errors for the string "====polkit-kde-authentication-agent-1 starting at" until "====polkit-kde-authentication-agent-1 should be running at" and post it here.

If that doesn't work, we might have to add a debug build, like explained in https://bugs.kde.org/show_bug.cgi?id=258916
David Walser 2015-10-22 21:54:43 CEST

Summary: polkit-kde-agent doesn't start at boot => polkit-kde-agent doesn't start at login

Comment 19 papoteur 2015-10-23 22:48:01 CEST
Hello Florian,
Thus I have written the script and modified the .desktop file.
When the agent doesn't start, I have no trace in .xsessions-errors.
When it starts, there is a trace, but not from the script of .desktop
Thus, what I think is that the .desktop is not executed, but polkit can be launched from another way.
Comment 20 Florian Hubold 2015-10-24 20:27:27 CEST
Well, then rename /usr/lib64/kde4/libexec/polkit-kde-authentication-agent-1 to something different and put the script in place for it, and have it call the new name for /usr/lib64/kde4/libexec/polkit-kde-authentication-agent-1

And please also post the trace you mentioned.
Comment 21 papoteur 2015-11-02 20:51:18 CET
I done a "dracut -f" and since, I have no more problem of polkit agent not starting.
Thus I close the bug.

Status: REOPENED => RESOLVED
Resolution: (none) => FIXED


Note You need to log in before you can comment on or make changes to this bug.