scp-dbus-service.py crashed with ImportError in __main__: No module named asyncconn

Bug #902762 reported by Jens Kehne
30
This bug affects 4 people
Affects Status Importance Assigned to Milestone
system-config-printer (Ubuntu)
Fix Released
High
Till Kamppeter
Quantal
Fix Released
High
Till Kamppeter

Bug Description

Error occurred directly after gnome startup

ProblemType: Crash
DistroRelease: Ubuntu 11.10
Package: system-config-printer-common 1.3.6+20110831-0ubuntu9.4
Uname: Linux 3.1.4-zen+ x86_64
ApportVersion: 1.23-0ubuntu4
Architecture: amd64
Date: Fri Dec 9 17:56:23 2011
ExecutablePath: /usr/share/system-config-printer/scp-dbus-service.py
InstallationMedia: Kubuntu 11.04 "Natty Narwhal" - Release amd64 (20110426.3)
InterpreterPath: /usr/bin/python2.7
Lpstat:
 device for Officejet_Pro_8500_A909a: hp:/net/Officejet_Pro_8500_A909a?zc=officejet
 device for Officejet_Pro_8500_A909a_fax: hpfax:/net/Officejet_Pro_8500_A909a?zc=officejet
Lsusb:
 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
 Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
 Bus 001 Device 003: ID 04f2:b257 Chicony Electronics Co., Ltd
MachineType: LENOVO 11433NG
PackageArchitecture: all
Papersize: a4
PpdFiles:
 FS-4000DN: Kyocera FS-4000DN
 Officejet_Pro_8500_A909a_fax: HP Fax hpcups
 FS-9000: Kyocera FS-9000
 Officejet_Pro_8500_A909a: HP Officejet Pro 8500 a909a hpijs, 3.11.7
 Dell_Color_Laser_3110cn: Dell 3100cn Foomatic/pxlcolor (recommended)
ProcCmdline: /usr/bin/python /usr/share/system-config-printer/scp-dbus-service.py
ProcEnviron:
 PATH=(custom, no user)
 LANG=de_DE.UTF-8
 SHELL=/bin/bash
ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-3.1.4-zen+ root=/dev/mapper/sda2_crypt ro i915.i915_enable_rc6=1 i915.lvds_downclock=1 pcie_aspm=force zcache
PythonArgs: ['/usr/share/system-config-printer/scp-dbus-service.py']
SourcePackage: system-config-printer
Title: scp-dbus-service.py crashed with ImportError in __main__: No module named asyncconn
Traceback:
 Traceback (most recent call last):
   File "/usr/share/system-config-printer/scp-dbus-service.py", line 28, in <module>
     import asyncconn
 ImportError: No module named asyncconn
UdevDb: Error: [Errno 2] Datei oder Verzeichnis nicht gefunden
UpgradeStatus: Upgraded to oneiric on 2011-10-15 (56 days ago)
UserGroups: adm admin cdrom dialout libvirtd lpadmin plugdev sambashare src vboxusers
dmi.bios.date: 05/19/2011
dmi.bios.vendor: LENOVO
dmi.bios.version: 8HET30WW(1.12)
dmi.board.asset.tag: Not Available
dmi.board.name: 11433NG
dmi.board.vendor: LENOVO
dmi.board.version: Not Available
dmi.chassis.asset.tag: No Asset Information
dmi.chassis.type: 10
dmi.chassis.vendor: LENOVO
dmi.chassis.version: Not Available
dmi.modalias: dmi:bvnLENOVO:bvr8HET30WW(1.12):bd05/19/2011:svnLENOVO:pn11433NG:pvrThinkPadE520:rvnLENOVO:rn11433NG:rvrNotAvailable:cvnLENOVO:ct10:cvrNotAvailable:
dmi.product.name: 11433NG
dmi.product.version: ThinkPad E520
dmi.sys.vendor: LENOVO

Revision history for this message
Jens Kehne (jkehne) wrote :
tags: removed: need-duplicate-check
Jens Kehne (jkehne)
visibility: private → public
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Can you run

sudo apt-get install --reinstall system-config-printer-common system-config-printer-gnome

