Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cups-filters missing #159

Closed
PiotrC1 opened this issue Sep 4, 2016 · 19 comments
Closed

cups-filters missing #159

PiotrC1 opened this issue Sep 4, 2016 · 19 comments

Comments

@PiotrC1
Copy link

PiotrC1 commented Sep 4, 2016

Due to problems with Avahi I was unable to print from CUPS so far, but I have noticed that whole cups-filters is missing. Actual version is 1.11.2.

@alllexx88
Copy link
Collaborator

alllexx88 commented Sep 4, 2016

I have no avahi issues: it's being managed by dbus, so doesn't need to be started manually. Try to restart dbus and start cupsd again:

/opt/etc/init.d/S20dbus restart
killall cupsd
/opt/sbin/cupsd

P.S. After upgrading avahi, of course: it's now fixed

@alllexx88
Copy link
Collaborator

OK, I'll label it as a package request. BTW, I printed using current cups version together with splix printer drivers fine, without cups-filters

@PiotrC1
Copy link
Author

PiotrC1 commented Sep 4, 2016

At least you will be unable to print from iOS (AirPrint) as image/urf type is missing.
On the other side, trying to print some .jpg picture with following command:
lpr -P OKI-C5950 picture.jpg
I got error:
lpr: Unsupported document-format "image/jpeg".

@alllexx88
Copy link
Collaborator

@PiotrC1 I see, it makes much sense to add it then

@alllexx88
Copy link
Collaborator

@PiotrC1 package added: e45a100
Please test and report back

@PiotrC1
Copy link
Author

PiotrC1 commented Sep 7, 2016

Thanks for your effort. There are two issues now:

  1. Trying to print with any printer cups stops at processing the first filter with message:

E [07/Sep/2016:22:47:00 +0200] [Job 9] Unable to start filter "imagetopdf" - Success.

Previously there is a message about filters needed for job:

D [07/Sep/2016:22:47:00 +0200] [Job 9] 3 filters for job:
D [07/Sep/2016:22:47:00 +0200] [Job 9] imagetopdf (image/jpeg to application/vnd.cups-pdf, cost 65)
D [07/Sep/2016:22:47:00 +0200] [Job 9] pdftops (application/vnd.cups-pdf to application/vnd.cups-postscript, cost 100)
D [07/Sep/2016:22:47:00 +0200] [Job 9] - (application/vnd.cups-postscript to printer/OKI-C5950-1B440C, cost 0) 
  1. image/urf filter is installed and configuration is visible:
d [07/Sep/2016:22:46:55 +0200] cupsdReadConfiguration: type image/urf
...
d [07/Sep/2016:22:46:55 +0200] cupsdReadConfiguration: filter image/urf to application/pdf 0 urftopdf
...
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/urf needs 3 filters

But image/urf is not advertised by CUPS:
D [07/Sep/2016:22:46:55 +0200] DNS_SD "C5950 @ Tomato" pdl=application/octet-stream,application/pdf,application/postscript,image/jpeg,image/png,image/pwg-raster
Longer part of log:

d [07/Sep/2016:22:46:55 +0200] add_printer_filter: OKI-C5950-1B440C: adding filter application/vnd.cups-command printer/OKI-C5950-1B440C/application/postscript 100 commandtops
d [07/Sep/2016:22:46:55 +0200] add_printer_filter: OKI-C5950-1B440C: adding filter printer/OKI-C5950-1B440C/application/postscript printer/OKI-C5950-1B440C 0 -
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: 53 types, 87 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: application/g-code not supported
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: application/msword not supported
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: application/octet-stream needs 2 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: application/pdf needs 2 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: application/postscript needs 3 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: application/rss+xml not supported
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: application/sla not supported
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: application/vnd.adobe-reader-postscript needs 1 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: application/vnd.cups-banner not supported
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: application/vnd.cups-command needs 1 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: application/vnd.cups-pdf needs 1 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: application/vnd.cups-pdf-banner needs 3 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: application/vnd.cups-postscript needs 1 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: application/vnd.cups-ppd not supported
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: application/vnd.cups-raster needs 4 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: application/vnd.cups-raw needs 1 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: application/vnd.makerbot-s3g not supported
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: application/x-cshell needs 3 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: application/x-csource needs 3 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: application/x-perl needs 3 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: application/x-shell needs 3 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/gif needs 2 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/jpeg needs 2 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/png needs 2 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/pwg-raster needs 3 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/tiff needs 2 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/urf needs 3 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/vnd.cups-brf not supported
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/vnd.cups-ubrl not supported
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/x-alias not supported
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/x-bitmap needs 2 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/x-icon not supported
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/x-photocd needs 2 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/x-portable-anymap needs 2 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/x-portable-bitmap needs 2 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/x-portable-graymap needs 2 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/x-portable-pixmap needs 2 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/x-sgi-rgb needs 2 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/x-sun-raster needs 2 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/x-xbitmap needs 2 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/x-xpixmap needs 2 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: image/x-xwindowdump needs 2 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: model/amf not supported
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: model/vnd.collada+xml not supported
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: text/css needs 4 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: text/html needs 3 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: text/plain needs 3 filters
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: text/vnd.cups-brf not supported
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: text/vnd.cups-ubrl not supported
d [07/Sep/2016:22:46:55 +0200] add_printer_formats: OKI-C5950-1B440C: 34 supported types 

