cups 返回通用“打印文件未被接受”错误,文件不打印

cups 返回通用“打印文件未被接受”错误,文件不打印

我无法使用 EL7 上的 cups 打印任何文件(txt、pdf 等)。

这项工作似乎已被接受,但将 cups 日志级别设置为调试时,我看到以下情况:

D [01/May/2017:10:36:52 -0400] cupsdSetBusyState: newbusy="Dirty files", busy="Dirty files"
D [01/May/2017:10:36:52 -0400] [Job 18] Looking up "1.2.3.4"...
D [01/May/2017:10:36:52 -0400] Discarding unused printer-state-changed event...
D [01/May/2017:10:36:52 -0400] [Job 18] Connecting to 1.2.3.4:631
I [01/May/2017:10:36:52 -0400] [Job 18] Connecting to printer.
D [01/May/2017:10:36:52 -0400] cupsdMarkDirty(---J-)
D [01/May/2017:10:36:52 -0400] cupsdSetBusyState: newbusy="Dirty files", busy="Dirty files"
D [01/May/2017:10:36:52 -0400] [Job 18] Set job-printer-state-message to "Connecting to printer.", current level=INFO
D [01/May/2017:10:36:52 -0400] Discarding unused job-progress event...
D [01/May/2017:10:36:52 -0400] Discarding unused printer-state-changed event...
D [01/May/2017:10:36:52 -0400] [Job 18] update_reasons(attr=0(), s="-cups-certificate-error")
D [01/May/2017:10:36:52 -0400] [Job 18] update_reasons(attr=0(), s="-connecting-to-device")
D [01/May/2017:10:36:52 -0400] [Job 18] STATE: -connecting-to-device
D [01/May/2017:10:36:52 -0400] cupsdMarkDirty(---J-)
D [01/May/2017:10:36:52 -0400] cupsdSetBusyState: newbusy="Printing jobs and dirty files", busy="Dirty files"
I [01/May/2017:10:36:52 -0400] [Job 18] Connected to printer.
D [01/May/2017:10:36:52 -0400] cupsdMarkDirty(---J-)
D [01/May/2017:10:36:52 -0400] cupsdSetBusyState: newbusy="Printing jobs and dirty files", busy="Printing jobs and dirty files"
D [01/May/2017:10:36:52 -0400] [Job 18] Set job-printer-state-message to "Connected to printer.", current level=INFO
D [01/May/2017:10:36:52 -0400] [Job 18] Connected to 1.2.3.4:631...
D [01/May/2017:10:36:52 -0400] [Job 18] Getting supported attributes...
D [01/May/2017:10:36:52 -0400] Discarding unused job-progress event...
D [01/May/2017:10:36:52 -0400] Discarding unused printer-state-changed event...
D [01/May/2017:10:36:53 -0400] [Job 18] Get-Printer-Attributes: successful-ok (successful-ok)
D [01/May/2017:10:36:53 -0400] [Job 18] copies-supported=1-32000
D [01/May/2017:10:36:53 -0400] [Job 18] document-format-supported (7 values)
D [01/May/2017:10:36:53 -0400] [Job 18] [0] = "text/plain"
D [01/May/2017:10:36:53 -0400] [Job 18] [1] = "application/octet-stream"
D [01/May/2017:10:36:53 -0400] [Job 18] [2] = "application/vnd.hp-PCL"
D [01/May/2017:10:36:53 -0400] [Job 18] [3] = "application/vnd.hp-PCLXL"
D [01/May/2017:10:36:53 -0400] [Job 18] [4] = "application/postscript"
D [01/May/2017:10:36:53 -0400] [Job 18] [5] = "application/pdf"
D [01/May/2017:10:36:53 -0400] [Job 18] [6] = "image/urf"
D [01/May/2017:10:36:53 -0400] [Job 18] media-col-supported (8 values)
D [01/May/2017:10:36:53 -0400] [Job 18] [0] = "media-type"
D [01/May/2017:10:36:53 -0400] [Job 18] [1] = "media-size"
D [01/May/2017:10:36:53 -0400] [Job 18] [2] = "media-top-margin"
D [01/May/2017:10:36:53 -0400] [Job 18] [3] = "media-left-margin"
D [01/May/2017:10:36:53 -0400] [Job 18] [4] = "media-right-margin"
D [01/May/2017:10:36:53 -0400] [Job 18] [5] = "media-bottom-margin"
D [01/May/2017:10:36:53 -0400] [Job 18] [6] = "media-source"
D [01/May/2017:10:36:53 -0400] [Job 18] [7] = "duplex-supported"
D [01/May/2017:10:36:53 -0400] [Job 18] operations-supported (11 values)
D [01/May/2017:10:36:53 -0400] [Job 18] [0] = Print-Job
D [01/May/2017:10:36:53 -0400] [Job 18] [1] = Print-URI
D [01/May/2017:10:36:53 -0400] [Job 18] [2] = Validate-Job
D [01/May/2017:10:36:53 -0400] [Job 18] [3] = Create-Job
D [01/May/2017:10:36:53 -0400] [Job 18] [4] = Send-Document
D [01/May/2017:10:36:53 -0400] [Job 18] [5] = Send-URI
D [01/May/2017:10:36:53 -0400] [Job 18] [6] = 0x003c
D [01/May/2017:10:36:53 -0400] [Job 18] [7] = Cancel-Job
D [01/May/2017:10:36:53 -0400] [Job 18] [8] = Get-Job-Attributes
D [01/May/2017:10:36:53 -0400] [Job 18] [9] = Get-Jobs
D [01/May/2017:10:36:53 -0400] [Job 18] [10] = Get-Printer-Attributes
D [01/May/2017:10:36:53 -0400] [Job 18] update_reasons(attr=1(none), s="(null)")
D [01/May/2017:10:36:53 -0400] [Job 18] STATE: -none
D [01/May/2017:10:36:53 -0400] [Job 18] ATTR: marker-colors='"none"','"#000000"'
D [01/May/2017:10:36:53 -0400] cupsdMarkDirty(P----)
D [01/May/2017:10:36:53 -0400] cupsdSetBusyState: newbusy="Printing jobs and dirty files", busy="Printing jobs and dirty files"
D [01/May/2017:10:36:53 -0400] [Job 18] ATTR: marker-high-levels=100,100
D [01/May/2017:10:36:53 -0400] cupsdMarkDirty(P----)
D [01/May/2017:10:36:53 -0400] cupsdSetBusyState: newbusy="Printing jobs and dirty files", busy="Printing jobs and dirty files"
D [01/May/2017:10:36:53 -0400] [Job 18] ATTR: marker-levels=74,25
D [01/May/2017:10:36:53 -0400] cupsdMarkDirty(P----)
D [01/May/2017:10:36:53 -0400] cupsdSetBusyState: newbusy="Printing jobs and dirty files", busy="Printing jobs and dirty files"
D [01/May/2017:10:36:53 -0400] [Job 18] ATTR: marker-low-levels=2,8
D [01/May/2017:10:36:53 -0400] cupsdMarkDirty(P----)
D [01/May/2017:10:36:53 -0400] cupsdSetBusyState: newbusy="Printing jobs and dirty files", busy="Printing jobs and dirty files"
D [01/May/2017:10:36:53 -0400] [Job 18] ATTR: marker-message='"none"'
D [01/May/2017:10:36:53 -0400] cupsdMarkDirty(P----)
D [01/May/2017:10:36:53 -0400] cupsdSetBusyState: newbusy="Printing jobs and dirty files", busy="Printing jobs and dirty files"
D [01/May/2017:10:36:53 -0400] [Job 18] ATTR: marker-names='"Maintenance Kit"','"Black Cartridge"'
D [01/May/2017:10:36:53 -0400] cupsdMarkDirty(P----)
D [01/May/2017:10:36:53 -0400] cupsdSetBusyState: newbusy="Printing jobs and dirty files", busy="Printing jobs and dirty files"
D [01/May/2017:10:36:53 -0400] [Job 18] ATTR: marker-types='"maintenanceKit"','"tonerCartridge"'
D [01/May/2017:10:36:53 -0400] cupsdMarkDirty(P----)
D [01/May/2017:10:36:53 -0400] cupsdSetBusyState: newbusy="Printing jobs and dirty files", busy="Printing jobs and dirty files"
D [01/May/2017:10:36:53 -0400] [Job 18] final_content_type="application/pdf", document_format="application/pdf"
D [01/May/2017:10:36:53 -0400] [Job 18] Validate-Job IPP/2.0
D [01/May/2017:10:36:53 -0400] [Job 18] printer-uri="ipp://1.2.3.4:631/"
D [01/May/2017:10:36:53 -0400] [Job 18] requesting-user-name="root"
D [01/May/2017:10:36:53 -0400] [Job 18] job-name="flyer.pdf"
D [01/May/2017:10:36:53 -0400] [Job 18] document-format="application/pdf"
D [01/May/2017:10:36:53 -0400] Discarding unused printer-state-changed event...
D [01/May/2017:10:36:53 -0400] [Job 18] Validate-Job: client-error-bad-request (client-error-bad-request)
D [01/May/2017:10:36:53 -0400] [Job 18] Create-Job IPP/2.0
D [01/May/2017:10:36:53 -0400] [Job 18] printer-uri="ipp://1.2.3.4:631/"
D [01/May/2017:10:36:53 -0400] [Job 18] requesting-user-name="root"
D [01/May/2017:10:36:53 -0400] [Job 18] job-name="flyer.pdf"
D [01/May/2017:10:36:53 -0400] [Job 18] update_reasons(attr=1(none), s="(null)")
D [01/May/2017:10:36:53 -0400] [Job 18] Get-Printer-Attributes: successful-ok (successful-ok)
D [01/May/2017:10:36:53 -0400] [Job 18] Create-Job: client-error-bad-request (client-error-bad-request)
E [01/May/2017:10:36:53 -0400] [Job 18] Print file was not accepted.
D [01/May/2017:10:36:53 -0400] cupsdMarkDirty(---J-)
D [01/May/2017:10:36:53 -0400] cupsdSetBusyState: newbusy="Printing jobs and dirty files", busy="Printing jobs and dirty files"
D [01/May/2017:10:36:53 -0400] [Job 18] Set job-printer-state-message to "Print file was not accepted.", current level=ERROR

我暂时禁用了 SELinux,但没有效果。

我清除了 cups 打印机缓存并发送了一个纯文本 TXT 文档,但出现同样的错误(除了作业名称反映其他文件)。

1)对于导致“打印文件不被接受”的原因,您有什么想法吗?

2)有没有办法增加 cups 日志的详细程度,以便找出为什么文件未被接受?

答案1

我找到了我的物理打印机的 PPD 文件,并相应地设置了 cups 打印机:

lpadmin -p printer_office_v2 -E -v ipp://1.2.3.4 -P /etc/cups/ppd/laserjet.ppd

现在可以打印文件。

答案2

我昨天和打印机斗争了至少两个小时,我遇到的第一个问题就是这个......“打印文件不被接受”。谷歌搜索没有帮助(但我最终还是来到这里),所以我将分享我的经验,并希望其他谷歌搜索的人能找到它......

我可以 ping 打印机,我可以通过 http 连接它(并启动了一些管理 webui 控制台,无需任何密码,但无法从该控制台打印)。我还使用 tcpdump 来确保 CUPS 和打印机之间有通信 - 但我不明白其中的很多乱码。除了 CUPS 的“打印文件未被接受”之外,任何地方都没有明确的错误消息。

经过一番咒骂之后,我意识到“打印文件未被接受”的错误信息可能是由于我的计算机与“HP ENVY Photo 6200”打印机位于不同的子网。我找不到打印机上的任何访问设置,但它当然不接受来自互联网的随机打印作业。

可以通过将打印作业路由到与打印机位于同一子网的计算机或成为子网的一部分(即使用 VPN)来解决此问题。我最终使用 ssh 开辟了一条隧道(ssh -L8888:10.0.92.171:631 some-machine-in-subnet,然后将 localhost:8888 设置为打印机 URL)。

我的第二个问题是 CUPS 未使用 PPD 文件进行设置,但错误消息有所不同,“无法将文档添加到打印作业”。通过检查 CUPS 错误日志,可以轻松将此问题确定为缺少的 PPD。我在 hplip 包中找到了 PPD 文件,并通过 CUPS Web UI 安装了它,尽管上面答案中建议的 lpadmin 命令也应该有效。

答案3

在我的例子中,我以菊花链方式连接了两个 cups 服务器。第一个服务器显示错误消息“打印文件未被接受”,第二个也是最后一个服务器显示“未找到打印机”。我不得不关闭打印机电源,然后一切又恢复正常。

相关内容