michaelrsweet / lprint

A Label Printer Application
https://www.msweet.org/lprint
Apache License 2.0
219 stars 29 forks source link

Printing from Ubuntu 20.04 gives "Unable to process job with format 'application/octet-stream'" error on lprint console. #64

Closed SmittyHalibut closed 1 year ago

SmittyHalibut commented 2 years ago

I'm trying to fix the dithering problem that I'm sure most of your users are trying to fix. :-)

Running Ubuntu 20.04 LTS, installed by snap on 2022-006-08 (today). This host also has a local CUPS daemon, which has my other Laser printer, so I don't want to turn it off.

I've got my label printer (Arkscan 2054A) added to lprint, using the Zebra EPL2 drivers with the same spec that my printer has: 4", 203dpi, direct thermal.

A test page from lprint prints correctly.

I added a network printer to CUPS: ipp://localhost:8000/, and chose the correct Arkscan driver for my printer. When I try to print a test page from CUPS, the job "completes successfully" (according to CUPS) but never actually prints, and I get an error on the lprint server console:

E [2022-06-08T23:41:51.306Z] [Job 3] Unable to process job with format 'application/octet-stream'.

The full lprint server console output is:

lprint: statefile='/var/snap/lprint/211/lprint.conf'
E [2022-06-08T23:26:50.712Z] [Device] Unable to initialize USB access: Other error
E [2022-06-08T23:26:50.712Z] Unable to register system, is the Avahi daemon running?
E [2022-06-08T23:26:56.762Z] [Device] Unable to create service browser.
E [2022-06-08T23:26:56.768Z] [Device] Bad SNMP packet from \'10.1.1.16\': Value uses indefinite length
E [2022-06-08T23:26:56.769Z] [Device] Bad SNMP packet from \'10.1.1.16\': Value uses indefinite length
E [2022-06-08T23:27:01.481Z] [Device] Unable to initialize USB access: Other error
E [2022-06-08T23:27:59.566Z] [Client 6] Unable to encrypt connection: A TLS fatal alert has been received.
E [2022-06-08T23:41:51.306Z] [Job 3] Unable to process job with format 'application/octet-stream'.
E [2022-06-08T23:46:07.170Z] [Job 4] Unable to process job with format 'application/octet-stream'.

I don't have a valid TLS cert for this host (it's on an internal network so certbot won't work), so I'm not sure if this is CUPS complaining about a self signed TLS cert on lprint. I noticed while bringing up https://localhost:8000/ to get to the lprint management console, that the same port 8000 works for both TLS and non-TLS. So I have no idea what CUPS is trying to do.

Though I am giving CUPS an ipp:// URL, not ipps:// URL.

Any idea what I'm doing wrong here? How should I be configuring CUPS to talk to lprint for my label printer?

Thank you for your help.

SmittyHalibut commented 2 years ago

Oh, one more thing. That's Bad SNMP packet... message is from the Label Printer's IP. Might be worth noting.

Let me know if there's any other information I can provide that will help.

SmittyHalibut commented 2 years ago

Plot thickens: When I Ctrl-C on the console to shut the daemon down, it stalls and does not die. I have to kill -9 the process to make it go away.

michaelrsweet commented 1 year ago

@SmittyHalibut First, "ipp://localhost:8000/" isn't the correct URI. It'll be "ipp://localhost:8000/ipp/print/PRINTERNAME".

If you can run:

snmpwalk -c public -v 1 -On IP-ADDRESS >FILENAME.txt

and attach it, I can see what is going on with the SNMP queries...

Finally, if you change the log level to debug (there is a web interface for this) then we might have more information about the files you are trying to print. The debug log file and a sample print file would both be useful items to help diagnose the problems...

SmittyHalibut commented 1 year ago

SNMP Walk output:

snmpwalk -c public -v 1 -On label-printer.halibut.com > snmpwalk-4B-2054A.txt

snmpwalk-4B-2054A.txt

Debug console output from lprint when adding a printer to CUPS

^C[10:41:37] mark@crossthread:~$ lprint server -o log-level=debug
I [2022-07-27T17:41:43.825Z] Starting log, system up 0 second(s), 0 printer(s), listening for connections on 'crossthread.local:0'.
D [2022-07-27T17:41:43.825Z] Adding 'image/jpeg' to 'image/pwg-raster' filter.
D [2022-07-27T17:41:43.825Z] Adding 'image/png' to 'image/pwg-raster' filter.
I [2022-07-27T17:41:43.825Z] Listening for connections on '*:8001'.
I [2022-07-27T17:41:43.825Z] Listening for connections on '*:8001'.
D [2022-07-27T17:41:43.825Z] Adding 'application/vnd.lprint-test' to 'image/pwg-raster' filter.
D [2022-07-27T17:41:43.825Z] Adding resource for '/favicon.png'.
D [2022-07-27T17:41:43.825Z] Adding resource for '/navicon.png'.
D [2022-07-27T17:41:43.825Z] Adding resource for '/de.strings'.
D [2022-07-27T17:41:43.825Z] Adding resource for '/en.strings'.
D [2022-07-27T17:41:43.825Z] Adding resource for '/es.strings'.
D [2022-07-27T17:41:43.825Z] Adding resource for '/fr.strings'.
D [2022-07-27T17:41:43.825Z] Adding resource for '/it.strings'.
lprint: statefile='/var/snap/lprint/211/lprint.conf'
I [2022-07-27T17:41:43.825Z] Loading system state from '/var/snap/lprint/211/lprint.conf'.
D [2022-07-27T17:41:43.825Z] papplSystemFindPrinter(system=0x5639ab3e1320, resource="/ipp/print/LabelPrinter", printer_id=0, device_uri="(null)")
D [2022-07-27T17:41:43.825Z] papplSystemFindPrinter: Returning (nil)(none)
I [2022-07-27T17:41:43.825Z] Printer 'LabelPrinter' at resource path '/ipp/print/LabelPrinter'.
D [2022-07-27T17:41:43.825Z] [Printer LabelPrinter] media-default=na_index-4x6_4x6in
D [2022-07-27T17:41:43.825Z] [Printer LabelPrinter] orientation-requested-default=7(none)
D [2022-07-27T17:41:43.825Z] [Printer LabelPrinter] print-color-mode-default=monochrome(0x0010)
D [2022-07-27T17:41:43.825Z] [Printer LabelPrinter] print-content-default=auto(0x0001)
D [2022-07-27T17:41:43.825Z] [Printer LabelPrinter] print-quality-default=4(normal)
D [2022-07-27T17:41:43.825Z] [Printer LabelPrinter] print-scaling-default=auto(0x0001)
D [2022-07-27T17:41:43.825Z] [Printer LabelPrinter] printer-resolution-default=203x203dpi
D [2022-07-27T17:41:43.825Z] [Printer LabelPrinter] sides-default=one-sided(0x0001)
W [2022-07-27T17:41:43.825Z] [Printer LabelPrinter] Driver does not support identification.
D [2022-07-27T17:41:43.825Z] [Printer LabelPrinter] Driver supports raw printing of 'application/vnd.eltron-epl' files.
D [2022-07-27T17:41:43.825Z] [Printer LabelPrinter] Driver reports ppm 60.
D [2022-07-27T17:41:43.825Z] [Printer LabelPrinter] Driver reports ppm_color 0.
D [2022-07-27T17:41:43.825Z] [Printer LabelPrinter] Driver provides small-48x48 icon in memory (5964 bytes).
D [2022-07-27T17:41:43.825Z] [Printer LabelPrinter] Driver provides medium-128x128 icon in memory (6491 bytes).
D [2022-07-27T17:41:43.825Z] [Printer LabelPrinter] Driver provides large-512x512 icon in memory (24908 bytes).
D [2022-07-27T17:41:43.826Z] [Printer LabelPrinter] pdf-supported=false
D [2022-07-27T17:41:43.826Z] Adding resource for '/LabelPrinter/icon-sm.png'.
D [2022-07-27T17:41:43.826Z] Adding resource for '/LabelPrinter/icon-md.png'.
D [2022-07-27T17:41:43.826Z] Adding resource for '/LabelPrinter/icon-lg.png'.
D [2022-07-27T17:41:43.826Z] Adding resource for '/LabelPrinter/'.
D [2022-07-27T17:41:43.826Z] Adding resource for '/LabelPrinter/cancel'.
D [2022-07-27T17:41:43.826Z] Adding resource for '/LabelPrinter/cancelall'.
D [2022-07-27T17:41:43.826Z] Adding resource for '/LabelPrinter/delete'.
D [2022-07-27T17:41:43.826Z] Adding resource for '/LabelPrinter/config'.
D [2022-07-27T17:41:43.826Z] Adding resource for '/LabelPrinter/jobs'.
D [2022-07-27T17:41:43.826Z] Adding resource for '/LabelPrinter/media'.
D [2022-07-27T17:41:43.826Z] Adding resource for '/LabelPrinter/printing'.
I [2022-07-27T17:41:43.826Z] Listening for connections on '/tmp/lprint1000.sock'.
D [2022-07-27T17:41:43.826Z] Adding resource for '/style.css'.
D [2022-07-27T17:41:43.826Z] Adding resource for '/'.
D [2022-07-27T17:41:43.826Z] Adding resource for '/addprinter'.
D [2022-07-27T17:41:43.826Z] Adding resource for '/config'.
D [2022-07-27T17:41:43.826Z] Adding resource for '/security'.
I [2022-07-27T17:41:43.826Z] Starting system.
D [2022-07-27T17:41:43.826Z] Registering DNS-SD name 'LPrint' on 'crossthread.local'
E [2022-07-27T17:41:43.826Z] Unable to register system, is the Avahi daemon running?
D [2022-07-27T17:41:43.826Z] [Printer LabelPrinter] Registering DNS-SD name 'LabelPrinter' on 'crossthread.local'
E [2022-07-27T17:41:43.826Z] [Printer LabelPrinter] Unable to register printer, is the Avahi daemon running?
E [2022-07-27T17:45:51.509Z] [Job 5] Unable to process job with format 'application/octet-stream'.
E [2022-07-27T17:45:51.509Z] Unable to create system state file '/var/snap/lprint/211/lprint.conf': (null)

Started the process at about 17:41:43. Went to the OS level "Printers" settings and added a printer at ipp://localhost:8000/ipp/print/LabelPrinter. When it finished that process and asked me if I want to print a Test Page, the two console lines at 17:45:51 were printed.

Attempting further "Test Page" prints results in the same two lines:

E [2022-07-27T17:55:27.880Z] [Job 6] Unable to process job with format 'application/octet-stream'.
E [2022-07-27T17:55:27.880Z] Unable to create system state file '/var/snap/lprint/211/lprint.conf': (null)

So, this feels like it might be a different problem. It has been a few weeks since I played with this. Why is it trying to write state to a .conf file? Is something broken there?

I think something is broken with my install. I'm taking a moment to move it from my laptop to the home server, get the lprint and cups off the same box, in case that was causing any problems/conflicts.

I'm leaving the snmpwalk attachment in case it helps you add support for this printer. Otherwise, let me get this build (no snap on Raspbian?) done and see if I'm still having problems. I'll be back.

SmittyHalibut commented 1 year ago

Ok. Got lprint running on my server pan.local and it's back to generating the same error message. This time with more debugging output:

This one includes the first time running lprint server and the addprinter stuff, so you can see how I've got the printer setup: 2022-07-27T12:10-lprint-debug-aborted.txt

Printing a test page from lprint succeeds, but once I add ipp://pan.local:8000/ipp/print/LabelPrinter to CUPS on my laptop and attempt to print a test page from CUPS, you see the messages at time stamp 19:05:35. The E hidden in there is:

E [2022-07-27T19:05:35.389Z] [Job 2] Unable to process job with format 'application/octet-stream'.

19:08:05 is me refreshing the LabelPrinter webpage to see the updated job queue showing the new print job being Aborted.

After doing the first test print from CUPS (above) I noticed that CUPS was setup for a 2x4" label, not the 4x6" that are in there. After fixing the CUPS config and trying again, it failed with the same message: 2022-07-27T12:11-lprint-debug-aborted.txt

Simple Test File: I'm just using the Ubuntu CUPS Test Print. I went to LibreOffice and printed a mailing label and, you guessed it, it generated the same error message: 2022-07-27T12:19-lprint-debug-aborted.txt

The file: Custom Shipping Label 4x6 Label.odt

Testing Document Viewer, printing a PDF. Same thing: 2022-07-27T12:21-lprint-debug-aborted.txt

And the PDF (just a PDF export of the ODF above): Custom Shipping Label 4x6 Label.pdf

I think that's about everything you asked for (and more :-). Let me know if there's anything else I can provide to help out.

michaelrsweet commented 1 year ago

@SmittyHalibut Are you using the EPL or IPP Everywhere driver on the CUPS side? (the PPD file in /etc/cups/ppd will tell you that)

Right now LPrint doesn't auto-type EPL files (will see what I can do to add that) which is likely the cause of this problem for you.

Oberonc commented 1 year ago

@SmittyHalibut Are you using the EPL or IPP Everywhere driver on the CUPS side? (the PPD file in /etc/cups/ppd will tell you that)

Right now LPrint doesn't auto-type EPL files (will see what I can do to add that) which is likely the cause of this problem for you.

I have the same problem. Test page is printed successfully from the web interface of lprint. a PNG file is printed successfully from the command line using lprint.

Printer: Zebra ZD420 OS: Ubuntu 20.04 LTS PAPPL: 1.2.1 (latest release) lprint: latest from git

nosupport.txt

I tried using all 4 possible Zebra drivers (C***PL, EPL1, EPL2, ZPL) .. all with same results.

michaelrsweet commented 1 year ago

[master 92b1a94] Add EPL2 and ZPL auto-typing (Issue #64)

Note, however, that you really, REALLY want to be using the IPP Everywhere driver on the CUPS system and NOT the ZPL or EPL driver - let LPrint do what it is supposed to do.