Before last upgrade and installing cups-filters it was possible to print test page - now it is not possible due to previously mentioned problem with starting filter.

PS. image/urf is needed for AirPrint support

@alllexx88
Copy link
Collaborator

Did you try to launch imagetopdf manually?

/opt/lib/cups/filter/imagetopdf

@PiotrC1
Copy link
Author

PiotrC1 commented Sep 7, 2016

Yes. With option -h (I do not know options so I have chosen -h) it creates valid black and white pdf file.

root@Tomato:/tmp/home/root# /opt/lib/cups/filter/imagetopdf 9999 root nic 1 -h /opt/tmp/dziewcze.jpg > /tmp/xxx
INFO: /opt/lib/cups/filter/imagetopdf 9999 root nic 1 -h /opt/tmp/dziewcze.jpg
DEBUG: num_components = 3
DEBUG: jpeg_color_space = JCS_YCbCr
DEBUG: Converting image to RGB...
DEBUG: JPEG image 1080x1920x3, 128x128 PPI
DEBUG: Before scaling: xppi=0, yppi=0, zoom=1.00
DEBUG: Before scaling: xprint=8.5, yprint=11.0
DEBUG: cupsImageGetXPPI(img) = 128, cupsImageGetYPPI(img) = 128, aspect = 1.000000
DEBUG: Portrait size is 6.19 x 11.00 inches
DEBUG: Landscape size is 4.78 x 8.50 inches
DEBUG: Auto orientation...
DEBUG: Using portrait orientation...
DEBUG: xpages = 1x6.19in, ypages = 1x11.00in
DEBUG: XPosition=0, YPosition=0, Orientation=0
DEBUG: xprint=6, yprint=11
DEBUG: PageLeft=0, PageRight=612, PageWidth=612
DEBUG: PageBottom=0, PageTop=792, PageLength=792
DEBUG: left=83.25, top=0.00

There is one more warning message in log but I do not think it matters:
E [07/Sep/2016:22:46:55 +0200] OKI-C5950-1B440C: Directory \"/opt/lib/cups/filter\" has insecure permissions (040775/uid=0/gid=0).

@PiotrC1
Copy link
Author

PiotrC1 commented Sep 8, 2016

Well, the problem was indeed connected to directory permissions - after changing it from 775 to 755 filters can be started by CUPS without problems. Now it is ghostscript to fail:

D [08/Sep/2016:01:38:35 +0200] [Job 14] PID 5343 (/opt/lib/cups/filter/imagetopdf) exited with no errors.
D [08/Sep/2016:01:38:35 +0200] [Job 14] Printer make and model: Oki C5950
D [08/Sep/2016:01:38:35 +0200] [Job 14] Running command line for pstops: pstops 14 root dziewcze.jpg 1 \'finishings=3 number-up=1 job-uuid=urn:uuid:50fc7144-2188-35a8-7c4f-3520b61c49ba job-originating-host-name=localhost date-time-at-creation= date-time-at-processing= time-at-creation=1473291513 time-at-processing=1473291513 document-name-supplied=dziewcze.jpg\'
D [08/Sep/2016:01:38:35 +0200] [Job 14] No resolution information found in the PPD file.
d [08/Sep/2016:01:38:35 +0200] select_timeout: JobHistoryUpdate=0
D [08/Sep/2016:01:38:35 +0200] [Job 14] Using image rendering resolution 300 dpi
D [08/Sep/2016:01:38:35 +0200] [Job 14] Running command line for gs: gs -q -dNOPAUSE -dBATCH -dSAFER -dNOMEDIAATTRS -sDEVICE=pswrite -sOUTPUTFILE=%stdout -dLanguageLevel=3 -r300 -dCompressFonts=false -dNoT3CCITT -dNOINTERPOLATE -c \'save pop\' -f /opt/var/spool/cups/tmp/014e057dac1f1
D [08/Sep/2016:01:38:35 +0200] [Job 14] Started filter gs (PID 5346)
D [08/Sep/2016:01:38:35 +0200] [Job 14] Started filter pstops (PID 5347)
D [08/Sep/2016:01:38:35 +0200] [Job 14] PID 5346 (gs) stopped with status 1!
D [08/Sep/2016:01:38:35 +0200] [Job 14] Page = 595x842; 13,13 to 582,829
D [08/Sep/2016:01:38:35 +0200] [Job 14] This document does not conform to the Adobe Document Structuring Conventions and may not print correctly. 

After changing rendering from GS to pdftops issuing command:
lpadmin -p OKI-C5950 -o pdftops-renderer-default=pdftops
printer started to respond (but not to print).
Now I can print Self Test Page, but not Test Page.

@alllexx88
Copy link
Collaborator

@PiotrC1

Well, the problem was indeed connected to directory permissions - after changing it from 775 to 755 filters can be started by CUPS without problems

Good catch!
I've fixed GS related issue: 299a063
As for actual printing, I've never used Optware-ng cups to print using a usb printer: I only used it to manage RAW printers. Also, I remember that to get cups to work with usb printer on OpenWRT, I had to chmod usb backend to 700. I've pushed this together with your /opt/lib/cups/filter permissions fix (5d0253e), so please upgrade and try again: I wonder if you can print now

@PiotrC1
Copy link
Author

PiotrC1 commented Sep 8, 2016

Thanks.
At the moment there are following open points:

  • Discarding image/urf by CUPS while advertising printer,
  • Unknown crash of ghostscript while printing

Due to unknown for me reason my OKI printer attached to USB port is not visible.
After upgrade also LPP print server is not visible as well.

@alllexx88
Copy link
Collaborator

  • Discarding image/urf by CUPS while advertising printer,

This needs further investigation

  • Unknown crash of ghostscript while printing

Yeah, I think I know this issue. If my guess is correct, the fix is to edit cupsd.conf and change line

#RIPCache 8m

to

RIPCache auto

See http://bugs.ghostscript.com/show_bug.cgi?id=691499#c15
I've experienced this with cups 1.6.3, should've know it would persist.

Due to unknown for me reason my OKI printer attached to USB port is not visible.

