Bug 11684 - Printing to postscript printer fails with status "Idle - Filter failed" : caused by failure in pdftops stage of CUPS filter pipeline
Summary: Printing to postscript printer fails with status "Idle - Filter failed" : cau...
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 4
Hardware: x86_64 Linux
Priority: High critical
Target Milestone: ---
Assignee: Mageia Bug Squad
QA Contact:
URL:
Whiteboard:
Keywords:
: 12543 12832 (view as bug list)
Depends on:
Blocks: 12856
  Show dependency treegraph
 
Reported: 2013-11-16 15:49 CET by Martin Whitaker
Modified: 2014-12-01 21:35 CET (History)
16 users (show)

See Also:
Source RPM: cups-filters 1.0.41-3.mga4.x86_64
CVE:
Status comment:


Attachments
The /etc/cups/printers.conf file (502 bytes, text/plain)
2013-12-15 14:55 CET, Martin Whitaker
Details
The /var/log/cups/error_log file (26.64 KB, text/plain)
2013-12-15 14:56 CET, Martin Whitaker
Details
CUPS error_log with log level set to debug (13.54 KB, application/gzip)
2013-12-15 16:09 CET, Martin Whitaker
Details
Input file to failing stage of CUPS filter pipeline (39.07 KB, application/pdf)
2014-02-03 21:37 CET, Martin Whitaker
Details

Description Martin Whitaker 2013-11-16 15:49:44 CET
On a clean install of M4 beta 1, I attempted to configure my printer via drakconf.

Problem 1:

With the software firewall enabled, the configuration program can't communicate with the CUPS server and detect the printer. Although this is probably unavoidable, it would be good to have a warning message to tell less experienced users what to do.

Problem 2:

After fixing the firewall, my printer was listed in the Devices list of the "New printer" dialogue. But after selecting the correct entry in the Devices list and clicking the Forward button, the configuration program hung (spinning busy icon). Running drakconf from a terminal window, the diagnostic messages showed that the task-printing-misc meta-package had not been installed. Manually installing this package fixed the problem.

Problem 3:

Any attempt to print on the printer fails. The printer status shows as "Idle - Filter failed".



Reproducible: 

Steps to Reproduce:
Comment 1 Martin Whitaker 2013-12-15 12:57:03 CET
Still broken in beta 2.
Comment 2 Marja Van Waes 2013-12-15 13:38:51 CET
Hi Martin,

according to some specifications I saw, your printer can be used over the USB port and over the parallel port.

Which one are you using? Is it directly attached to your pc, or do you use a printserver?

Also, can you please attach:

     /etc/cups/printers.conf
    /var/log/cups/error_log 

and the output of (as root)
journalctl -f

from when you try to print

Keywords: (none) => NEEDINFO
CC: (none) => marja11, qa-bugs, thierry.vignaud
Whiteboard: (none) => 4beta2

Comment 3 Martin Whitaker 2013-12-15 14:48:03 CET
Hi Marja,

The printer is directly attached to the PC I'm using to test Mageia 4 via a USB port. When asked to choose a driver, I select "Postscript-Kyocera" (which is the default - selecting the alternative "Local Driver" just causes the "Choose Driver" dialogue to hang indefinitely (with a spinning "busy" icon).

Here is the output from journalctl -f after selecting "Print Test Page":

Dec 15 13:44:25 wotan systemd[1]: Started CUPS Printing Service.
Dec 15 13:44:25 wotan kernel: usblp2: removed
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/gi/overrides/GLib.py", line 633, in <lambda>
    return (lambda data: callback(*data), user_data)
  File "/usr/share/system-config-printer/system-config-printer.py", line 2064, in deferred_refresh
    self.populateList (prompt_allowed=False)
  File "/usr/share/system-config-printer/system-config-printer.py", line 989, in populateList
    model.foreach (maybe_select, None)
