Automatic plug-in installation not working under Ubuntu

Bug #913730 reported by Till Kamppeter
26
This bug affects 4 people
Affects Status Importance Assigned to Milestone
HPLIP
Invalid
Undecided
Unassigned
hplip (Ubuntu)
Triaged
Medium
Unassigned
policykit (Ubuntu)
Confirmed
Medium
Unassigned

Bug Description

I have packaged HPLIP 3.11.12 for Ubuntu Precise (12.04) and I have also backported this package to Oneiric (11.10, package in my PPA: https://launchpad.net/~till-kamppeter/+archive/ppa).

With the binary package hplip-gui and all its dependencies installed the plug-in should be downloaded and installed automatically if a printer gets connected which requires the plug-in, via the newly added feature of HPLIP 3.11.12.

It seems that when hp-systray calls hp-plugin, hp-plugin gets run as normal user (not as root) and then it is not able to install the files of the plug-in in subdirectories of /usr/share/hplip and /etc where only root has write access.

What needs to be done here is to use PolicyKit or tools like gksudo. Is such a thing actually used?

Revision history for this message
Amarnath Chitumalla (amarnath-chitumalla) wrote :

Hi Till,

Thank you for the information. For plug-in printers, when non-root user connects the printer using USB, he/she will be prompted for password.

As you mentioned, when non-root user plugs-in the printer, script checks whether plug-in is already installed or not.
if not installed, hp-systray calls "hp-diagnose_plugin". On clicking "Next" button, this hp-diagnose_plugin tool prompt for password using tools like policykit or gksudo, kdesu, gksu.

 This new feature is not be supported for qt3.(supports only for qt4).

Please let us know more details on this problem.

Thanks & Regards,
Amarnath

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

Under Oneiric, clicking "Next" starts hp-plugin as normal user, using the command line

/usr/bin/hp-plugin -u --required --reason 0 To_install_plugin_for_HP_Device

What happens is that the plugin seems to get downloaded to somewhere (writable for normal user) as some time passes by after the first screen. After that the license text appears and when accepting it, immediately the first screen appears again with a pop-up error message "Plug-in install failed.".

Revision history for this message
Amarnath Chitumalla (amarnath-chitumalla) wrote :

Hi Till,

Please can you provide the log file by running hp-diagnose_plugin in debug mode.

$ hp-diagnose_plugin -g &> hp-diagnose_plugin.log

Thanks & Regards,
Amarnath

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

Log file attached.

Revision history for this message
Antonio Sánchez (ingantosan) wrote :

I think I have this problem too, using Kubuntu 11.10, reported here:

https://bugs.launchpad.net/ubuntu/+source/cups/+bug/883585/comments/39

And solved by Till:

https://bugs.launchpad.net/ubuntu/+source/cups/+bug/883585/comments/43

I guess the fix of this issue will also cover 11.10.

Thank you!

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

Antonio, note that the bug reported by me here is that HPLIP 3.11.12 has an automatic plugin install feature but hp-plugin fails when called by this feature. The problem you reported on Kubuntu 11.10 (which uses an older HPLIP) is that there is no automatic download of the plugin and the user has to run hp-plugin manually.

Revision history for this message
Amarnath Chitumalla (amarnath-chitumalla) wrote :

Hi Till,

Thank you for providing the log file. This auto plugin download is failing, if HPLIP is installed with policykit as enabled on Ubuntu 11.10, due to following policy kit error .
"org.freedesktop.PolicyKit1.Error.Failed: Error getting subject: Error parsing unix-process subject: Didn't find value for key `start-time' of type t".

If HPLIP installed with policykit enable option, hp-setup is also failing for plugin based printer.
If Policykit is disabled, plugin installation and all other are working fine.

Note:- HPLIP with policykit as enabled is working properly on Ubuntu 10.10.

Procedure to check the exact issue:-
1) download hplip-3.11.12-plugin.run file.
2) run 'sh hplip-3.11.12-plugin.run --keep'
3) goto plugin_tmp folder
4)run 'sh hplip-plugin-install -g' command. This command is failing with policykit error.

Please install HPLIP by disabling policykit.

Thanks & Regards,
Amarnath

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

Amarnath. is this a bug in the PolicyKit package of Ubuntu Oneiric and Precise?

Ho do I disable PolicyKit in HPLIP? Is this a ./configure option? Or can I disable it at run time by modifying some config file.

Revision history for this message
Amarnath Chitumalla (amarnath-chitumalla) wrote :

Hi Till,

I think this is PolicyKit bug in Ubuntu Oneiric and Precise.

During HPLIP installation, PolicyKit option will be disabled by default. This is configure option.

To disable PolicyKit
1) go to hplip-3.11.12 folder.
2) ./configure --prefix=/usr
3) make
4) sudo make install

 To enable PolicyKit
1) go to hplip-3.11.12 folder.
2) ./configure --enable-policykit --prefix=/usr
3) make
4) sudo make install

Thanks & Regards,
Amarnath

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

Thank you.

I have added tasks for the Ubuntu packages of PolicyKit and HPLIP now. What needs to be done is either fix PolicyKit (the better solution) or package HPLIP with PolicyKit disabled.

Changed in hplip:
status: New → Invalid
Changed in hplip (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Changed in policykit (Ubuntu):
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Antonio Sánchez (ingantosan) wrote :
Revision history for this message
Marcelo Fernandez (fernandezm) wrote :

Hello,

Because of this bug in 12.04, I've installed hplip 3.12.4 from the .run file (the project says it now supports Ubuntu 12.04), and when compiling it is configured with this flags:

BUILD AND INSTALL
-----------------
Running './configure --with-hpppddir=/usr/share/ppd/HP --libdir=/usr/lib --prefix=/usr --enable-udev-acl-rules --enable-qt4 --enable-doc-build --disable-cups-ppd-install --disable-foomatic-drv-install --disable-foomatic-ppd-install --disable-hpijs-install --disable-policykit --enable-cups-drv-install --enable-hpcups-install --enable-network-build --enable-dbus-build --enable-scan-build --enable-fax-build'

Note the "--disable-policykit" option.

Regards

Revision history for this message
srinivas (nsrinivas89) wrote :

hi,

I today upgraded to ubuntu 12.10 and I am trying to install my hp printer and getting the same problem as Amarnath explained on 2012-01-10.

I have run the command : $ hp-diagnose_plugin -g &> hp-diagnose_plugin.log
 and the log : please find a solution for this asap!

Revision history for this message
srinivas (nsrinivas89) wrote :

Also let me know hot fix this error :

nsrinivas89@nsrinivas89-Compaq-Presario-C700-Notebook-PC:~/hplip-3.12.11$ system-config-printer
Fontconfig warning: "/etc/fonts/conf.d/65-ttf-droid-sans-fonts.conf", line 61: Having multiple values in <test> isn't supported and may not works as expected
Fontconfig warning: "/etc/fonts/conf.d/65-ttf-droid-sans-fonts.conf", line 96: Having multiple values in <test> isn't supported and may not works as expected
nsrinivas89@nsrinivas89-Compaq-Presario-C700-Notebook-PC:~/hplip-3.12.11$

Revision history for this message
Amarnath Chitumalla (amarnath-chitumalla) wrote :

Hi Srinivas,

HPLIP 3.12.11 package's (/usr/share/hplip/base/utils.py) file doesn't contains "elif utils.which('/usr/lib/kde4/libexec/kdesu'):" statement.

Please let us know, is it downloaded from "http://hplipopensource.com/hplip-web/index.html" site or HPLIP installed from repository?

You can quick fix it by making followng changes?
1) open /usr/share/hplip/base/utils.py file in root mode.
--> search for "utils." and remove this "utils." occurrences from this file.
2) Now run plugin command in root mode (su or sudo)
$ sudo hp-plugin or su - -c "hp-plugin"

(or)
You can install hplip-3.12.11 from http://hplipopensource.com/hplip-web/index.html site.

Thanks & Regards,
Amarnath

Revision history for this message
srinivas (nsrinivas89) wrote :

hi Amarnath,

Thanks for the prompt response, I had downloded the HPLIP from the "http://hplipopensource.com/hplip-web/index.html" site.

But, I am not able to find any reference to 'utils.' in the whole file. I think something is seriously wrong with my setup. I am attaching the file for your reference.

Please advice me on what to do next ?

Revision history for this message
Amarnath Chitumalla (amarnath-chitumalla) wrote :

Hi Srinivas,

Above attached log in #13 contains following information (see at end):-
----------------------------------------------
[34;01mhp-diagnose_plugin[3027]: debug: Starting GUI loop...
Traceback (most recent call last):
  File "/usr/share/hplip/ui4/plugindiagnose.py", line 101, in NextButton_clicked
    ok, sudo_ok = pkit.run_plugin_command(plugin == PLUGIN_REQUIRED, plugin_reason)
  File "/usr/share/hplip/base/pkit.py", line 472, in run_plugin_command
    su_sudo = utils.su_sudo()
  File "/usr/share/hplip/base/utils.py", line 1782, in su_sudo
    elif utils.which('/usr/lib/kde4/libexec/kdesu'):
NameError: global name 'utils' is not defined

Done.
-----------------------------------------------

According to this, "/usr/share/hplip/base/utils.py" file may contains "utils." at line no. 1782.

I think, please do fresh installation from "http://hplipopensource.com/hplip-web/install.html". If your distro is Ubuntu, suse, debian, linux mint or fedora, then follow Auto Installation (http://hplipopensource.com/hplip-web/install/install/index.html)

Otherwise go for Manual Installation.
Details installation steps given in this site.

Thanks & Regards,
Amarnath

Revision history for this message
srinivas (nsrinivas89) wrote :

thanks... a fresh manual installation worked!

Revision history for this message
Caysho (caysho) wrote :

I just had the same problem on a default Ubuntu 13.10 install.
I have an HP LaserJet P1102 that worked on Ubuntu 12.10.

On 13.10 the test page would print but no applications would print. The job would be stuck in the queue.

After unplugging and plugging the printer a few times with no success, I ran a tail on syslog while I plugged it in again.
See attached 1-printer_syslog.txt

Searching on /var/lib/hp/hplip.state I found bug 1018303. The directory already existed, so I tried running hp-plugin as root and accepted the driver license. The printer now works.

What is the reason for this change ?

Revision history for this message
David Giard (swe3tdave-deactivatedaccount) wrote :

This bug is old so lets renew this a bit with my experience on Ubuntu Mate 16.04... I have a HP LaserJet P1102w

Installation detected the printer on the network and everything seemed fine until i tried printing, it did not work.

i new i needed to run hp-plugin at this point but there was no information or any specific error pointing me to it. Running hp-plugin failed with it complaining about a missing gui library of some kind. After installing hplip-gui, running hp-plugin as a normal user went smootly. It asked for my password and installed fine. The printer was working after that.

There is a feature request for the missing hplip-gui...

https://bugs.launchpad.net/ubuntu/+source/ubuntu-meta/+bug/802304

Sorry not sure if i should close this bug or not...

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.