pkservice.py crashed with AttributeError in __init__(): 'module' object has no attribute 'MainLoop'

Bug #1422004 reported by Angel Guzman Maeso on 2015-02-14
224
This bug affects 50 people
Affects Status Importance Assigned to Milestone
HPLIP
High
Gaurav Sood
hplip (Ubuntu)
High
Till Kamppeter
Vivid
High
Till Kamppeter

Bug Description

If an HP printer needs HPLIP with HP's proprietary plug-in (firmware files for printers, proprietary driver code pieces for printing and/or scanning) the automatically initiated installation of the plug-in fails and causes crash reports, leading to crash report pop-ups and non-working printing and scanning functionality. The problem is caused by the switchover from Python2 to Python3 in Vivid, especially also that the Python3 executable is named "python3" and not "python".

If the crash happens shortly before shutdown or reboot the pop-up can appear right after log-in.

[Impact]

All Vivid users who use a printer or multi-function device which needs HP's proprietary plug-in get crash pop-ups and their devices will not completely work or not work at all.

[Test Case]

Connect an HP printer or multi-function device which needs the plug-in (for which models see this bug report and the numerous duplicates) and set it up. As soon as the plug-in gets downloaded and installed, crash reports pop up, and the devices functionality which needs the plug-in will not work as plug-in installation does not complete.

The proposed package solves the problem.

To test without having an appropriate printer, simply run the command

hp-plugin

in a terminal window. With the current package it will fail as mentioned, with the proposed package plug-in installation will succeed.

[Regression Potential]

Very low. The patch is trivial and it affects only users who need the plug-in. All users of other HP printers or non-HP printers are not affected.

ProblemType: Crash
DistroRelease: Ubuntu 15.04
Package: hplip-data 3.15.2-0ubuntu2
ProcVersionSignature: Ubuntu 3.16.0-22.29-generic 3.16.4
Uname: Linux 3.16.0-22-generic x86_64
ApportVersion: 2.16.1-0ubuntu2
Architecture: amd64
CupsErrorLog: E [14/Feb/2015:19:56:52 +0100] Unable to open listen socket for address [v1.::1]:631 - Cannot assign requested address.
Date: Sat Feb 14 05:59:51 2015
ExecutablePath: /usr/share/hplip/pkservice.py
InstallationDate: Installed on 2014-05-08 (282 days ago)
InstallationMedia: Ubuntu 14.04 LTS "Trusty Tahr" - Release amd64 (20140417)
InterpreterPath: /usr/bin/python3.4
Lpstat:
 device for HP-Deskjet-1000-J110-series: usb://HP/Deskjet%201000%20J110%20series?serial=CN33A18VXG05YD
 device for PDF: cups-pdf:/
MachineType: Acer Aspire 5943G
PackageArchitecture: all
Papersize: a4
PpdFiles:
 HP-Deskjet-1000-J110-series: HP Deskjet 1000 j110 Series, hpcups 3.15.2
 PDF: Generic CUPS-PDF Printer
ProcCmdline: /usr/bin/python3 /usr/bin/hp-pkservice
ProcEnviron:

ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.16.0-22-generic root=UUID=e9be64c9-5b7e-438a-ac82-6b89bf946a86 ro quiet splash vt.handoff=7
PythonArgs: ['/usr/bin/hp-pkservice']
SourcePackage: hplip
Title: pkservice.py crashed with AttributeError in __init__(): 'module' object has no attribute 'MainLoop'
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups:

dmi.bios.date: 10/21/2010
dmi.bios.vendor: Acer
dmi.bios.version: V1.15
dmi.board.asset.tag: Base Board Asset Tag
dmi.board.name: Aspire 5943G
dmi.board.vendor: Acer
dmi.board.version: V1.15
dmi.chassis.type: 10
dmi.chassis.vendor: Acer
dmi.chassis.version: V1.15
dmi.modalias: dmi:bvnAcer:bvrV1.15:bd10/21/2010:svnAcer:pnAspire5943G:pvrV1.15:rvnAcer:rnAspire5943G:rvrV1.15:cvnAcer:ct10:cvrV1.15:
dmi.product.name: Aspire 5943G
dmi.product.version: V1.15
dmi.sys.vendor: Acer

Angel Guzman Maeso (shakaran) wrote :
tags: removed: need-duplicate-check
Changed in hplip (Ubuntu):
importance: Undecided → Medium
Launchpad Janitor (janitor) wrote :

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

