Not able to install packages using the PackageKit D-Bus API

Bug #1397750 reported by Till Kamppeter
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
aptdaemon (Ubuntu)
Fix Released
High
dominik sladek
Utopic
New
High
Unassigned
system-config-printer (Ubuntu)
Fix Released
High
Unassigned
Utopic
Fix Released
High
Unassigned

Bug Description

I am on Ubuntu Utopic (14.10) and want to do the following, preferably
with a Python script.

I want to install a printer driver package from Epson (which is
available as both DEB and RPM) through its apt or yum repository so that
future updates get installed automatically through the distro's update
mechanism. I also want to assure by means of a key fingerprint that
repository and package are really from Epson.

The package name for example is

epson-inkjet-printer-escpr

The key fingerprint is

E5220FB7014D0FBDA50DFC2BE5E86C008AA65D56

and the Debian package repository is

deb http://download.ebz.epson.net/dsc/op/stable/debian/ lsb3.2 main

This data is polled from OpenPrinting:

https://www.openprinting.org/query.cgi?moreinfo=1&showprinterid=1&onlynewestdriverpackages=0&architectures=amd64&noobsoletes=1&onlyfree=0&onlymanufacturer=0&onlydownload=1&packagesystem=deb&onlysigneddriverpackages=0&format=xml&type=drivers&printer=MFG:EPSON;MDL:EP-801A%20Series;DES:EPSON%20EP-801A%20Series;CLS:PRINTER;

One can replace the packagesystem=deb in the URL by packagesystem=rpm
for RPM-based distros.

Now I run a script of system-config-printer,
/usr/share/system-config-printer/install-printerdriver.py via the command

install-printerdriver 'epson-inkjet-printer-escpr' 'deb
http://download.ebz.epson.net/dsc/op/stable/debian/ lsb3.2 main'
'E5220FB7014D0FBDA50DFC2BE5E86C008AA65D56'

Or by pasting the commands at the python prompt:

till@till-twist:~$ python3
Python 3.4.2 (default, Oct 8 2014, 13:08:17)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from gi.repository import GLib, PackageKitGlib
>>> import sys
>>> def progress(progress, type, user_data):
... pass
...
>>> package = 'epson-inkjet-printer-escpr'
>>> repo = 'deb http://download.ebz.epson.net/dsc/op/stable/debian/ lsb3.2 main'
>>> repo_gpg_id = 'E5220FB7014D0FBDA50DFC2BE5E86C008AA65D56'
>>> pk = PackageKitGlib.Client()
>>> res = pk.install_signature(PackageKitGlib.SigTypeEnum.GPG, repo_gpg_id, '', None, progress, None)
>>> res.get_exit_code()
<enum PK_EXIT_ENUM_SUCCESS of type PkExitEnum>
>>> res = pk.resolve(PackageKitGlib.FilterEnum.NONE, [package], None, lambda p, t, d: True, None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
GLib.Error: pk_client_error: Package name epson-inkjet-printer-escpr could not be resolved. (263)
>>> res = pk.repo_enable(repo, True, None, progress, None)
>>> res = pk.refresh_cache(False, None, progress, None)
>>> res = pk.resolve(PackageKitGlib.FilterEnum.NONE, [package], None, lambda p, t, d: True, None)
>>> package_ids = res.get_package_array()
>>> package_id = package_ids[0].get_id()
>>> package_id
'epson-inkjet-printer-escpr;1.4.1-1lsb3.2;amd64;printdriver'
>>> package_ids[0].get_info() & PackageKitGlib.InfoEnum.INSTALLED
0
>>> res = pk.install_packages(True, [package_id], None, progress, None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
GLib.Error: pk_client_error: The version 1.4.1-1lsb3.2/printdriver of epson-inkjet-printer-escpr isn't available. (263)
>>> res = pk.install_packages(True, ['epson-inkjet-printer-escpr;1.4.1-1lsb3.2;amd64;'], None, progress, None)
>>> res = pk.get_files([package_id], None, progress, None)
>>> files = res.get_files_array()
>>>

The problem is that the step of actually installing the package ("res = pk.install_packages(..)") errors. It says:

The version 1.4.1-1lsb3.2/printdriver of epson-inkjet-printer-escpr isn't available.

So the version number is messed up ("/printdriver" added) and therefore the package not found. If I manipulate the package ID somewhat, removing the "printdriver" in the end, the package installation works (I have checked in another terminal that the package got actually installed).

The same error occurs with "pkcon install epson-inkjet-printer-escpr" on the command line.

The problem seems not to be caused by the transition from Python 2 to Python3. I can paste the command sequence above also into Python 2 and get the same results.

Please check whether this is really caused by aptdemon, perhaps it can also be the PackageKit client.

Yje bug makes the automatic printer driver installation by system-config-printer not working any more, therefore i set its importance to "High".

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

Added system-config-printer task for a workaround applied to system-config-printer (in version 1.5.3+20141029-0ubuntu2). Note that this is a workaround, the bug is still in aptdaemon.

Changed in system-config-printer (Ubuntu):
status: New → In Progress
importance: Undecided → High
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package system-config-printer - 1.5.3+20141029-0ubuntu2

---------------
system-config-printer (1.5.3+20141029-0ubuntu2) vivid; urgency=medium

  * debian/patches/35_package-download-fixes.patch: Fixed several bugs to
    make automatic printer driver download working again:
     o Use pyrequests instead of pycurl for secure (verified certificate)
       downloads. pycurl stopped working after the OpenPrinting web server
       has moved from Ubuntu 10.04 to 12.04.
     o In the install-printerdriver script improved the check for the
       necessity of adfding the driver's Debian repository and added a
       workaround for a bug in aptdaemon interpreting PackageKit's package
       IDs wrongly when installing a package (LP: #1397750).
     o Bugs in the outsourcing of the OpenPrinting request code into
       from newprinter.py into the new OpenPrintingRequest.py
     o Python3 transition bugs
  * debian/patches/07_driver-auto-download-configuration.patch: The variables
    for auto-download configuration have moved from newprinter.py to the new
    config.py file.
  * debian/control: Depend on python-requests instead of on python-pycurl.
 -- Till Kamppeter <email address hidden> Thu, 4 Dec 2014 23:32:26 +0100

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

Occurs also in Utopic, but not in Trusty.

Changed in aptdaemon (Ubuntu Utopic):
importance: Undecided → High
Changed in system-config-printer (Ubuntu Utopic):
importance: Undecided → High
status: New → Triaged
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

SRU for Utopic and Trusty applying the workaround for this problem to system-config-printer and fixing other driver-download-related bugs is handled in bug 1401835.

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

Note: This problem is not caused by the replacement of the OpenPrinting web server, as it happens when accessing Epson's download server.

Revision history for this message
Chris J Arges (arges) wrote : Please test proposed package

Hello Till, or anyone else affected,

Accepted system-config-printer into utopic-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/system-config-printer/1.5.1+20141010-0ubuntu2.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 add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and 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!

Changed in system-config-printer (Ubuntu Utopic):
status: Triaged → Fix Committed
tags: added: verification-needed
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Checked with the package from utopic-proposed and automatic driver package installation is working now, so the workaround in install-printerdriver solves the problem.

tags: added: verification-done
removed: verification-needed
Mathew Hodson (mhodson)
tags: added: utopic
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package system-config-printer - 1.5.1+20141010-0ubuntu2.2

---------------
system-config-printer (1.5.1+20141010-0ubuntu2.2) utopic-proposed; urgency=medium

  * debian/patches/70_package-download-fixes.patch: Fixed several bugs to
    make automatic printer driver download working again (LP: #1401835):
     o Use pyrequests instead of pycurl for secure (verified certificate)
       downloads. pycurl stopped working after the OpenPrinting web server
       has moved from Ubuntu 10.04 to 12.04 (LP: #1394244).
     o In the install-printerdriver script improved the check for the
       necessity of adding the driver's Debian repository and added a
       workaround for a bug in aptdaemon interpreting PackageKit's package
       IDs wrongly when installing a package (LP: #1397750).
     o In fillDriverList() use ".hasattr()" to check presence of
       attributes.
     o Python3 transition bugs
  * debian/patches/73_support-non-utf-8-encoded-ppds.patch: Do not
    crash on non-UTF-8-encoded PPD files (LP: #1400232)
  * debian/control: Depend on python-requests instead of on python-pycurl.
 -- Till Kamppeter <email address hidden> Sat, 13 Dec 2014 11:01:26 +0100

Changed in system-config-printer (Ubuntu Utopic):
status: Fix Committed → Fix Released
Revision history for this message
Chris J Arges (arges) wrote : Update Released

The verification of the Stable Release Update for system-config-printer 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 regressions.

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

If you still have problems with package installation by system-config-printer, please have a look at bug 1412722 and bug 1412729 and as soon as the proposed fixed packages get available there, test them and tell in that bug reports whether they solve your problem.

Changed in aptdaemon (Ubuntu):
assignee: nobody → dominik sladek (domdeejay)
Revision history for this message
Sebastien Bacher (seb128) wrote :
Changed in aptdaemon (Ubuntu):
status: New → Fix Released
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

The aptdaemon problem mentioned here is the same as bug 1352654. Marking as duplicate.

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

Other bug subscribers

Remote bug watches

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