Changed in system-config-printer (Ubuntu):
status: New → Incomplete
Revision history for this message
Jens Kehne (jkehne) wrote : Re: [Bug 902762] Re: scp-dbus-service.py crashed with ImportError in __main__: No module named asyncconn

Am 29.02.2012 16:42, schrieb Till Kamppeter:
> Can you run
>
> sudo apt-get install --reinstall system-config-printer-common system-
> config-printer-gnome

Just did.
I haven't seen this error in a while, so it may be fixed already.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

So I am closing this. Re-open if the problem occurs again.

Changed in system-config-printer (Ubuntu):
status: Incomplete → Fix Released
Revision history for this message
Scott Kitterman (kitterman) wrote :

Reopening since I can trigger this error reasonably reliably on 12.04.

Changed in system-config-printer (Ubuntu):
status: Fix Released → Confirmed
Revision history for this message
Scott Kitterman (kitterman) wrote :

add-printer(21143) SelectMakeModel::getBestDriversFailed: Failed to get best drivers QDBusError("org.freedesktop.DBus.Error.Spawn.ChildExited", "Process /usr/bin/scp-dbus-service exited with status 1") QDBusMessage(type=MethodCall, service="org.fedoraproject.Config.Printing", path="/org/fedoraproject/Config/Printing", interface="org.fedoraproject.Config.Printing", member="GetBestDrivers", signature="", contents=("MFG:HP;MDL:Officejet Pro 8500 A909g;CMD:MLC,PCL,PML,DW-PCL,DESKJET,DYN;1284.4DL:4d,4e,1;CLS:PRINTER;DES:CB023A;SN:MY93O210V8;S:038080ec840010210068eb800008fb8000044c8003245cd001446cd000a41c8005a;Z:0102,0500000900000901a5e1019641022c41026161,0600,07000000000000000000000000,0b0000000000000000989b98ba0000987098a30000987098a4000098af98c5,0c0,10000000000000000000000000000000000000,12000,150;", "HP Officejet Pro 8500 A909g", "socket://192.168.111.99:9100") )

Revision history for this message
Scott Kitterman (kitterman) wrote :

/usr/share/system-config-printer/asyncconn.py system-config-printer-gnome

This file needs to be moved to -common since it's used from there.