Changed in hplip (Ubuntu):
status: New → Confirmed
information type: Private → Public
Shahar Or (mightyiam) wrote :

Thanks. BTW this means no printing for me.

Shahar Or (mightyiam) wrote :

Thank you, Denys

Chris Hermansen (c-hermansen) wrote :

Denys, the info at the link you provide seems to relate more to running the gui hp-setup; or am I missing something?

This bug affects me as "something" - cups? I dunno - is running hp-setup automagically and behind the scenes.

I have tried running hp-setup -i from the command line. When I use it to attempt to install my laserjet P1102w, I get as far as starting the download for the plugin, and then this happens:

    Creating directory plugin_tmp
    Verifying archive integrity... All good.
    Uncompressing HPLIP 3.15.2 Plugin Self Extracting Archive...............................
    Error importing HPLIP modules. Is HPLIP installed?
    error: Python gobject/dbus may be not installed

Done.

The same thing appears to happen when I try to install my other laserjet, an M1212nf_MFP.

I have looked for the string error: Python gobject/dbus may be not installed on Google. It seems that this may arise when Python 3 is the default, but running python -V from the command line tells me that the default on my system is 2.7.9.

This link https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=600360 suggests that I may be missing package python-gobject.

Looking in Synaptic, I see I have both python-gobject and python-gobject2 installed.

Is it possible that somehow the new Python3 gobject is interfering with hp-setup? I don't feel great about the idea of removing python-gobject to find out...

Willing to experiment here if anyone has any ideas... and as Shahar Or mentions, there is no printing happening here at this time...

Chris Hermansen (c-hermansen) wrote :

One thing I forgot to mention - the following HPLIP packages are installed:

hplip, hplip-data
libhpmud-dev, libhpmud0, libsane-hpaio
openprinting-ppds
printer-driver-hpcups, printer-driver-hpijs, printer-driver-pxljr

Not installed:

hpijs-ppds
hplip-dbg
hplip-doc
hplip-gui

Denys Usynin (denys-usynin) wrote :

> Denys, the info at the link you provide seems to relate more to running the gui hp-setup; or am I missing something?

yes, you get an error when you run hp-setup GUI. I also get errors that you are describing happening behind the scenes, but I believe it's the same kind of error.

Since reporting this bug, I tried HPLIP on Ubuntu 14.10 and discovered that exactly the same problem happens there. When I went to HPLIP website, it said it supports Ubuntu 14.10 in the version 3.14.10 of HPLIP. Ubuntu official repository only offered 3.14.6, and presumably that's why it couldn't work.

So I downloaded HPLIP 3.14.14 from their website, and ran their installer, and everything worked fine.

Given above story, I think what will happen with Ubuntu Vivid is that nothing will get fixed until HPLIP people release a version that supports Vivid. It may or may not make its way into official Ubuntu repos soon, so you will probably need to monitor HPLIP website and download their installer as soon as they say Ubuntu Vivid is supported.

Brand Jean-Luc (lucky-9) wrote :

can not install the plugin which allows you to configure and print to my HP Laserjet M1132 MFP thank you to take note

To the HPLIP developers at HP: Can you please make the plugin working in a Python3 system with Python3-built HPLIP like current Ubuntu? Thanks.

Gaurav Sood (gaurav-sood) wrote :

Installation of plugin happens through a python script which is launched via embedded shell script in the plugin.run file. In the shell script we specify the path of python binary as /usr/bin/python. On Ubuntu 15.04 hp-plugin runs in python3 due to updated shebang lines in top level scripts, but installation script in plugin.run file is invoked using /usr/bin/python which defaults to python2. SInce hplip extension code is only installed in python3 path, installation code tries to import any extension module it looks in the python2 path and reports ImportError.

We will fix this issue and will provide you the patch soon.

Chris Hermansen (c-hermansen) wrote :

FWIW I think something has changed very recently.

If I try to run hp-setup -i, I get the same kind of apport behaviour (with the above message) but now also see this on the terminal window:

Checking for network connection...
Downloading plug-in from:
Downloading plug-in: [\ ] 0%
error: /home/clh/.hplip/hplip-3.15.2-plugin.run file does not match its checksum. File may have been corrupted or altered
error: Failed to install Plugin.
clh@avignon:~$

No more complaining about "error: Python gobject/dbus may be not installed".

Gaurav, good luck, and thanks in advance!!

