Bug 1922 - hplip can't add printer automatically
: hplip can't add printer automatically
Status: RESOLVED WORKSFORME
Product: Desktop Bugs
Classification: ROSA Desktop
Component: Main Packages
: Fresh
: All Linux
: Normal normal
: ---
Assigned To: ROSA Linux Bugs
: ROSA Linux Bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-04-13 21:13 MSD by MikhailZ
Modified: 2013-09-17 12:03 MSD (History)
3 users (show)

See Also:
RPM Package:
ISO-related:
Bad POT generating:
Upstream:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description MikhailZ 2013-04-13 21:13:56 MSD
Description of problem:
when plug printer HP Deskjet 2050A at first time (I work allways in live mode)
system doesnt detect printer automatically. Manual installation works fine.
In 2012lts printer are detecting automatically in live mode.

1. When discovering bug I found hp-config_usb_printer  doesnt start hp-setup
I changed string in hp-config_usb_printer, replace "hp-setup" by "python /usr/share/hplip/setup.py". setup.py starts working

2. So /usr/share/hplip/setup.py were started and I collected some debug messages.
Last executed command in setup.py were "ppds = cups.getSystemPPDs()" from module prnt/cups.py   

3. Next file were prnt/cups.py
After debug string "(CUPS 1.2.x) Getting list of PPDs using CUPS_GET_PPDS..."  follows "ppd_dict = cupsext.getPPDList()" which were last executed.

4. cups.py does not import cupsext module. I found library /usr/lib/python2.7/site-packages/cupsext.so from package hplip. But I can't debug that.

I dont understand why console commands "hp-setup -i -x -a -q 008:008" automatically setup my printer but the same command does'nt work from systemd service (configure-printer.service).