Changed in system-config-printer (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
Scott Kitterman (kitterman) wrote :

Sigh. But it used gtk, so it needs to refactoring. asyncipp.py, asyncpk1.py, and authconn.py need moving too.

Changed in system-config-printer (Ubuntu):
importance: Undecided → High
Revision history for this message
Scott Kitterman (kitterman) wrote :

Kubuntu's new print-manager uses scp-dbus-service, so getting this fixed in Quantal is rather important.

Changed in system-config-printer (Ubuntu Quantal):
milestone: none → ubuntu-12.10-beta-1
Changed in system-config-printer (Ubuntu Quantal):
milestone: ubuntu-12.10-beta-1 → ubuntu-12.10-beta-2
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Till, can you have a look at this bug and fix from what Scott's told? Thanks :)

Changed in system-config-printer (Ubuntu Quantal):
assignee: nobody → Till Kamppeter (till-kamppeter)
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

asyncconn.py, asyncipp.py, asyncpk1.py, and authconn.py provide a mechanism for authentication against CUPS. The modules provide especially non-blocking authentication dialogs and auto-select between authentication via IPP and PolicyKit. All the four files depend onm GTK, but only asyncipp.py and authconn.py actually produce GUI elements (not taking into account GUIs of test programs which are started by executing the module as a program itself, like via "python <module>.py"). asyncpk1.py only uses "gtk.gdk.threads_enter ()"/"gtk.gdk.threads_leave ()" pairs, and in asyncconn.py GTK is imported without need.

It will probably need major changes to separate out the GUI elements and make these four modules GUI-toolkit-independent.

It seems if one could somehow make system-config-printer only need asynchronous authentication via PolicyKit, for example by blocking out features which would use IPP or synchronous authentication (running s-c-p as root, administration of remote CUPS servers, ...) one could perhaps work around the GTK GUI elements. Then one would need to put the "import gtk" calls into "try:"/"except:" constructs.

Tim, Jiri, what do you think, is there an easy way to make scp-dbus-service.py and other authentication-needing parts of system-config-printer work in a GTK-free environment like Kubuntu?

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

I have checked further and found out that scp-dbus-service.py only uses authentication via asyncconn.py, never via asyncipp.py, asyncpk1.py, or authconn.py directly. So for all authentication access an auto-selection of IPP authentication (done by asyncipp.py and authconn.py) or PolicyKit authentication is done:

use_pk = ((host.startswith ('/') or host == 'localhost') and
                  os.getuid () != 0)

PoliciKit is chosen if the program is started by a non-root user and the CUPS host is local (either "localhost" or a socket). The PolicyKit authentication does not open any GTK windows.

Also note that the "import authconn" in asyncconn.py is bogus, there asyncconn.py does not use authconn.py directly.

The only use of the GTK module in asyncpk1.py are "gtk.gdk.threads_enter ()"/"gtk.gdk.threads_leave ()" pairs which should be made optional (only if gtk is present), removed, or replaced by something more general.

So one could do the following:

1. Make the KDE printer setup tool PolicyKit-only. For this let it error out (with an error dialog) when the user tries to start it as root and also ignore any remote CUPS servers set as default via client.conf and do not offer functionality to switch the CUPS server (If the default CUPS server is remote, try to access "localhost" or the local daemon via socket and if this does not work, error out with an error dialog). With all this, asyncconn will always select PolicyKit authentication.

2. Remove "import gtk" and "import authconn" in asyncconn.py

3. In ayncconn.py import only the one to be actually used of asyncipp and asyncpk1. If the import fails, let the creation of the Connection instance fail.

4. In asyncpk1.py bracket the "import gtk", "gtk.gdk.threads_enter ()", and "gtk.gdk.threads_leave ()" calls in "try: ... except: ...". In the "except:" blocks either do nothing or put any substitution for the "gtk.gdk.threads_enter ()"/"gtk.gdk.threads_leave ()" mechanism.

5. For the Ubuntu packaging move asyncconn.py and asyncpk1.py from the system-config-printer-gnome binary package into system-config-printer-common.

Scott, Tim, Jiri, WDYT about this solution?

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Note that in the Ubuntu package the PolicyKit support is generally blocked out by a patch, due to bug 807261. I have done a quick check and the bug seems to be fixed. So the patch can be removed.

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

This bug was fixed in the package system-config-printer - 1.3.11+20120807-0ubuntu7

---------------
system-config-printer (1.3.11+20120807-0ubuntu7) quantal; urgency=low

  * debian/patches/33_scp-dbus-service-policy-kit-only-auth-on-non-gtk-systems.patch:
    Made asyncconn.py and asyncpk1.py working also without GTK, so that
    scp-dbus-service can be used on GTK-less systems like Kubuntu. Note that
    this requires authentication via PolicyKit and so scp-dbus-service can
    only run under conditions where PolicyKit is supported, which means that
    it must run as a non-root user and accessing a local CUPS daemon, via
    "localhost" or socket (LP: #902762).
  * debian/system-config-printer-common.install,
    debian/system-config-printer-gnome.install,
    debian/control: Moved asyncconn.py and asyncpk1.py from
    system-config-printer-gnome to system-config-printer-common
    (LP: #902762).
  * debian/patches/27_disable-policy-kit-support.patch: Removed, as
    cups-pk-helper is fixed now (See LP: #807261).
  * debian/patches/07_allow-also-nonfree-ppds-for-single-ppd-download.patch:
    Removed, as it is not needed any more. The patch
    30_driver-autodownload.patch overrides the onlyfree setting in
    the cupshelpers::openprinting module.
 -- Till Kamppeter <email address hidden> Wed, 12 Sep 2012 15:57:00 +0200

Changed in system-config-printer (Ubuntu Quantal):
status: Triaged → Fix Released
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Scott, can you test the new system-config-printer package? Does it work this way as longs as you stay under supported conditions (printer setup tool started as non-root user and working on a local CUPS server)?

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Tim, Jiri, this is the patch which I have applied to the current Ubuntu package. It is the simplest solution, one could do a better error handling if one of the two authentication methods fails, like gracefully erroring out or a failover to the other method.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.