apple / cups

Apple CUPS Sources
https://www.cups.org
Apache License 2.0
1.91k stars 462 forks source link

Auto-creation of queue for IPP printer stopped working #5035

Closed tillkamppeter closed 7 years ago

tillkamppeter commented 7 years ago

I have an HP OfficeJet Pro 8500 A910 which supports driverless printing based on Apple AirPrint/Apple Raster. It works perfectly with cups-browsed but it also works with CUPS itself auto-creating a print queue when simply sending a job or checking for available options. At least this worked until commit 4a366251171. Now it does not work any more, but I do not actually know from which commit on. Output of lpstat -l -e | grep -v permanent: Officejet_Pro_8500_A910_173F35_ network none ipp://Officejet%20Pro%208500%20A910%20%5B173F35%5D._ipp._tcp.local/ I assume that the "network none" means that this is a network printer for which there is not yet a queue. If I do lp -d Officejet_Pro_8500_A910_173F35_ ~/.gitconfig it takes some minutes and after that I get "lp: The printer or class does not exist.". And with lpoptions -p Officejet_Pro_8500_A910_173F35_ -l I get the message "lpoptions: Unable to get PPD file for Officejet_Pro_8500_A910173F35: The printer or class does not exist." immediately. Both commands should trigger the auto-creation of a (temporary) print queue and after that the first command should print a job and the second display the PPD options. Now I tried to manually create a (permanent) queue via lpadmin -p OJ -E -v ipp://Officejet%20Pro%208500%20A910%20%5B173F35%5D._ipp._tcp.local/ -m everywhere using the (odd) device URI which "lpstat -l -e" has shown. I get "lpadmin: Request Entity Too Large" and a raw queue with the strange URI gets created. Also if I use the (intuitive) device URI derived from the DNS-SD record of the printer (can also be displayed by running the command "driverless" from cups-filters): lpadmin -p OJ -E -v ipp://HP173F35.local:631/ipp/printer -m everywhere I get the error message "lpadmin: Request Entity Too Large" and a raw queue, and the same when I try dnssd://Officejet%20Pro%208500%20A910%20%5B173F35%5D._ipp._tcp.local/ as URI. Another thing I observed (and it could perhaps cause the problem, but I am not sure): Whenever I enter an "lpadmin" command I get asked for my password (and also if I try to create a print queue with a printer setup tool like system-config-printer I get asked for my password), but I am in the "lpadmin" group.

tillkamppeter commented 7 years ago

My /var/log/cups/error_log file in debug mode: error_log.txt

tillkamppeter commented 7 years ago

ipptool -tv ipp://HP173F35.local:631/ipp/printer get-printer-attributes.test > ~/HP-OfficeJet-Pro-8500-A910-ipp-attrs.txt HP-OfficeJet-Pro-8500-A910-ipp-attrs.txt

michaelrsweet commented 7 years ago

@tillkamppeter The authentication issue looks to be a configuration issue:

Unable to create certificate file /usr/var/run/cups/certs/0 - No such file or directory

Check that the StateDir setting in cups-files.conf is right - it should be resolving to just /var/run/cups in the configure script using the default prefix (but using --prefix=/usr will likely break that thanks to autoconf...)

michaelrsweet commented 7 years ago

@tillkamppeter The relevant log lines for the PPD creation failure are:

D [19/Jun/2017:23:12:49 -0300] Officejet_Pro_8500_A910_173F35_: Connected to HP173F35.local:631, sending Get-Printer-Attributes request...
D [19/Jun/2017:23:12:49 -0300] Officejet_Pro_8500_A910_173F35_: Get-Printer-Attributes returned successful-ok
E [19/Jun/2017:23:12:49 -0300] Officejet_Pro_8500_A910_173F35_: PPD creation failed.

Unfortunately, I wasn't logging the reason for the failure so we don't have a lot to go on yet. But I pushed a change for that:

[master 956bb1274] Actually show the reason why PPD creation failed (Issue #5035)

Please retry with the latest Github master code and provide the "PPD creation failed" error message from the error_log...

tillkamppeter commented 7 years ago

I have followed your hint about the certificate first and fixed that. This solved the Queue/PPD generation problem altogether. Probably CUPS itself was also not able to create queues and or put a PPD file into /etc/cups/ppd/ without having a directory for its certificates. Now all is working perfectly. Thank you very much.

michaelrsweet commented 7 years ago

It was probably an issue of creating a temporary file in a directory that did not exist... At least the updated code will log the reason...