Can you help me? I have no ideas what to do to find a bug...
Comment 1 Aleksandr Kazantcev 2013-04-13 22:47:25 MSD
As i think i droped automate printer detect via udev/systemd problem
Comment 2 MikhailZ 2013-04-14 09:40:27 MSD
I taked /lib/udev/rules.d/70-printers.rules from 2012lts (which have not systemd deps). When I placed it to Fresh, the result was the same. So systemd are not releted.
Comment 3 MikhailZ 2013-04-14 10:10:48 MSD
I tried to downgrade to python and hplip packages from 2012lts. Nothing are changed.
I dont know were to dig :-(
Comment 4 MikhailZ 2013-04-14 13:01:02 MSD
It may related to consolehelper.
I found link /usr/bin/hp-setup on consolehelper.
Launching via /usr/bin/hp-setup does not starts hp-setup
When launching /usr/sbin/hp-setup all over on cupsext.so
Comment 5 Aleksandr Kazantcev 2013-04-14 14:50:59 MSD
We change consolehelper - i fix hp-lip soon via using right rules. Will we need run it without root password?
Comment 6 Aleksandr Kazantcev 2013-04-14 19:05:26 MSD
Try this package:

https://abf.rosalinux.ru/build_lists/1054533
https://abf.rosalinux.ru/build_lists/1054534

They need root password for run hp-setup
Comment 7 MikhailZ 2013-04-14 20:34:37 MSD
Thanks!

I installed this packages.
config_usb_printer.py now succesfully launch /usr/sbin/hp-setup via consolehelper

But process still fail when using cupsext.so.

So bug are not solved. :-(
Comment 8 MikhailZ 2013-04-14 20:48:22 MSD
Strange.
1. I rename /usr/sbin/hp-setup to hp-setup_orig
2. make executable text file /usr/sbin/hp-setup 
#!/bin/bash
ARG="$@"
su -l -c "/usr/sbin/hp-setup_orig $ARG" >/log 2>&1

It works!!!

M3-desk sbin # lpstat -v
device for Deskjet_2050_J510: hp:/usb/Deskjet_2050_J510_series?serial=CN17B1D5HV05QV


Can anybody explain this?
Comment 9 Aleksandr Kazantcev 2013-04-14 20:57:44 MSD
Try replace in /etc/pamd/hp-setup all config-util to config-util-user

This will grant run hp-setup without root password but with root permission.
Comment 10 Aleksandr Kazantcev 2013-04-14 21:11:32 MSD
And may we need use as in Fedora and Suse way?

Move hp-setup from /usr/sbin to /usr/bin and delete symlink for consolehelper (and rules from /etc/pam.d and /etc/security/console.apps/)

I don't know why this done in Mandriva.
Comment 11 MikhailZ 2013-04-14 22:25:51 MSD
>Move hp-setup from /usr/sbin to /usr/bin and delete symlink for consolehelper (and rules from /etc/pam.d and /etc/security/console.apps/)
It does'nt fix the problem.

Only script helps me. Second edition of /usr/bin/hp-setup:
#!/bin/bash
ARG="$@"
su -c "/usr/share/hplip/setup.py $ARG" >/dev/null 2>/dev/null

Both "su -c" and ">... 2>..."  are needed or its not works.

May be hp-setup color output breaks process? May be at this case some ENV vars are needed to disable hp-setup output control codes?
Comment 12 MikhailZ 2013-04-14 22:26:54 MSD
>Only script helps me. Second edition of /usr/bin/hp-setup:
I'm sorry, /usr/sbin/hp-setup
Comment 13 Aleksandr Kazantcev 2013-04-14 23:08:56 MSD
After investigated hp-setup one strange present - cups running with init.d instead systemd. May be we has error with older implimentation.

May you try Mageia package? (I did not have hp printer for test :( )
Comment 15 Aleksandr Kazantcev 2013-04-15 12:37:01 MSD
Please try newest fix package. Changelog

1. Add new patches from Mageia
2. Drop policykit (like in Fedora and Suse)
3. Add hpjs driver
4. Move udev rules to /lib/udev/rules.d
5. Fix systemd and tmp part in package

https://abf.rosalinux.ru/build_lists/1054622
https://abf.rosalinux.ru/build_lists/1054623
Comment 16 MikhailZ 2013-04-15 17:53:44 MSD
>Please try newest fix package. Changelog
No, it has same result as initial rpms :-(
Comment 17 Aleksandr Kazantcev 2013-04-15 17:57:27 MSD
If in hp-config_usb_printer call /usr/bin/hp-setup ?
Comment 18 MikhailZ 2013-04-15 18:58:12 MSD
>If in hp-config_usb_printer call /usr/bin/hp-setup ?
Normally, I dont see that. Only this
---
Apr 15 18:44:47 localhost hp-config_usb_printer: hp-config_usb_printer[11340]: warning: Failed to change log file permissions: /bin/chmod: cannot access '/var/lo
g/hp/hplip_config_usb_printer.log': No such file or directory
Apr 15 18:44:48 localhost hp-config_usb_printer: hp-config_usb_printer[11340]: warning: Failed to change log file group permissions: /bin/chgrp: cannot access '/
var/log/hp/hplip_config_usb_printer.log': No such file or directory
---
This errors are not critical, mkdir /var/log/hp don't fix problem.

Usually I have to modify scripts to see logs

Then I put my script /usr/bin/hp-setup over newest rpms and turn on printer, I collect logs (So, /usr/bin/hp-setup are being running).
But then my system goes down :-(

At the second time I catch logs 
---
Apr 15 18:44:49 localhost systemd-logind[8685]: New session c2 of user root.
Apr 15 18:44:49 localhost su: (to root) root on none
Apr 15 18:44:49 localhost systemd-logind[8685]: New session c3 of user root.
Apr 15 18:44:49 localhost su: (to root) root on none
Apr 15 18:44:49 localhost systemd-logind[8685]: New session c4 of user root.
Apr 15 18:44:49 localhost su: (to root) root on none
Apr 15 18:44:49 localhost systemd-logind[8685]: New session c5 of user root.
Apr 15 18:44:49 localhost su: (to root) root on none
Apr 15 18:44:49 localhost systemd-logind[8685]: New session c6 of user root.
....
---
I killall su before it captures my computer,our internet and universal.
Comment 19 MikhailZ 2013-04-15 19:04:44 MSD
(So, /usr/bin/hp-setup are being running).
Im sorry again. I tried to write /usr/sbin/hp-setup
Comment 20 MikhailZ 2013-04-15 19:18:48 MSD
Im sorry. Im slightly tired.
I clean my system from my patches reinstall rpms and will try again
Comment 21 MikhailZ 2013-04-15 20:45:05 MSD
>If in hp-config_usb_printer call /usr/bin/hp-setup ?
Yes. It launch /usr/sbin/hp-setup
Last log is "(CUPS 1.2.x) Getting list of PPDs using CUPS_GET_PPDS..."
Comment 22 Aleksandr Kazantcev 2013-04-15 21:33:19 MSD
Is hp-setup runned from CLI work OK?

For me with latest package update it need hplip-gui package installed, than did not present in ISO (i fix this and add hplip-gui as requires, not suggests dependens.
Comment 23 MikhailZ 2013-04-15 22:42:23 MSD
>Is hp-setup runned from CLI work OK?
Yes. It works very well. hp-setup -i -x -a -q 00x:0yy  setup my printer automatically.

When launching by sytemd/udev hp-setup fails on string cupsext.getPPDList()
I dont know python language. I found strange thing for me. 
cups.py launching cupsext.getPPDList() but dont import cupsext!
I tried to add string "import cupsext" but it dont change anything.
May it breaks scripts?

I made test file  
---
import sys
ppd_dict = cupsext.getPPDList()
---
it does not work
M3-desk prnt # python 1.py 
Traceback (most recent call last):
  File "1.py", line 2, in <module>
    ppd_dict = cupsext.getPPDList()
NameError: name 'cupsext' is not defined

Then I made second file
---
import sys
import cupsext
ppd_dict = cupsext.getPPDList()
---
It works.
M3-desk prnt # python 2.py 
M3-desk prnt #
Comment 24 MikhailZ 2013-04-15 23:18:05 MSD
>cups.py launching cupsext.getPPDList() but dont import cupsext!
No, it imports cupsext. But it's not usually.
Comment 25 MikhailZ 2013-04-16 20:57:14 MSD
I looked at cupsext sources. First of all it make http connections 
---
if ( ( http = httpConnectEncrypt( cupsServer(), ippPort(), cupsEncryption() ) ) == NULL )
    {
        goto abort;
    }
---
When using hp-setup from CLI cups writes log about connection.
In case udev/systemd logs are clean.

May systemd block network connection to localhost:631 ?
Comment 26 Andrey Bondrov 2013-04-18 10:13:43 MSD
Please do something with this package ASAP. I need to update python-sip and rebuild packages that depend on it:

hplip
luma
mdvvhdprovgui
picard
python-qt
python-qt4
python-sip
qgis-python
qt-recordmydesktop
smolt
subdownloader
Comment 27 Denis Silakov 2013-08-26 15:04:26 MSD
So what is the status of this issue atm? In any case, please check updated hplip package from here:

https://abf.rosalinux.ru/build_lists/1220389
https://abf.rosalinux.ru/build_lists/1220390
Comment 28 Denis Silakov 2013-09-17 12:03:11 MSD
Well, closing this one as "works for me". At least hp-setup is now correctly configured using pam to request root password.

Feel free to reopen the bug or create a new one if you still experience some problems.