Bug 727911

Summary: cups: "lpinfo -m" may fail with "lpinfo: Unknown" or "lpinfo: Success" (but some time later it works)
Product: [openSUSE] openSUSE 12.1 Reporter: Jean-Daniel Dodin <jdd>
Component: PrintingAssignee: Johannes Meixner <jsmeix>
Status: VERIFIED UPSTREAM QA Contact: Johannes Meixner <jsmeix>
Severity: Normal    
Priority: P3 - Medium CC: auxsvr, axel.braun, bg, forgotten_1m0ETF1Sqf, forgotten_gp-dpinp5x, forgotten_JtaKqlU8J9, hugo.costelha, jdd, joerg, jsmeix, novell.admin, pier_andreit, s.mroczek, stakanov, terjejhanssen
Version: Factory   
Target Milestone: ---   
Hardware: All   
OS: openSUSE 12.1   
Whiteboard:
Found By: Community User Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: yast2 logs

Description Jean-Daniel Dodin 2011-11-02 21:52:50 UTC
User-Agent:       Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20100101 Firefox/7.0.1

I have only network printer - when installing it yast do detect it due to the firewall.

but then yast do not find either any ppd file.

When instructed to look at the IP, yast find the printer (hp), but do not either find any driver. Hplip have the same problem

However, cups at port 631 *do* find the drivers and install the printer. After that yast find all the drivers (I could change the printer driver with yast)

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Comment 1 Jean-Daniel Dodin 2011-11-02 22:11:21 UTC
looks like I can't upload attachements - will try tomorrow (yast2 logs)
Comment 2 Johannes Meixner 2011-11-03 08:22:59 UTC
http://en.opensuse.org/SDB:How_to_Report_a_Printing_Issue
Comment 3 Johannes Meixner 2011-11-03 08:33:41 UTC
yast2-printer works in "Strict Compliance With CUPS", see
http://en.opensuse.org/Archive:YaST_Printer_redesign

YaST shows the printer devices that "lpinfo -l -v" autodetects via
/usr/lib/YaST2/bin/autodetect_printers
and YST shows the PPDs that "lpinfo -l -m" finds via
/usr/lib/YaST2/bin/create_printer_ppd_database

You can run both scripts as root to verify what YaST gets.
Comment 4 Jean-Daniel Dodin 2011-11-03 11:39:46 UTC
Created attachment 460183 [details]
yast2 logs

yast2 logs
Comment 5 Jean-Daniel Dodin 2011-11-03 11:40:16 UTC
well... no.

first your modification of the subject is wrong. I could run Yast several times (and did) without it finding any ppd file. YaST could find the drivrs only after using cups, and cups found them at the first time.

and, of course, now yast find all the drivers... this have nothing to do neither with the printer (yast, initially found no driver at all)