AttributeError: 'NoneType' object has no attribute 'foreach'
Dec 15 13:44:30 wotan kernel: usblp 3-3:1.0: usblp2: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 v...0x000E
Dec 15 13:44:31 wotan systemd[1]: Started CUPS Printing Service.
Dec 15 13:44:31 wotan systemd[1]: Started CUPS Printing Service.
Comment 4 Martin Whitaker 2013-12-15 14:55:45 CET
Created attachment 4622 [details]
The /etc/cups/printers.conf file
Comment 5 Martin Whitaker 2013-12-15 14:56:20 CET
Created attachment 4623 [details]
The /var/log/cups/error_log file
Martin Whitaker 2013-12-15 14:58:11 CET

Attachment 4622 mime type: application/octet-stream => text/plain

Martin Whitaker 2013-12-15 14:58:34 CET

Attachment 4623 mime type: application/octet-stream => text/plain

Marja Van Waes 2013-12-15 15:01:44 CET

Keywords: NEEDINFO => (none)

Comment 6 Marja Van Waes 2013-12-15 15:22:25 CET
cc'ing some more, because I've seen odd things in cauldron, with regard to printing and adding printers, too, even if I didn't get around to filing bug reports

CC: (none) => anssi.hannula, dmorganec, mageia

Comment 7 Florian Hubold 2013-12-15 15:34:21 CET
In error_log there are issues with the filters:

D [15/Dec/2013:11:50:59 +0000] [Job 1] PID 6673 (gs) stopped with status 1!
[...]
D [15/Dec/2013:11:50:59 +0000] [Job 1] PID 6667 (/usr/lib/cups/filter/pdftops) stopped with status 1.
D [15/Dec/2013:11:50:59 +0000] [Job 1] Hint: Try setting the LogLevel to "debug" to find out more.

Print job ends with
D [15/Dec/2013:11:50:59 +0000] [Job 1] printer-state-message="Filter failed"


So there are some filter errors, can you please change the loglevel to debug as proposed by CUPS to see why that happens?
Comment 8 Martin Whitaker 2013-12-15 16:09:07 CET
Created attachment 4626 [details]
CUPS error_log with log level set to debug

I can't spot anything helpful in here.
Comment 9 Thierry Vignaud 2013-12-20 23:30:51 CET
Please try with latest system-config-printer (and update the RPM package field accordingly)

Source RPM: (none) => system-config-printer

Comment 10 Martin Whitaker 2013-12-22 17:33:09 CET
# urpmi system-config-printer
Package system-config-printer-1.4.2-9.mga4.x86_64 is already installed

So unless the mirror I'm using is out of date, I'm already using the latest version.

Source RPM: system-config-printer => system-config-printer 1.4.2-9.mga4.x86_64