Changed in hplip:
status: New → Fix Released
Shahar Or (mightyiam) wrote :

Thank you, HPLIP devs, for fixing this.

Chris Hermansen (c-hermansen) wrote :

Do we know when this fix will hit 15.04? It's getting pretty close to the release...

Suma, thank you for the fix. Can you provide a patch for the HPLIP which comes in Ubuntu Vivid/15.04 (HPLIP 3.15.2)? Thanks in advance.

Changed in hplip (Ubuntu):
status: Confirmed → Triaged
Changed in hplip (Ubuntu Vivid):
milestone: none → vivid-updates
Suma Byrappa (suma-byrappa) wrote :

Hi Till,

Patch is attached. This is the same as what we sent you earlier.

Regards,
Suma

The attachment "pluginhandler.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch

Can I simply backport this patch into the 3.15.2 of Ubuntu Vivid or would the plugin for 3.15.2 need a change, too?

Suma Byrappa (suma-byrappa) wrote :

plugin.run will also require a change.

Nick B. (futurepilot) wrote :

When can we expect a fix? My scanner is useless without the plugin.

TomasHnyk (sup) wrote :

BTW: installing from upstream fixes this for me (as can be deducted from the comments above) so you can use that if you just need to make your printers work: http://sourceforge.net/projects/hplip/files/hplip/3.15.4/hplip-3.15.4.run/download?use_mirror=freefr

Chris Hermansen (c-hermansen) wrote :

TomasHynk, thanks for the suggestion.

I have run that file hplip-3.15.4.run and it appears to install OK (no error messages).

As well it manages to set up my HP 1102w.

However it fails to setup my HP M1212nf MFP with the following message:

error: Printer queue setup failed. Error : successful-ok-ignored-or-substituted-attributes

So I guess you can say it's a partial work-around...

I have filed a question on the HPLIP launchpad project about that.

Chris Hermansen (c-hermansen) wrote :

TomasHynk, more on that last:

After a reboot I can successfully add that M1212nf printer... hmm.

However, when I log in I still get the error associated with this bug, even though hp-setup run from the command line seems fine.

Changed in hplip (Ubuntu Vivid):
assignee: nobody → Till Kamppeter (till-kamppeter)

Fixed plugin is uploaded to the download server now.

Changed in hplip (Ubuntu Vivid):
status: Triaged → Fix Released
Changed in hplip (Ubuntu Vivid):
status: Fix Released → In Progress

Sorry, the bug is not yet fixed for Vivid. A patch still needs to get applied.

Everyone suffering this problem please stay tuned and wait for further instructions here as I will make available a fixed package for testing which only after your test feedback will get an official update for Vivid.

description: updated
Changed in hplip:
status: Fix Released → Fix Committed
assignee: nobody → Gaurav Sood (gaurav-sood)

Attached is a patch which fixes the problem. For testing and getting your printer working immediately run the commands

cd /
sudo patch -p0 < hp-plugin-download-fix.patch

Then run

hp-plugin

again and the plug-in should get successfully installed.

But please stay tuned for the instructions for testing the official fix being posted here soon. Only if you also test the official fix it will make it into the updates for everyone.

description: updated

Note that my patch of the previous comment already contains the patch from comment #17.

Uploaded fixed package to vivid-proposed. As soon as the package gets approved by the SRU team it will get available for testing and testing instructions will get posted here. Please test and report back as otherwise the package will not make it into the official updates.

Changed in hplip (Ubuntu):
status: In Progress → Fix Committed
Changed in hplip (Ubuntu Vivid):
status: In Progress → Fix Committed
status: Fix Committed → In Progress
Changed in hplip (Ubuntu):
importance: Medium → High
Changed in hplip (Ubuntu Vivid):
importance: Medium → High

debdiff for the SRU team.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package hplip - 3.15.2-0ubuntu5

---------------
hplip (3.15.2-0ubuntu5) wily; urgency=low

  * debian/patches/hp-plugin-download-fix.patch: Fix download and installation
    of HP's proprietary plug-in in Python3 environments (LP: #1422004).

 -- Till Kamppeter <email address hidden> Wed, 6 May 2015 16:50:00 -0300

Changed in hplip (Ubuntu):
status: Fix Committed → Fix Released

Hello Angel, or anyone else affected,

Accepted hplip into vivid-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/hplip/3.15.2-0ubuntu4.1 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 hplip (Ubuntu Vivid):
status: In Progress → Fix Committed
tags: added: verification-needed
Leo Milano (lmilano) wrote :