I attach yast2logs, in hope you can find what happened at first :-(
Comment 6 Johannes Meixner 2011-11-03 13:55:07 UTC
Your y2log contains two times:
--------------------------------------------------------------------
2011-11-02 16:43:52 <1> linux-zz28(9375) [YCP]
 Printerlib.ycp:66 Executing bash commandline:
 /usr/lib/YaST2/bin/create_printer_ppd_database
 >/var/lib/YaST2/printer_ppd_database.ycp
2011-11-02 16:44:22 <3> linux-zz28(9375) [bash]
 ShellCommand.cc(shellcommand):78 lpinfo: Unknown
...
2011-11-02 18:42:59 <1> linux-zz28(6238) [YCP]
 Printerlib.ycp:66 Executing bash commandline:
 /usr/lib/YaST2/bin/create_printer_ppd_database
 >/var/lib/YaST2/printer_ppd_database.ycp
2011-11-02 18:43:29 <3> linux-zz28(6238) [bash]
 ShellCommand.cc(shellcommand):78 lpinfo: Unknown
--------------------------------------------------------------------

I have no idea what
  ShellCommand.cc(shellcommand):78 lpinfo: Unknown
means.

It looks like a crippled error message.

For some reason YaST cannot run
  /usr/lib/YaST2/bin/create_printer_ppd_database
correctly but later it can run it and then
yast2-printer gets its PPDs.

In the YaST sources there exists
  core/agent-system/src/ShellCommand.cc
which contains
  "Author: Michal Svec <msvec@suse.cz>"

I set needinfo from the ShellCommand.cc Author
so that he could provide some information what
  ShellCommand.cc(shellcommand):78 lpinfo: Unknown
actually means.
Comment 7 Jörg Lesniak 2011-11-24 09:59:57 UTC
Hi!

I can commit this issue.

I posted my effecte here:

http://forums.opensuse.org/english/get-technical-help-here/hardware/468538-opensuse-12-1-yast-doesnt-show-any-printer-driver-bug.html

It seems that Yast does not find ppd infos/files the first time when it was called. After setting up a printer via cups, the yast printer setup works as known from former opensuse distros!

Regards 
Nukem36
Comment 8 Johannes Meixner 2011-11-25 12:15:43 UTC
I get it now on a new from scratch installed openSUSE 12.1
when I switch directly after the installation finished
to a system text console and there run as root:

# rccups status
redirecting to systemctl
cups.service - LSB: CUPS printer daemon
Loaded: loaded (/etc/init.d/cups)
Active: active (exited) since Fri, 25 Nov 2011 12:51:41 +0100; 15min ago
Process: 10493 ExecStart=/etc/init.d/cups start (code=exited, status=0/SUCCESS)
CGroup: name=systemd:/system/cups.service

# lpinfo -m
lpinfo: Unknown

#echo $?
1

Therefore this is not an issue in YaST because it is "lpinfo" itself
which returns with "lpinfo: Unknown" and non-zero exit code.

After a few minutes waiting "lpinfo -m" works.

In the CUPS 1.5.0 sources in systemv/lpinfo.c there is a few times
---------------------------------------------------------------------
    _cupsLangPrintf(stderr, "lpinfo: %s", cupsLastErrorString());
...
    return (1);
---------------------------------------------------------------------

Currently I don't know the root cause that lets lpinfo
initially fail with "lpinfo: Unknown".
Comment 9 Thomas Göttlicher 2011-12-13 10:30:44 UTC
*** Bug 734129 has been marked as a duplicate of this bug. ***
Comment 10 Johannes Meixner 2011-12-15 11:29:09 UTC
*** Bug 736963 has been marked as a duplicate of this bug. ***
Comment 11 Hugo Costelha 2012-01-13 17:28:38 UTC
I am using a laptop, thus just printing to remote printers. Although I can find the printer (samba), I am unable to add it because it cannot find any drivers.

Any suggestion on what can I do in order to be able to print anything?
Comment 12 Hugo Costelha 2012-01-18 15:56:13 UTC
After removing the package "manufacturer-PPDs" I was able to use YaST to configure the printer.
Comment 13 Johannes Meixner 2012-02-24 11:08:29 UTC
*** Bug 748835 has been marked as a duplicate of this bug. ***
Comment 14 Forgotten User gp-dpinp5x 2012-03-06 08:27:35 UTC
I believe I have been experiencing this since 11.2.

The first time I configure a printer, YaST2 can't find any printer drivers, even when attempting to list them all.

Then, after manually supplying a PPD file from /usr/share/cups/model/ , it finds lots of printer drivers. The problem is fixed from now on.

I have reproduced it under 12.1 x86-64, on one system using USB printing, and on another using IP printing. Both with the same printer, a Lexmark T522.

PS please include a driver for the T522. I use the one for Lexmark Optra T610 and it seems to work okay. It would be more reassuring if the T522 were listed explicitly.
Comment 15 Johannes Meixner 2012-03-06 09:40:32 UTC
I am afraid, I cannot debug it.

I guess it is somewhere a timeout (perhaps related to cups-driverd)
that lets "lpinfo -m" initially fail with "lpinfo: Unknown".

I geuss that once after /var/cache/cups/ppds.dat exists
(initially it does not exist and it needs time to build it)
it is sufficiently fast so that the timeout does no longer happen.

I guess it does not matter whatever one does (launch another
printer setup tool, provide a PPD file manualle, whatever else...),
I guess all what meatters is to wait some time.

I cannot reproduce it
neither with
# rm /var/cache/cups/ppds.dat ; time lpinfo -m | grep -v ppd
nor with
# rccups stop ; rm /var/cache/cups/ppds.dat ; \
  rccups start ; sleep 1 ; time lpinfo -m | grep -v ppd
On my 3GHz 500MB i586 workstation the needed time
is always about 7 seconds.
On my 2GHz 4GB x86_64 workstation the needed time
is always about 3 seconds.

If I could reproduce the issue or if the error message
was a tiny bit more informative than "Unknown"...
Comment 16 Johannes Meixner 2012-03-06 10:53:51 UTC
After invalidating the file caches in memory
it needs much more time but it still works for me:

# sync ; sleep 10 ; sync ; echo 3 >/proc/sys/vm/drop_caches ; \
  rm /var/cache/cups/ppds.dat ; \
  time lpinfo -m 1>/dev/null && echo OK || echo FAIL

On my 3GHz 500MB i586 workstation the needed time
is now about 50 seconds.

On my 2GHz 4GB x86_64 workstation the needed time
is now about 40 seconds.
Comment 17 Forgotten User gp-dpinp5x 2012-03-06 13:46:04 UTC
I am running a 4 GHz quad core Phenom II with 8 GB of RAM.. and if this really is the explanation, then it's slow enough that the user needs some feedback to stop them from giving up and/or snapping their SUSE install disc and binning it.

It could be as simple as the Microsoft flashlight scanning from side to side - anything to indicate that it's still busy. Simply reporting that there are no drivers is cause for aggravation. You can't save a partial config with no driver and come back to it, so after all this effort to configure the printer you don't want to give up, but it seems like you have to.

I usually run the package manager at this point (without closing the printer configurator) and try to figure out what I'm missing, and then I see that I have all of the relevant packages. I check where the files are installed, because I will need one for the manual PPD entry. This still isn't enough time for the problem to be fixed all by itself, so I don't know whether to believe your explanation.

It would be worth installing a minimal install into a virtual machine to prove that it fixes itself after a long enough time.. I don't believe that it does. I think the user has to trigger an event.
Comment 18 Johannes Meixner 2012-04-10 07:00:32 UTC
*** Bug 755693 has been marked as a duplicate of this bug. ***
Comment 19 Johannes Meixner 2012-04-10 09:54:18 UTC
Only a guess:

See
http://www.cups.org/newsgroups.php?s1+gcups.general+v2+T0+Q%22A+complex+problem%22
-----------------------------------------------------------------------------
... cups 1.5.0 ... After that entered to web-interface and tried
to add printer, but have got error "Unable to add printer: Unknown".
Besides didn't work list of printers, list of groups (in web-interface)
with the same error "Unknown".
...
Updating to 1.5.2 helps
-----------------------------------------------------------------------------

Perhaps this is
http://www.cups.org/str.php?L3902

Perhaps the "Unknown" there is the same as the "Unknown" here
and then upgrading to CUPS 1.5.2 from the openSUSE development
project "Printing" might help.

Carefully read
https://build.opensuse.org/project/show?project=Printing

Warning:
I you use a non-English locale CUPS 1.5.2 has another issue,
see bnc#755627

Users which use a English locale might upgrade to
CUPS 1.5.2 from the openSUSE development project "Printing"
to test whether or not the issue is gone in CUPS 1.5.2.
Comment 20 Jean-Daniel Dodin 2012-05-16 08:54:47 UTC
no time to work on this
Comment 21 Johannes Meixner 2012-08-01 08:02:32 UTC
Right now with CUPS 1.5.3 on my SLED-11-SP1 workstation
a first run of yast2-printer got no PPDs/drivers listed
and in /var/log/YaST2/y2log there is:
-----------------------------------------------------------------------------
2012-08-01 09:43:14 ... [YCP] Printerlib.ycp:66 Executing bash commandline:
 /usr/lib/YaST2/bin/create_printer_ppd_database
 >/var/lib/YaST2/printer_ppd_database.ycp
2012-08-01 09:44:14 ... [bash] ShellCommand.cc(shellcommand):78
 lpinfo: Success
-----------------------------------------------------------------------------

I closed yast2-printer and restarted it and then it works
and in /var/log/YaST2/y2log there is no "lpinfo:..." message.

Therefore it seems even with CUPS 1.5.3 the root issue is not solved
but only the lpinfo message has changed from "lpinfo: Unknown" to
"lpinfo: Success" regardless that actually lpinfo was not successful
to produce the PPDs/drivers listing.

I change the bug status from "wontfix" to "upstream" according to
https://bugzilla.novell.com/page.cgi?id=fields.html#status
Comment 22 Peter B 2012-10-12 18:37:18 UTC
In my case (oS 12.2 upgraded from 12.2), printer_ppd_database.ycp was empty even after repeated attempts at refreshing the driver list. After running

/usr/lib/YaST2/bin/create_printer_ppd_database >/var/lib/YaST2/printer_ppd_database.ycp

as root, then yast printer module, the driver list becomes populated, after Yast generates the list again! Perhaps some timer expires too soon?
Comment 23 Johannes Meixner 2012-10-18 14:39:18 UTC
Berthold,
if I remember correctly you told me that this issue
also happened for you with SLE11-SP2 i.e. with CUPS 1.3.9
which would mean it is an very old issue in CUPS.
Comment 24 Johannes Meixner 2013-01-02 07:33:18 UTC
*** Bug 795794 has been marked as a duplicate of this bug. ***
Comment 25 Johannes Meixner 2014-01-21 08:44:20 UTC
*** Bug 856796 has been marked as a duplicate of this bug. ***
Comment 26 Johannes Meixner 2014-10-08 14:10:35 UTC
*** Bug 900264 has been marked as a duplicate of this bug. ***
Comment 27 Johannes Meixner 2015-03-13 10:52:08 UTC
Only FYI:
It seems even CUPS 2.0 still has this issue sometimes, see
https://www.cups.org/str.php?L4521
Comment 28 Johannes Meixner 2015-12-02 13:53:52 UTC
*** Bug 956875 has been marked as a duplicate of this bug. ***