Comment 11 Marja Van Waes 2013-12-22 18:00:31 CET
(In reply to Martin Whitaker from comment #10)
> # urpmi system-config-printer
> Package system-config-printer-1.4.2-9.mga4.x86_64 is already installed
> 
> So unless the mirror I'm using is out of date, I'm already using the latest
> version.

system-config-printer-1.4.3-1.mga4 was pushed 3 days ago.

If it's still not on your mirror, then please try another one and tell which one is out-of-date
Comment 12 Martin Whitaker 2013-12-22 19:44:22 CET
Hi Marja,

I've found another mirror with the new version. The filter error bug (problem 3) is still present. Is there any way to test the missing task-printing-misc package bug (problem 2) without doing a clean install?

The out-of-date mirror is ftp.sunet.se

Source RPM: system-config-printer 1.4.2-9.mga4.x86_64 => system-config-printer 1.4.3-1.mga4.x86_64

Comment 13 Martin Whitaker 2014-02-03 21:37:46 CET
Created attachment 4925 [details]
Input file to failing stage of CUPS filter pipeline

OK, I've spent some time debugging this problem, and it lies in the pdftops filter. The attached PDF file was generated by manually running the preceding filter steps (bannertopdf, pdftopdf). To reproduce the fault:

   /usr/lib/cups/filter/pdftops 1 me '' 1 '' pdftopdf.pdf > pdftops.ps

This results in the following messages:

  DEBUG: Using image rendering resolution 300 dpi
  DEBUG: Started filter gs (PID 6119)
  DEBUG: Started filter pstops (PID 6120)
  DEBUG: slow_collate=0, slow_duplex=0, slow_order=0
  DEBUG: This document does not conform to the Adobe Document Structuring Conventions and may not print correctly.
  PAGE: 1 1
  DEBUG: PID 6119 (gs) stopped with status 1!
  DEBUG: PID 6120 (pstops) exited with no errors.

Looking in the resulting pdftops.ps file, the problem is apparently:

  %%BeginDocument: nondsc
  Unknown device: pswrite
  Unrecoverable error: undefined in .uninstallpagedevice
  Operand stack:
      defaultdevice
  %%EndDocument

Replacing /usr/lib/cups/filter/pdftops with the old version from Mageia-2 fixes the problem.
Comment 14 Martin Whitaker 2014-02-03 21:43:16 CET
Changing bug summary to reflect the real problem

Version: Cauldron => 4
Summary: Can't print on Kyocera FS-1020D printer => Printing to postscript printer fails with status "Idle - Filter failed" : caused by failure in pdftops stage of CUPS filter pipeline
Source RPM: system-config-printer 1.4.3-1.mga4.x86_64 => cups-filters 1.0.41-3.mga4.x86_64
Whiteboard: 4beta2 => (none)

Comment 15 Adrien Guichard 2014-02-05 17:58:19 CET
I do have the same problem, tracing cupsd, 
# strace -o cups2.txt -ff -p 29055
$ grep exec cups2*
[. . .]
29721:execve("/usr/lib/cups/filter/pdftops", ["SagemDir", "118", "adrien", "Test Page", "1", "job-uuid=urn:uuid:6f9389e4-577f-"...], [/* 31 vars */]) = 0
29722:execve("/usr/lib/cups/backend/http", ["http://10.109.55.121:631/ipp", "118", "adrien", "Test Page", "1", "job-uuid=urn:uuid:6f9389e4-577f-"...], [/* 31 vars */]) = 0
29723:execve("/usr/lib/cups/filter/gs", ["gs", "-q", "-dNOPAUSE", "-dBATCH", "-dSAFER", "-sDEVICE=pswrite", "-sOUTPUTFILE=%stdout", "-dLanguageLevel=3", "-r600", "-dCompressFonts=false", "-dNoT3CCITT", "-dNOINTERPOLATE", "-c", "save pop", "-f", "/var/spool/cups/tmp/cupsFV3LWh", ...], [/* 31 vars */]) = -1 ENOENT (No such file or directory)
29723:execve("/usr/lib64/cups/filter/gs", ["gs", "-q", "-dNOPAUSE", "-dBATCH", "-dSAFER", "-sDEVICE=pswrite", "-sOUTPUTFILE=%stdout", "-dLanguageLevel=3", "-r600", "-dCompressFonts=false", "-dNoT3CCITT", "-dNOINTERPOLATE", "-c", "save pop", "-f", "/var/spool/cups/tmp/cupsFV3LWh", ...], [/* 31 vars */]) = -1 ENOENT (No such file or directory)
29723:execve("/usr/bin/gs", ["gs", "-q", "-dNOPAUSE", "-dBATCH", "-dSAFER", "-sDEVICE=pswrite", "-sOUTPUTFILE=%stdout", "-dLanguageLevel=3", "-r600", "-dCompressFonts=false", "-dNoT3CCITT", "-dNOINTERPOLATE", "-c", "save pop", "-f", "/var/spool/cups/tmp/cupsFV3LWh", ...], [/* 31 vars */]) = 0


the problem might come from gs, I do have this error at the end of 29723 process:
[. . .]
write(1, "Unknown device: pswrite\n", 24) = 24
[. . .]

let me know if you want the complete strace output. I do not know what to do from here.

CC: (none) => guichard.adrien

Comment 16 Adrien Guichard 2014-02-05 18:07:29 CET
digging further:
# strings /usr/lib/cups/filter/pdftops  | grep pswrite
-sDEVICE=pswrite


#  gs --help | grep ps2write
   pr1000_4 pr150 pr201 ps2write psdcmyk psdrgb pxlcolor pxlmono r4081 rinkj

is it possible "pswrite" be obsoleted by "ps2write" as gs device?
is there a way to change "-sDEVICE=pswrite" to "-sDEVICE=ps2write"?

what does give 
 strings /usr/lib/cups/filter/pdftops  | grep sDEVICE in mageia 2?
Comment 17 Adrien Guichard 2014-02-05 18:17:10 CET
(In reply to Adrien Guichard from comment #16)
> digging further:
> # strings /usr/lib/cups/filter/pdftops  | grep pswrite
> -sDEVICE=pswrite
> 
> 
> #  gs --help | grep ps2write
>    pr1000_4 pr150 pr201 ps2write psdcmyk psdrgb pxlcolor pxlmono r4081 rinkj
> 
> is it possible "pswrite" be obsoleted by "ps2write" as gs device?
> is there a way to change "-sDEVICE=pswrite" to "-sDEVICE=ps2write"?
> 
> what does give 
>  strings /usr/lib/cups/filter/pdftops  | grep sDEVICE in mageia 2?

see.
http://www.cups.org/str.php?L3766

looks like we have to use older gs, or compile cups with "ps2write" enabled.
Comment 18 Pierre-Emmanuel Novac 2014-02-09 23:59:22 CET
Hi, I'm facing the exact same problem.
As a (dirty) temporary workaround, I'm using this wrapper script in place of /usr/bin/gs (after renaming the original one to /usr/bin/gs.orig) :

#!/usr/bin/bash
if echo "$@" | grep --quiet pswrite; then
	/usr/bin/gs.orig `echo "$@" | sed "s|pswrite|ps2write|g"`
else
	/usr/bin/gs.orig "$@"
fi

CC: (none) => piernov

Comment 19 Adrien Guichard 2014-02-10 09:50:10 CET
Some other solution is to remove "--with-pdftops=hybrid" configure option from "cups-filter.spec", or modify directly "./filter/pdftops.c".

the problem is I do not know the side effects. This configure option is supposed to allow to switch to poppler pdftops implementation for some buggy postscript printer (see cups-filter/README file).

gs option "pswrite" has been obsoleted by "epswrite", which in turn seems to be obslete...

According to "cups-filters-1.0.44/README", keeping "--with-pdftops=hybrid" allow per printer /per job pdftops-renderer selection (for example poppler impl).

We can keep "--with-pdftops=hybrid", but to patch "./filter/pdftops.c" to change "pswrite" in either "ps2write" or "epswrite".

Could you test changing "ps2write" in "epswrite"?
Comment 20 Peter Hartmann 2014-02-10 18:54:23 CET
I have the same "filter failed" error with my Kyocera printers FS-1800 and FS-C5016N on MGA4 32bit. Your workaround (see comment 18) is working for me.

CC: (none) => phartmann

Comment 21 Florian Hubold 2014-02-10 19:16:16 CET
As quite some users are affected from forums reports and ml posts, added to Errata until we have a final fix: https://wiki.mageia.org/en/Mageia_4_Errata#CUPS_.2F_ghostscript_filters

Thanks for sharing dirty workarounds :)

CC: (none) => doktor5000

Comment 22 Chris Denice 2014-02-13 18:54:38 CET
hi guys,
just to mention that workaround c18 works only if the printing calling program uses that kind of call.

I am still getting filter crash errors by using "lpr" on the command line, or printing pdf/ps files from xpdf, gv etc...

cheers,
chris.

CC: (none) => dirteat

Comment 23 Paul Brennan 2014-02-15 00:40:55 CET
The workaround worked for me, LaserjetPro 200 MFP. Many thanks.

CC: (none) => paul

Florian Hubold 2014-02-15 21:10:57 CET

See Also: (none) => https://bugs.mageia.org/show_bug.cgi?id=12137

Comment 24 José Jorge 2014-02-16 11:22:36 CET
(In reply to Pierre-Emmanuel Novac from comment #18)
> Hi, I'm facing the exact same problem.
> As a (dirty) temporary workaround, I'm using this wrapper script in place of
> /usr/bin/gs (after renaming the original one to /usr/bin/gs.orig) :
> 
> #!/usr/bin/bash
> if echo "$@" | grep --quiet pswrite; then
> 	/usr/bin/gs.orig `echo "$@" | sed "s|pswrite|ps2write|g"`
> else
> 	/usr/bin/gs.orig "$@"
> fi

This workaround also worked for me. This bug should be at highest priority, as printing is currently broken on Mageia 4!

Priority: Normal => High
CC: (none) => lists.jjorge
Severity: normal => critical

Comment 25 Adrien Guichard 2014-02-18 06:19:17 CET
It is a good news workaround works most of the time. For those it does not work, could you try to use poppler pstopdf implementation as described in:
http://ubuntuforums.org/showthread.php?t=2022997

lpadmin -p <printer> -o pdftops-renderer-default=gs
lpadmin -p <printer> -o pdftops-renderer-default=pdftops

For postcrypt 1.1 printer or with buggy postscript implementation, it should work better.

I think the good solution is to change directly pdftops sources as in #19

Thanks for your support,
Adrien
Comment 26 Martin Whitaker 2014-02-18 09:47:02 CET
This bug is still assigned to bugsquad. Is the maintainer of this package reading this?
Comment 27 Florian Hubold 2014-02-18 20:36:32 CET
(In reply to Martin Whitaker from comment #26)
> This bug is still assigned to bugsquad. Is the maintainer of this package
> reading this?

Well, he's on CC.
FWIW, our package uses the same configuration as the Fedora one, although we have 4 Fedora patches which are not existent anymore in Fedora ... Oo

@tv: the 4 patches were dropped by Fedora as upstreamed with 1.42 http://pkgs.fedoraproject.org/cgit/cups-filters.git/commit/?id=167d5a24a2c5f5b8ce0d4ff01c44b3345cddde59 and 1.43
http://pkgs.fedoraproject.org/cgit/cups-filters.git/commit/?id=5484796d899add88cd4bd433634ad6f1513ff3bc

Shouldn't we drop them too?

Apart from that, not sure who's at fault here? cups-filters? ghostscript? ...?
Comment 28 Thierry Vignaud 2014-02-18 21:00:33 CET
No. We have 1.0.41 in mga4.
And 1.0.45 w/o the patches has the same issue in mga5
Comment 29 Chris Denice 2014-02-20 11:51:27 CET
Foomatic filters look also screwed (printing from emacs, with workaround) --->

---
D [20/Feb/2014:11:48:36 +0100] [Job 853] Found: %%BeginProlog
D [20/Feb/2014:11:48:36 +0100] [Job 853] Inserting option code into "Prolog" section.
D [20/Feb/2014:11:48:36 +0100] [Job 853] ricoh: options.c:823: build_foomatic_custom_command: Assertion `choice' failed.
PID 24410 (/usr/lib/cups/filter/foomatic-rip) crashed on signal 6.
D [20/Feb/2014:11:48:36 +0100] [Job 853] Hint: Try setting the LogLevel to "debug" to find out more.
D [20/Feb/2014:11:48:36 +0100] [Job 853] hrDeviceDesc="Unknown"
D [20/Feb/2014:11:48:36 +0100] [Job 853] prtGeneralCurrentLocalization type is 0, expected 2!
D [20/Feb/2014:11:48:36 +0100] [Job 853] backendWaitLoop(snmp_fd=6, addr=0x7f8864dd6878, side_cb=0x7f88633f5ed0)
Comment 30 Thierry Vignaud 2014-02-22 04:14:33 CET
*** Bug 12832 has been marked as a duplicate of this bug. ***

CC: (none) => steve

Comment 31 Thierry Vignaud 2014-02-22 04:17:09 CET
Fixed in cups-filters-1.0.46-2.mga5 in cauldron:
./configure script needs /bin/gs in order to check whether ps2write is available or not...
Comment 32 Thierry Vignaud 2014-02-22 04:20:16 CET
And cups-filters-1.0.41-3.mga4 was just pushed into core/updates_testing
Please test
Comment 33 Thierry Vignaud 2014-02-22 04:22:48 CET
Actually the bug could have been seen the other way: ghostscript-devel (really lib{,64}gs-devel could have required the full ghostscript).
The fix I choose is simpler...
Comment 34 Florian Hubold 2014-02-23 00:14:46 CET
(In reply to Thierry Vignaud from comment #32)
> And cups-filters-1.0.41-3.mga4 was just pushed into core/updates_testing
> Please test

Note to self: write an advisory and pass to QA if nobody else beats me to it after initial testing :)
Comment 35 Martin Whitaker 2014-02-23 00:47:28 CET
(In reply to Thierry Vignaud from comment #32)
> And cups-filters-1.0.41-3.mga4 was just pushed into core/updates_testing
> Please test

This caused me some difficulty, because you haven't changed the version number. But having found the necessary urpmi options to force the package to be updated, I can confirm it fixes the bug for me.
Comment 36 Florian Hubold 2014-02-23 01:49:51 CET
(In reply to Martin Whitaker from comment #35)
> This caused me some difficulty, because you haven't changed the version
> number.

Yes he did: 
http://svnweb.mageia.org/packages/updates/4/cups-filters/current/SPECS/cups-filters.spec?r1=576130&r2=595477
But seems subrel wasn't respected as the built package has the same version as the one in core/release ... :/
Comment 37 Florian Hubold 2014-02-23 02:04:00 CET
(In reply to Florian Hubold from comment #36)
> But seems subrel wasn't respected as the built package has the same version
> as the one in core/release ... :/

subrel has to be defined before mkrel to work. Added hint to https://wiki.mageia.org/en/Updates_policy#Maintainer_.28or_any_interested_packager.29 and pushed new candidate:  

cups-filters-1.0.41-3.1.mga4
Comment 38 Thierry Vignaud 2014-02-23 11:24:48 CET
closing then

Status: NEW => RESOLVED
Resolution: (none) => FIXED

Thierry Vignaud 2014-02-23 11:28:42 CET

Blocks: (none) => 12856

Comment 39 Florian Hubold 2014-02-23 12:15:14 CET
(In reply to Thierry Vignaud from comment #38)
> closing then

Sorry? Do you think this will be magically validated by QA?
Please check https://wiki.mageia.org/en/Updates_policy#Maintainer_.28or_any_interested_packager.29 for the procedure and my previous comment https://bugs.mageia.org/show_bug.cgi?id=11684#c34

Status: RESOLVED => REOPENED
Resolution: FIXED => (none)

Comment 40 Manuel Hiebel 2014-02-23 12:18:19 CET
there is a blocker witch is assigned to qa ;)
Comment 41 Thierry Vignaud 2014-02-23 12:46:24 CET
(In reply to Florian Hubold from comment #39)
> Sorry? Do you think this will be magically validated by QA?

Are you blind?

Status: REOPENED => RESOLVED
Resolution: (none) => FIXED

Comment 42 Christiaan Welvaart 2014-11-25 09:42:37 CET
*** Bug 12543 has been marked as a duplicate of this bug. ***

CC: (none) => phb

Comment 43 Nicolas Brouard 2014-12-01 21:35:51 CET
Thanks a lot. It was a ugly bug. Can't print on a Samsung printer.

CC: (none) => nicolas.brouard


Note You need to log in before you can comment on or make changes to this bug.