Hi

I enabled 'proposed' vivid updates, installed hplip 3.15.2-0ubuntu4.1 , and I could successfully run the hp-plugin component. As far as my local machine goes, the package fixes the issue.

Thanks for testing, Leo. Marked the bug as "verification-done".

tags: added: verification-done
removed: verification-needed
Leo Milano (lmilano) wrote :

Thank you, Till, I was looking for the proper place to change the tag :)

Cheers,
Leo

Now that the verification is done, when can we expect an update in Vivid? I need to print something by Saturday and I would rather wait for the update than get my system off the official repos. If needed, I can do more verification, but I like to keep my system as close to virgin packages as possible.

I don't know much about the Ubuntu release process, but it looks like this fix will be coming within the next few hours/days. Is that right?

Thanks,

Mike

Keep the proposed package which you have installed for verification installed, but turn off the -proposed repository again, so that further system updates do not install the proposed packages of other bugs. The plug-in is already installed during your verification test, so your printer should now simply work.

Chris Hermansen (c-hermansen) wrote :

Thanks to all for getting this patch in place.

The bug appears to be resolved.

A few comments:

I installed hplip-3.15.4.run as per the conversation above with TomasHynk. When this fix was released, I wanted to uninstall what hplip-3.15.4 installed and revert to the standard Ubuntu stack.

This http://hplipopensource.com/node/188 explains how to uninstall.

I followed it exactly and then reinstalled hplip via synaptic. However it seems that the files in /usr/share/hplip and /etc/hp were removed by the uninstall process given above and not re-installed by synaptic.

So I reinstalled hplip-3.15.4, made sure everything was working, then deleted my two printers, uninstalled it again as per the instructions above EXCEPT I did not do the sudo rm's, and then installed hplip via apt-get. But hp-setup does report that it is ver. 3.15.2 so I am most of the way there.

As I said, things now seem to be working, though I'm not completely convinced I have fully reverted!

Thanks again to Till and others who got the show back on the road.

I haven't tweaked my repos at all, but I'm not getting the updated paackage:

(sudo apt-get update trimmed for brevity.)

09:31:10::mlissner@pounamu::~/Programming/intellij/courtlistener
↪ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  libyelp0 yelp
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
09:31:15::mlissner@pounamu::~/Programming/intellij/courtlistener
↪ sudo hp-setup

HP Linux Imaging and Printing System (ver. 3.15.2)
Printer/Fax Setup Utility ver. 9.0

Copyright (c) 2001-15 Hewlett-Packard Development Company, LP
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to distribute it
under certain conditions. See COPYING file for more details.

Searching... (bus=usb, search=(None), desc=0)
error: The printer you are trying to setup requires a binary driver plug-in and it failed to install. Please check your internet connection and try again. Visit http://hplipopensource.com for more infomation.

Done.
09:31:48::mlissner@pounamu::~/Programming/intellij/courtlistener
↪ dpkg -l hplip
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==========================================-==========================-==========================-=========================================================================================
ii hplip 3.15.2-0ubuntu4 amd64 HP Linux Printing and Imaging System (HPLIP)

Again, I haven't tweaked the repos and this is a fresh(ish) install of Vivid.

Thanks.

mlissner, you need to enable the "proposed" repo as described in comment #33, otherwise you will not get the fixed package.

Ah, thanks very much, I didn't catch that. Will the fix come to the regular repo eventually or is this the only way to get a fix?

I'm interpreting "proposed" to mean that once it's verified we can expect it to go out to everybody?

It will get into the standard repositories so that everyone gets it with the daily updates. The fix is already verified (see the "verification-done" under the tags. Once verified it gets promoted to the standard repository one week until it got into proposed, so that there is also time for users who test it to find a possible regression. If no regression occurs, it gets available for everyone. But get it from prposed to help testing and to get your printer working now.

Thanks for the explanation. Totally makes sense now. I'll try to find some time to check it out.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package hplip - 3.15.2-0ubuntu4.1

---------------
hplip (3.15.2-0ubuntu4.1) vivid-proposed; urgency=low

  * debian/patches/hp-plugin-download-fix.patch: Fix download and installation
    of HP's proprietary plug-in in Python3 environments (LP: #1422004).

 -- Till Kamppeter <email address hidden> Wed, 6 May 2015 16:50:00 -0300

Changed in hplip (Ubuntu Vivid):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for hplip 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.

Shahar Or (mightyiam) wrote :

Thank you very much!

Changed in hplip:
importance: Undecided → High
Changed in hplip (Ubuntu):
milestone: vivid-updates → none
pa (vorobjevpavel) wrote :

% uname -a
Linux pa 4.2.0-0.bpo.1-amd64 #1 SMP Debian 4.2.6-1~bpo8+1 (2015-11-18) x86_64 GNU/Linux

% hp-plugin

HP Linux Imaging and Printing System (ver. 3.15.11)
Plugin Download and Install Utility ver. 2.1

***

HP Linux Imaging and Printing System (ver. 3.15.11)
Plugin Download and Install Utility ver. 2.1

***

Downloading plug-in from: file:///home/pa/1/hplip-3.15.11-plugin.run
\Download in progress.......100%Download in progress.......100%Receiving digital keys: /usr/bin/gpg --homedir /home/pa/.hplip/.gnupg --no-permission-warning --keyserver pgp.mit.edu --recv-keys 0x4ABA2F66DBD5A95894910E0673D770CDA59047B9
Creating directory plugin_tmp
Verifying archive integrity... All good.
Uncompressing HPLIP 3.15.11 Plugin Self Extracting Archive................................................

HP Linux Imaging and Printing System (ver. 3.15.11)
Plugin Installer ver. 3.0

***

Plug-in version: 3.15.11
Installed HPLIP version: 3.15.11
Number of files to install: 42

>>> waiting for a long time <<<

\^CTraceback (most recent call last):
  File "./plugin_install.py", line 249, in <module>
    ok = installPlugin()
  File "./plugin_install.py", line 56, in installPlugin
    status, output = utils.run(cmd, passwordObj)
  File "/usr/share/hplip/base/utils.py", line 1275, in run
    i = child.expect(EXPECT_LIST)
  File "/usr/share/hplip/base/pexpect/__init__.py", line 1418, in expect
    timeout, searchwindowsize)
  File "/usr/share/hplip/base/pexpect/__init__.py", line 1433, in expect_list
    timeout, searchwindowsize)
  File "/usr/share/hplip/base/pexpect/__init__.py", line 1502, in expect_loop
    c = self.read_nonblocking(self.maxread, timeout)
  File "/usr/share/hplip/base/pexpect/__init__.py", line 901, in read_nonblocking
    r, w, e = self.__select([self.child_fd], [], [], timeout)
  File "/usr/share/hplip/base/pexpect/__init__.py", line 1687, in __select
    return select.select(iwtd, owtd, ewtd, timeout)
KeyboardInterrupt
error: Python gobject/dbus may be not installed
error: Plug-in install failed.

# dpkg -l | grep python-gobj
ii python-gobject 3.14.0-1 all Python 2.x bindings for GObject - transitional package
ii python-gobject-2 2.28.6-12+b1 amd64 deprecated static Python bindings for the GObject library

# dpkg -l | grep python-dbus
ii python-dbus 1.2.0-2+b3 amd64 simple interprocess messaging system (Python interface)
ii python-dbus-dev 1.2.0-2 all main loop integration development files for python-dbus

MP (monkeech) wrote :

Same Problem as pa (vorobjevpavel)

Hangs forever at:

Plug-in version: 3.15.11
Installed HPLIP version: 3.15.11
Number of files to install: 42

pa (vorobjevpavel) wrote :

2 MP (monkeech)

solution https://bugzilla.redhat.com/show_bug.cgi?id=1249414#c9

> remove or comment out lines 42-44.

#if os.geteuid() == 0:
# print("hp-plugin should not be run as root/superuser. Exiting.")
# sys.exit(1)

Marcos Alves (marconian-gmail) wrote :

Thanks. The solution worked for me too!

This is no solution as these lines are commented out in 3.19.6 already. Downloading firmware doesn't succeed:
Unable to communicate with device or device is in an error state.

Nathan Wallach (taniwallach) wrote :

The thread at https://bugs.launchpad.net/ubuntu/+source/hplip/+bug/1430561? is quite active in 2019, due to possibly unrelated issue. In any case, I managed to get firmware to load and scanning to work in Debian 10, and what I did is listed at : https://bugs.launchpad.net/ubuntu/+source/hplip/+bug/1430561/comments/39

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

Other bug subscribers

Remote bug watches

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