I had this too with TomatoUSB back then, so I added my USB printer to cups as a local RAW printer (using firmware's p910nd). Worked good as a workaround, but it would be nice to discover why it can't see usb printers.

After upgrade also LPP print server is not visible as well.

You mean 'LP'? Or 'IPP'?
The only cups change compared to what you had was chmod 700 /opt/lib/cups/backend/usb. Try setting it back: chmod 755 /opt/lib/cups/backend/usb -- though this seems unrelated to me

@alllexx88
Copy link
Collaborator

@PiotrC1 The reason I can't probably test this all myself is that the router (armv7) that has a printer attached to it has Optware dedicated pen drive broken. So I need to get a spare pen drive. The other router (mipsel) where doesn't have a printer attached

@PiotrC1
Copy link
Author

PiotrC1 commented Sep 8, 2016

Discarding image/urf by CUPS while advertising printer,

This needs further investigation

OK, thanks. I think it's not only image/urf but image/tiff as well.

...
RIPCache auto

OK, thanks for a tip. I will checki it and let you know.

I had this too with TomatoUSB back then, so I added my USB printer to cups as a local RAW printer (using firmware's p910nd). Worked good as a workaround, but it would be nice to discover why it can't see usb printers.

As a matter of fact, it's and option of TomatoUSB to make USB printer being attached to /dev/lp0. p910nd adds a gateway that usb port is connected to TCP port 910n (where n is 0..2).

You mean 'LP'? Or 'IPP'?

Sorry, IPP of course. The printer has print server allowing some protocols (ports 9100, 631, 515) - none of them is visible now (as before upgrade at least one was visible).
After manual adding to printers.conf file additional printer with following definition:
DeviceURI usb:/dev/lp0
In log there is another error:
E [08/Sep/2016:13:58:45 +0200] OKI-C5950: Directory \"/opt/lib/cups/backend\" has insecure permissions (040775/uid=0/gid=0).
So far it's the last directory in /opt/lib/cups/ with 775 access rights.
I think it would be resonable to change rights of files in this directory (some has 700, some 755, some 775).

The reason I can't probably test this all myself is that the router (armv7) that has a printer attached to it has Optware dedicated pen drive broken. So I need to get a spare pen drive. The other router (mipsel) where doesn't have a printer attached

Maybe I can donate one for you?

General remark about access right of files and directories - they are a little bit messy, I think you should generally revise them.

@alllexx88
Copy link
Collaborator

As a matter of fact, it's and option of TomatoUSB to make USB printer being attached to /dev/lp0. p910nd adds a gateway that usb port is connected to TCP port 910n (where n is 0..2).

After manual adding to printers.conf file additional printer with following definition:
DeviceURI usb:/dev/lp0

E [08/Sep/2016:13:58:45 +0200] OKI-C5950: Directory "/opt/lib/cups/backend" has insecure permissions (040775/uid=0/gid=0).

p910nd actually uses /dev/usb/lp0 on TomatoUSB (at least on my build), but it's a link to /dev/lp0, right:

root@unknown:/tmp/home/root# ps|grep 9100
  811 root       652 S    {p910nd} p9100d -b -f /dev/usb/lp0 0
root@unknown:/tmp/home/root# ls -l /dev/usb/lp0
lrwxrwxrwx    1 root     root             8 Jan  1  1970 /dev/usb/lp0 -> /dev/lp0

I'll add this dir to postinst script then.

I think it would be resonable to change rights of files in this directory (some has 700, some 755, some 775).

The permissions are set by cups build system itself: they're being installed with -m <mode> switches, and I expect for cups developers to know better (while 775 does look strange, I agree).

General remark about access right of files and directories - they are a little bit messy, I think you should generally revise them.

99% or so of file permissions are being set by respective packages build systems, and mostly they don't need to be tempered with, others are generally taken care of (but there can bugs here and there I suspect). As for directories, it might be a bit tricky, since I don't think that packager (the packager is actually opkg) changes permissions for already existing directories, so sensible directories should be chmod'ed in postinst scripts. Or, vice versa, if it does, some other package can break permissions. I'll have too look closer who's the culprit in case of cups.

Maybe I can donate one for you?

Thanks, I appreciate it a lot, but I should have one somewhere, it's just a matter of finding it. Also, the ones of smallest capacity are really cheap - it's just that I didn't have a real need for it recently (I've been doing most Optware-ng testing on my NAS and the other router, and a phone).

I think it's not only image/urf but image/tiff as well.

Not sure what's wrong with image/tiff, but this patch should fix image/urf. I'll try porting it soon

@alllexx88
Copy link
Collaborator

@PiotrC1
Please upgrade and test: it broadcasts image/urf for me fine now

@PiotrC1
Copy link
Author

PiotrC1 commented Sep 8, 2016

Hi @alllexx88!
Situation is much different now. I can:

  • Print from iOS. I had to remove all paper formats but A4 from ppd driver, then everything started to work. Avahi advertisments are OK (contain image/urf and URF=DM3)
  • Print from Linux using command lpr,
  • Print both USB as well as IPP,
  • Install printer USB and both network protocolls.

Tomorrow I will gather everything together (what settings I have made).

@alllexx88
Copy link
Collaborator

@PiotrC1
Great news. Now I'll upgrade CUPS to 2.1.4 and add some patches from Debian to see if it fixes the page size issue.

@PiotrC1
Copy link
Author

PiotrC1 commented Sep 9, 2016

I have wrote my remarks (just a few) in CUPS issue so I close the case.
Thanks again for your cooperativity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants