software-properties-gtk crashed with DBusException in call_blocking(): com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy: com.ubuntu.softwareproperties.applychanges

Bug #828850 reported by Zijyfe Duufop
This bug affects 250 people
Affects Status Importance Assigned to Milestone
Software Properties
New
Undecided
Unassigned
software-properties (Ubuntu)
Fix Released
Medium
Iosu Sacristan Etxabe
Precise
Fix Released
High
Iosu Sacristan Etxabe

Bug Description

[Test Case]
1. install the version from -proposed
2. launch software-properties
3. do any action that requires an authentification and cancel it
-> you should see a warning showing on the command line (if you launched it)
-> whoopsie shouldn't trigger that a crash happened.

[Regression Potential]
None, as it's just wrapping the crash in a try/except clause.

This is reproducible by launching software-properties-gtk as any user that is not an admin, or from any session where the user can't be verified to be an admin via policykit - including when the user hits 'cancel' in the authentication dialog. We should suppress these exceptions so they don't show up as crashes on the desktop.

ProblemType: Crash
DistroRelease: Ubuntu 11.10
Package: software-properties-gtk 0.81.8
ProcVersionSignature: Ubuntu 3.0.0-8.11-generic 3.0.1
Uname: Linux 3.0.0-8-generic x86_64
Architecture: amd64
Date: Thu Aug 11 14:27:10 2011
ExecutablePath: /usr/bin/software-properties-gtk
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Alpha amd64 (20110705)
InterpreterPath: /usr/bin/python2.7
PackageArchitecture: all
ProcCmdline: /usr/bin/python /usr/bin/software-properties-gtk -n -t 132120584
ProcCwd: /home/yehuda/Documents
ProcEnviron:
 LANGUAGE=en_CA:en
 PATH=(custom, no user)
 LANG=en_CA.UTF-8
 SHELL=/bin/bash
PythonArgs: ['/usr/bin/software-properties-gtk', '-n', '-t', '132120584']
SourcePackage: software-properties
Title: software-properties-gtk crashed with DBusException in call_blocking(): com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy: com.ubuntu.softwareproperties.applychanges
UpgradeStatus: Upgraded to oneiric on 2011-07-27 (21 days ago)
UserGroups: adm admin cdrom dialout lpadmin plugdev sambashare

Revision history for this message
Zijyfe Duufop (zijifayd) wrote :
tags: removed: need-duplicate-check
Changed in software-properties (Ubuntu):
status: New → Confirmed
tags: added: bugpattern-needed
visibility: private → public
Changed in software-properties (Ubuntu):
importance: Undecided → Medium
status: Confirmed → Triaged
tags: removed: bugpattern-needed
tags: added: bugpattern-written
Revision history for this message
Scarred Intellect (scarredintellect) wrote :

I was able to work around this by using <TAB> to select a source and <SPACEBAR> to activate the check box. Now I can check/uncheck at will and have no errors.

I noticed yesterday when I encountered the bug it didn't prompt me for password when I made a selection, but today it does (whether I check or uncheck the box) every time I open that dialog.

Hope this information helps. If I figure out more details I'll post them as well.

Revision history for this message
Paul Drain (pd) wrote :

Can also work around it with <TAB> -- always seems to occur after a failed repository warning has appeared on screen, the process to make it crash (for me) is:

* Run Update Manager
* Update Manager warns that "Failed to download repository information / Check your Internet connection." (in my case, from a non-oneiric PPA repository)
* Click Settings / Other Software
* Attempt To Unselect Failed Repository = Crash

This is on a Beta 2 Oneiric Install updated to 26-09-2011

Revision history for this message
Jared (jared-vanvolkenburg) wrote :

I opened the software source. I did not want to change anything. It prompted me to authenticate and I canceled and it crashed. everything was up to date as of Oct 2nd, 2011

Revision history for this message
Henning Knut Skoglund (hkskoglund) wrote :

Previously registered http://download.virtualbox.org/virtualbox/debian natty contrib, changed it to non existent location http://download.virtualbox.org/virtualbox/debian oneric contrib-> crash.

Revision history for this message
frmdstryr (frmdstryr) wrote :

Occured when I cancelled entering the password for changing the apt.

Revision history for this message
stanley.kardach (kardasan) wrote :

I am also experiencing this issue when I open up software-properties-gtk via applications menu. Additionally it crashes when I try to change the download server. I am not asked for password at any time.
This issue doesn't happen if you run the software-properties-gtk via terminal as root.

Revision history for this message
DarkRedman (darkredman-deactivatedaccount) wrote :

It occurs for me when I check or uncheck sources

Revision history for this message
Daniel Hahler (blueyed) wrote :

This happens for me when running software-properties-gtk via SSH (X-Forwarding).
I am not being asked for authentication.

Revision history for this message
Antec (info-janmob) wrote :

This bug, I get even with the 12.04, kernel 3.2.0-12

Revision history for this message
wagung (wagungs) wrote :

same error in my precise kernel 3.2.0-17-generic-pae

Revision history for this message
jlb181 (jeffery-birkhofer) wrote :

This bug, I get even with the 12.04, kernel 3.2.0-17

Revision history for this message
Marián Kadaňka (marian.kadanka) wrote :

Still present on Lubuntu 12.04 beta1

Revision history for this message
Adrián (jaksi) wrote :

This happens in Ubuntu 12.04 beta1, when you are running software-properties-gtk.

Revision history for this message
nick3499-ubuntu-amd64 (nick3499) wrote :

I experienced this crash while using Software Sources >> Other Software to remove a software source. After successfully removing the source, I experienced the crash. At the time, the only other program shown in Unity Launcher was Wine Windows Program Loader.

Revision history for this message
Keith Buel (kbuel) wrote :

Added Canonical Parners in other software and experienced the crash

Revision history for this message
Carla Sella (carla-sella) wrote :

was searching for some software in software center and it crashed.

Revision history for this message
Israel Dahl (israeldahl) wrote :

12.04 BETA I was going to add a source, but decided not to and it crashed.
I have updated the system everyday, so I should have all the current updates.

Revision history for this message
Edward Donovan (edward.donovan) wrote :

I got this crash, again, when software sources asked for my password, and I hit ESC. I haven't had a chance to look at the code (and don't know if I could figure anything out). That said... The error says:

  PermissionDeniedByPolicy: com.ubuntu.softwareproperties.applychanges

In my case, is the code presuming the authorization dialog resulted in a successful authorization? Perhaps it's lacking a check for whether it really got permission, or at least how the dialog exited.

Beyond that, should 'permission denied' cause a crash? That seems like a case we ought to be able to cover. Maybe it's not exactly a crash, in my case: the software-properties-gtk window was still there, and still responsive, I believe. But some internals crashed enough to start apport up. 'Permission denied' does seems like something we should report to the user, perhaps in a dialog, and not have to throw an exception for.

Maybe I can get time to look at the code. Whether I might get anywhere is a crapshoot.
Thanks.

Revision history for this message
Edward Donovan (edward.donovan) wrote :

It might be tough to debug, though, since I can't reproduce it at will. It's just happened to me a few times. Hmmm.

Changed in software-properties (Ubuntu):
assignee: nobody → Canonical Foundations Team (canonical-foundations)
Revision history for this message
Rick Spencer (rick-rickspencer3) wrote :

@foundations team - I suspect this is an unhandled exception from a back end process, and that people aren't actually breaking. Would be good to take a look though, if users will be prompted with errors. Please unassign/reassing as desired.

Revision history for this message
Steve Langasek (vorlon) wrote :

This is reproducible by launching software-properties-gtk as any user that is not an admin, or from any session where the user can't be verified to be an admin via policykit - including when the user hits 'cancel' in the authentication dialog. We should suppress these exceptions so they don't show up as crashes on the desktop.

Revision history for this message
Daniel Clem (clem11388) wrote :

Only thing I can add, is that I was trying to enable the Canonical partner thing, and the Statistics survey setting. I actually try to stress things a bit more than most, where I check and uncheck boxes multiple times and switch tabs alot, trying to create a simple bug or crash. Never had this happen in previous versions. But this is the first time I've had this bug since the fresh install a couple days ago.

Revision history for this message
lots (cairo) wrote :

Only thing I can add, is that I was click on remove some PPA and than click on cancel.

Revision history for this message
Gibb (capt-gibb) wrote :

Clicked to enable a "disabled on upgrade" source.

Revision history for this message
Roberto González Correa (rob-e-gonzlez) wrote :

Hi. The following happened to me, using Ubuntu 12.04, 64 bits, final release.
I opened the Ubuntu Software Centre to enable the Canonical Partner repsository. When I clicked the checkbox for this repo, the "software sources" window (but not the whole software centre) crashed.
After that, I tried to enable this repo again and, although the corresponding checkbox is marked, when I searched for apps from Canonical Partner repo; no one was displayed by the Ubuntu Software Centre.

Revision history for this message
Paul Durham (durham-paul) wrote :

This error occurred when I did the following:

- Did clean install of Ubuntu 12.04 x86
- Logged in & set the correct proxy setting & applied system wide
- Installed Opera 11.62 from http://www.opera.com
- Rebooted (because Update Manager won't recognise my proxy setting change - complains there is no Internet connection)
- Launched Update Manager
- Selected "Other Software" tab
- Ticked "Canonical Partners"
- On the next screen asking for my password, I waited 6 or 7 seconds and then clicked on the "Cancel" button without entering my password.
- I then immediately got the crash warning.

This is reproducable - I just did it again.

Steve Langasek (vorlon)
description: updated
Revision history for this message
Edward Donovan (edward.donovan) wrote :

For future reference, the exception is raised here, in the code:

  http://bazaar.launchpad.net/~ubuntu-core-dev/software-properties/main/view/head:/softwareproperties/dbus/SoftwarePropertiesDBus.py#L356

The last line of this block:

  if not is_auth:
              logging.debug('_check_polkit_privilege: sender %s on connection %s pid %i is not authorized for %s: %s' %
                      (sender, conn, pid, privilege, str(details)))
              self.AuthFailed()
              raise PermissionDeniedByPolicy(privilege)

I don't know enough about python error handling, right now. I tried just commenting out the "raise" line, but that did not seem to be enough. The behaviour didn't seem to change at all, though, so perhaps I got the whole thing wrong.

Anyone here very familiar with to handling python exceptions quietly? This could be a very easy fix for someone with experience.

Revision history for this message
Edward Donovan (edward.donovan) wrote :

The whole privilege-checking section of the code looks like it was copied from the 'jockey' app. It starts at line 306, the comment "# helper from jockey":

  http://bazaar.launchpad.net/~ubuntu-core-dev/software-properties/main/view/head:/softwareproperties/dbus/SoftwarePropertiesDBus.py#L306

(AFAICT, that code predates the bazaar history, which shows the file arriving in one piece, including the main part of this code.)

Later, I'll try to look at jockey and see if it now handles this better. Thanks.

Revision history for this message
Edward Donovan (edward.donovan) wrote :

Partial update: the code is almost the same in jockey:

  http://bazaar.launchpad.net/~ubuntu-core-dev/jockey/ubuntu/view/head:/jockey/backend.py#L781

(Software-properties has added this line:

  self.AuthFailed()

But removing it does not change our bug.)

Revision history for this message
Edward Donovan (edward.donovan) wrote :

Jockey, though, must handle the exception somewhere else in the code. If you cancel the password dialog in jockey-gtk, it gives you another dialog saying you don't have permission. Apport does not start.

I'll try to keep following that. Thanks.

Revision history for this message
Edward Donovan (edward.donovan) wrote :

In jockey/ui.py , the exception is handled, in a 'try' block, like this:

  except PermissionDeniedByPolicy:
              self.error_msg(self.string_unprivileged)
              return False

Twice, at different points in the code:

http://bazaar.launchpad.net/~ubuntu-core-dev/jockey/ubuntu/view/head:/jockey/ui.py#L508
http://bazaar.launchpad.net/~ubuntu-core-dev/jockey/ubuntu/view/head:/jockey/ui.py#L677

self.string_unprivileged is earlier defined as 'You are not authorized to perform this action.'

I don't yet see where the error_msg method is defined or inherited, just places where it's called. Jockey is built with GUI and text modes, so it's a general mechanism. software-properties is just GUI, and defines error dialogs in a couple places, so I'm not yet sure what a patch should look like.

Revision history for this message
Edward Donovan (edward.donovan) wrote :

Thoughts in progress, not quite a patch, yet -

I think we want to catch the exception with a try statement in SoftwarePropertiesGtk.py, but I don't know yet where is the sensible place to put it. The exception catching could be like this, using an error dialog function already defined there:

except PermissionDeniedByPolicy:
    error(self.window_main,
          "Authorization failed.",
          "Software sources can't be changed without permission.")

Revision history for this message
Edward Donovan (edward.donovan) wrote :

Um, to be more explicit, comments 28-30 were barking up the wrong tree.

Now, I'm working on wrapping each significant operation in SoftwarePropertiesGtk.py, with a try statement that will catch this exception.

Revision history for this message
Edward Donovan (edward.donovan) wrote :

Here is a rough-and-ready patch, to SoftwarePropertiesGtk.py, that catches the PermissionDeniedByPolicy exceptions.

It wraps every call to the dbus backend, the operations that require a password, in a try-except block. When it catches the exception, it pops a dialog saying "Software sources can't be changed without permission."

This patch stops the exception problems, for every action in the GUI, that I could think to try. Please test it if you can.

Notes:

- I could not find one place to put the try-except, that would include all the operations. I tried putting it in the files that call this one, and several places here.

- As of this first version, if you cancel the password dialog, the 'Revert' button is activated, even though you were unable to change anything. I'll try to look into that, but want to send this now.

- The module already has a method "on_auth_failed", apparently for use when the dbus backend signals unsuccessful authorization. I haven't been able to integrate this patch with that function. Ideally, this exception catching might be a part of that, and perhaps that function is not quite doing its job, yet, if it isn't handling these exceptions, or managing the state of 'Revert'.

Thanks.

tags: added: patch
tags: added: precise quantal
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Patch that wraps an exception handler around each backend call. First try." of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

Revision history for this message
Guy Stone (stoneguy3) wrote :

Was attempting to uncheck Independent boxes in Software Sources ->Other Software, since Quantal's Extras repository doesn't exist yet.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Hey Michael, that's one of the most reportes issues on precise, is there any way you could have a look to the bug?

Changed in software-properties (Ubuntu Precise):
importance: Undecided → High
Revision history for this message
Sebastien Bacher (seb128) wrote :

that user gets some hundred reports a day on errors.ubuntu.com, milestoning for LTS .1

Changed in software-properties (Ubuntu Precise):
milestone: none → ubuntu-12.04.1
Revision history for this message
Sebastien Bacher (seb128) wrote :

Hey Didier, is there any chance you could have a look to this one?

Changed in software-properties (Ubuntu Precise):
assignee: nobody → Didier Roche (didrocks)
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in software-properties (Ubuntu Precise):
status: New → Confirmed
Changed in software-properties (Ubuntu Precise):
status: Confirmed → Triaged
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

@Edward: thanks for the patch, I integrated yours in quantal (adding i18n). However, I removed the dialog in precise as we can't add new strings (untranslated) to an existing release.

Thanks again for your contribution :)

Changed in software-properties (Ubuntu):
status: Triaged → Fix Committed
description: updated
Changed in software-properties (Ubuntu Precise):
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package software-properties - 0.89

---------------
software-properties (0.89) quantal; urgency=low

  * Add the jockey replacement tab for software-properties-gtk:
    - finish the work started by cyphermox (LP: #1021733)
    - add dep on latest ubuntu-drivers-common for the backend
  * Wrap all dbus calls under a try/except catch for unauthorized calls.
    (original work by Edward Donovan) (LP: #828850)
 -- Didier Roche <email address hidden> Wed, 18 Jul 2012 11:28:09 +0200

Changed in software-properties (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Scott Kitterman (kitterman) wrote : Please test proposed package

Hello Zijyfe, or anyone else affected,

Accepted software-properties into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/software-properties/0.82.7.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

tags: added: verification-needed
tags: added: verification-done
removed: verification-needed
Changed in software-properties (Ubuntu Precise):
status: Fix Committed → Incomplete
Changed in software-properties (Ubuntu Precise):
status: Incomplete → Fix Committed
Revision history for this message
Scott Kitterman (kitterman) wrote : Update Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package software-properties - 0.82.7.2

---------------
software-properties (0.82.7.2) precise-proposed; urgency=low

  * Wrap all dbus calls under a try/except catch for unauthorized calls.
    Adding a small warning on the command line
    (original work by Edward Donovan) (LP: #828850)
 -- Didier Roche <email address hidden> Wed, 18 Jul 2012 09:28:10 +0200

Changed in software-properties (Ubuntu Precise):
status: Fix Committed → Fix Released
Revision history for this message
Brian K. Abbey (ogemawaubwhite7) wrote :

Wanting my computer to be more up to date info and options that help with resourses. So if theres any new thats of use then please feel free to send to my email!

Changed in software-properties (Ubuntu):
assignee: Canonical Foundations Team (canonical-foundations) → Iosu Sacristan Etxabe (iosusacristan)
Changed in software-properties (Ubuntu Precise):
assignee: Didier Roche (didrocks) → Iosu Sacristan Etxabe (iosusacristan)
To post a comment you must log in.