Bug 439473

Summary: PolicyKit aborts if AuthenticationAgent is missing
Product: [openSUSE] openSUSE 11.1 Reporter: Christian Boltz <suse-beta>
Component: libzyppAssignee: Ludwig Nussel <lnussel>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Critical    
Priority: P2 - High CC: dmacvicar, tgoettlicher
Version: Beta 3   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: console output

Description Christian Boltz 2008-10-28 12:14:16 UTC
kupdateapplet crashed on startup today.

Some details that might be important:
- Factory as of beta3
- I use KDE 3
- for whatever reason (still searching for it...), kupdateapplet can't connect 
  to packagekit - but until today this resulted in an error message in the 
  tooltip, not a crash

Backtrace:

Anwendung: Updater Applet (kupdateapplet), Signal SIGABRT
 [?1034h(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
... 53 lines saying "(no debugging symbols found)" ...
[KCrash handler]
#5  0xffffe430 in __kernel_vsyscall ()
#6  0xb662b9b0 in raise () from /lib/libc.so.6
#7  0xb662d2e8 in abort () from /lib/libc.so.6
#8  0xb63eb205 in ?? () from /lib/libdbus-1.so.3
#9  0xb63e6c19 in ?? () from /lib/libdbus-1.so.3
#10 0xb63d07c4 in dbus_set_error () from /lib/libdbus-1.so.3
#11 0xb49cd6dd in ?? () from /usr/lib/libpolkit-dbus.so.2
#12 0xb49cd95b in polkit_auth_obtain () from /usr/lib/libpolkit-dbus.so.2
#13 0xb4a383cc in ?? () from /usr/lib/kde4/kupdateapplet_packagekit.so
#14 0xb4a2c96c in ?? () from /usr/lib/kde4/kupdateapplet_packagekit.so
#15 0xb4a260c2 in ?? () from /usr/lib/kde4/kupdateapplet_packagekit.so
#16 0xb4a296dc in ?? () from /usr/lib/kde4/kupdateapplet_packagekit.so
#17 0xb7e4f480 in QMetaObject::activate(QObject*, int, int, void**) ()
   from /usr/lib/libQtCore.so.4
#18 0xb7e50202 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#19 0x08056801 in _start ()
Comment 1 Thomas Göttlicher 2008-10-28 16:19:58 UTC
Could you please tell me the package versions of:
- PolicyKit
- dbus
- glibc
- libqt4
- kde4-kupdateapplet
Comment 2 Christian Boltz 2008-10-28 17:30:56 UTC
# rpm -q PolicyKit dbus-1 glibc libqt4 kde4-kupdateapplet
PolicyKit-0.9-12.6
dbus-1-1.2.4-2
glibc-2.8.90-14.2
libqt4-4.4.3-2.3
kde4-kupdateapplet-0.8.10-2.7
Comment 3 Christian Boltz 2008-10-29 18:00:34 UTC
Interestingly, kupdateapplet crashes at every startup since I opened this bug.

I _think_ I know the reason: In bug 435776, Ludwig recommendet to run set_polkit_default_privs once. I did this, and since then kupdateapplet crashes.
Comment 4 Thomas Göttlicher 2008-10-30 15:39:10 UTC
I improved the policykit-get-auth mechanism in kupdateapplet.

Could you please try the latest version of kupdateapplet:
https://build.opensuse.org/package/show?package=kde4-kupdateapplet&project=home%3Atgoettlicher

Note: kde4-kupdateapplet-zypp depends on a zypper version that might not be available yet. But that's not a problem because only kde4-kupdateapplet and kde4-kupdateapplet-packagekit are needed for testing. 
Comment 5 Christian Boltz 2008-10-31 09:43:34 UTC
Created attachment 249067 [details]
console output

The packages from home:tgoettcher (I updated kde4-updateapplet and kde4-updateapplet-packagekit) don't crash :-)

But I still get a permission denied message:
    User is not permitted: org.freedesktop.packagekit.system-sources-refresh
The full console output is attached, maybe you find the reason for the problem.

Note: I use permissions.secure - and have more permission problems, like failing automounting of usb storage devices.
Comment 6 Thomas Göttlicher 2008-10-31 11:42:05 UTC
(In reply to comment #5 from Christian Boltz)
> The packages from home:tgoettcher (I updated kde4-updateapplet and
> kde4-updateapplet-packagekit) don't crash :-)
Great! Thanks for testing.


> But I still get a permission denied message:
>     User is not permitted: org.freedesktop.packagekit.system-sources-refresh
If PolicyKit-kde 0.2 is installed a popup should ask for permission. As far as I know this version isn't available as package yet.

The package 'PolicyKit-gnome' contains 'polkit-gnome-authorization' that can be used to modify the permissions in the meantime. 

I close this bug because the crash is fixed.
Note: Bug 389415 is more related.
Comment 7 Christian Boltz 2008-11-01 13:35:36 UTC
(In reply to comment #6 from Thomas Goettlicher)
> (In reply to comment #5 from Christian Boltz)
> > The packages from home:tgoettcher (I updated kde4-updateapplet and
> > kde4-updateapplet-packagekit) don't crash :-)
> Great! Thanks for testing.

Unfortunately things are more "interesting" ;-)

If I start the applet in konsole, it doesn't crash. This was also what I tested when reporting that it does no longer crash.

But: When the applet is auto-started after boot/login, it crashes again.
Hmmm, could there be a race condition (like a required service not yet running at login time)? Another option might be the "don't check updates when system load is high" - around login, I typically have a load of 5.

The backtrace looks different now:

Anwendung: Updater Applet (kupdateapplet), Signal SIGABRT
 [?1034h(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
... 53x (no debugging symbols found) ...
[KCrash handler]
#5  0xffffe430 in __kernel_vsyscall ()
#6  0xb65ac9b0 in raise () from /lib/libc.so.6
#7  0xb65ae2e8 in abort () from /lib/libc.so.6
#8  0xb636c205 in ?? () from /lib/libdbus-1.so.3
#9  0xb6367c19 in ?? () from /lib/libdbus-1.so.3
#10 0xb63517c4 in dbus_set_error () from /lib/libdbus-1.so.3
#11 0xb494a6dd in ?? () from /usr/lib/libpolkit-dbus.so.2
#12 0xb494a95b in polkit_auth_obtain () from /usr/lib/libpolkit-dbus.so.2
#13 0xb49b554a in PackageKit::PolkitClient::getAuth(QString const&) ()
   from /usr/lib/kde4/kupdateapplet_packagekit.so
#14 0xb49a973b in QPackageKitConnector::refreshCache(bool) ()
   from /usr/lib/kde4/kupdateapplet_packagekit.so
#15 0xb49a3012 in PackageKitUpdater::doCheckForUpdates() ()
   from /usr/lib/kde4/kupdateapplet_packagekit.so
#16 0xb49a662c in PackageKitUpdater::qt_metacall(QMetaObject::Call, int, void**) () from /usr/lib/kde4/kupdateapplet_packagekit.so
#17 0xb7dd0480 in QMetaObject::activate(QObject*, int, int, void**) ()
   from /usr/lib/libQtCore.so.4
#18 0xb7dd1202 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#19 0x08056591 in Logics::checkUpdates(QTreeWidget*, QTreeWidget*, QTreeWidget*) ()
#20 0x08057ddd in Logics::slotAutoCheckForUpdates() ()
#21 0x0805b805 in Logics::qt_metacall(QMetaObject::Call, int, void**) ()
#22 0xb7dd0480 in QMetaObject::activate(QObject*, int, int, void**) ()
   from /usr/lib/libQtCore.so.4
#23 0xb7dd1202 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#24 0xb7dd6847 in ?? () from /usr/lib/libQtCore.so.4
#25 0xb7dd696c in ?? () from /usr/lib/libQtCore.so.4
#26 0xb7dcaf4f in QObject::event(QEvent*) () from /usr/lib/libQtCore.so.4
#27 0xb712e8fc in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /usr/lib/libQtGui.so.4
#28 0xb713675e in QApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/libQtGui.so.4
#29 0xb6e2c07d in KApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/libkdeui.so.5
#30 0xb7dbb861 in QCoreApplication::notifyInternal(QObject*, QEvent*) ()
   from /usr/lib/libQtCore.so.4
#31 0xb7de9a86 in ?? () from /usr/lib/libQtCore.so.4
#32 0xb7de5f60 in ?? () from /usr/lib/libQtCore.so.4
#33 0xb64139c8 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#34 0xb6417083 in ?? () from /usr/lib/libglib-2.0.so.0
#35 0xb6417241 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#36 0xb7de5eb8 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#37 0xb71c7795 in ?? () from /usr/lib/libQtGui.so.4
#38 0xb7db9f1a in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#39 0xb7dba0da in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/libQtCore.so.4
#40 0xb7dbc795 in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#41 0xb712e777 in QApplication::exec() () from /usr/lib/libQtGui.so.4
#42 0x0804e5a6 in main ()
Comment 8 Thomas Göttlicher 2008-11-03 09:44:21 UTC
The function that causes the crash looks like this:

bool PolkitClient::getAuth(const QString &action) {
 DBusError e;
 dbus_error_init(&e);

 if(polkit_check_auth(QCoreApplication::applicationPid(), action.toAscii().data(), NULL))
  return true;

 bool auth = polkit_auth_obtain(action.toAscii().data(), 0, QCoreApplication::applicationPid(), &e);
 if(!auth)
 {
  qDebug() << "Authentification error :" << e.name << ":" << e.message;
 }
 return auth;
}
Comment 9 Thomas Göttlicher 2008-11-03 09:46:33 UTC
Ludwig, do you have an idea what's wrong with the polkit_auth_obtain() call within this function?
Comment 10 Ludwig Nussel 2008-11-04 08:19:50 UTC
Your code looks good AFAICT. It's a bug in PolicyKit and I suspect this is the culprit:

	if (reply == NULL || dbus_error_is_set (error)) {
                ret = _auth_show_dialog_text (action_id, pid, error);

_auth_show_dialog_text uses dbus_error_set itself and if the error already is set abort() gets called.
Comment 11 Ludwig Nussel 2008-11-04 08:29:37 UTC
please try home:lnussel:Factory/PolicyKit when it's done building
Comment 12 Thomas Göttlicher 2008-11-04 09:00:58 UTC
Christian, does the package from home:lnussel:Factory/PolicyKit fix the problem?
Comment 13 Christian Boltz 2008-11-04 19:55:42 UTC
(In reply to comment #12 from Thomas Goettlicher)
> Christian, does the package from home:lnussel:Factory/PolicyKit fix the
> problem?

At least kupdateapplet doesn't crash anymore (I really tested by rebooting this time ;-)

The remaining part: kupdateapplet more or less hangs displaying "checking for updates" with the progressbar at "100%, finished" while it should probably display a "permission denied" message. Console output:

# kupdateapplet, manually clicked "check for updates"
Attempting to obtain authorization for org.freedesktop.packagekit.refresh-cache.
polkit-grant-helper: given auth type (1 -> no) is bogus
Failed to obtain authorization for org.freedesktop.packagekit.refresh-cache.
Authentification error :  :
Attempting to obtain authorization for org.freedesktop.packagekit.refresh-cache.
polkit-grant-helper: given auth type (1 -> no) is bogus
Failed to obtain authorization for org.freedesktop.packagekit.refresh-cache.
Authentification error :  :

Things that make me wonder in the messages above:
- the "given auth type (...) is bogus" message
- the empty "Authentification error" line

(and I still don't like the fact that permissions.secure doesn't allow the user to check for updates - but that's a very old discussion...)
Comment 14 Ludwig Nussel 2008-11-05 15:24:40 UTC
ok, so the PolicyKit related crash is fixed. I've opened a new bug for the permission denied issue.