Ubuntu

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

Reported by Zijyfe Duufop on 2011-08-18
This bug affects 249 people
Affects Status Importance Assigned to Milestone
Software Properties
New
Undecided
Unassigned
software-properties (Ubuntu)
Medium
Iosu Sacristan Etxabe
Precise
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

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

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.

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

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

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.

frmdstryr (frmdstryr) wrote :

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

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.

DarkRedman (darkredman) wrote :

It occurs for me when I check or uncheck sources

Daniel Hahler (blueyed) wrote :

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

Antec (info-janmob) wrote :

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

wagung (wagungs) wrote :

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

jlb181 (jeffery-birkhofer) wrote :

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

Still present on Lubuntu 12.04 beta1

Adrián (jaksi) wrote :

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

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.

Keith Buel (kbuel) wrote :

Added Canonical Parners in other software and experienced the crash

Carla Sella (carla-sella) wrote :

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

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.

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.

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)

@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.

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.

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.

lots (cairo) wrote :

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

Gibb (capt-gibb) wrote :

Clicked to enable a "disabled on upgrade" source.

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.

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) on 2012-04-30
description: updated

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.

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.

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.)

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.

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.

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.")

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.

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

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.]

Guy Stone (stoneguy3) wrote :

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

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
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
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)
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
Didier Roche (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
Didier Roche (didrocks) on 2012-07-18
description: updated
Changed in software-properties (Ubuntu Precise):
status: Triaged → Fix Committed
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

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
Alan Pope ㋛ (popey) on 2012-07-24
tags: added: verification-done
removed: verification-needed
Changed in software-properties (Ubuntu Precise):
status: Fix Committed → Incomplete
Didier Roche (didrocks) on 2012-07-29
Changed in software-properties (Ubuntu Precise):
status: Incomplete → Fix Committed

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.

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

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.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers