CUPS can add printer and driver OK, but then can't find the printer to actually spool the job?

I have a Canon ImageCLASS MF445dw wireless printer that uses the recently updated (and still in unstable channel) canon-cups-ufr2 driver. CUPS detects the printer quite readily, and I’m able to add the correct driver, but when it tries to send a file, CUPS can’t locate printer:

"Unable to locate printer "Canon7603ea.local"."

where Canon7603ea.local is the printer’s network name (I believe this hostname is generated from its UUID). However, avahi is able to resolve this hostname OK, and although getent hosts can be slow to obtain a match, I can ping the hostname successfully:

$ avahi-resolve --name Canon7603ea.local
Canon7603ea.local       192.168.0.182
$ time getent hosts Canon7603ea.local
192.168.0.182   Canon7603ea.local

real    0m10.008s
user    0m0.002s
sys     0m0.001s

$ ping Canon7603ea.local
PING Canon7603ea.local (192.168.0.182) 56(84) bytes of data.
64 bytes from 192.168.0.182 (192.168.0.182): icmp_seq=1 ttl=64 time=99.5 ms
64 bytes from 192.168.0.182 (192.168.0.182): icmp_seq=3 ttl=64 time=38.1 ms
64 bytes from 192.168.0.182 (192.168.0.182): icmp_seq=4 ttl=64 time=60.3 ms

The reverse query with avahi does time out, however:

$ avahi-resolve --address 192.168.0.182
Failed to resolve address '192.168.0.182': Timeout reached

CUPS does seem to be able to communicate with the device OK, at least in a limited way (e.g., reports a low toner message, which is correct), but doesn’t seem to be able to correctly spool jobs. I’ve tried printing test pages, usually with the response above. Every once in a while CUPS will report successful job completion of one of these tests, although there is never any activity at the printer, and the printer’s own web page shows no jobs were sent. This leads me to believe that there is some sort of timing issue with CUPS. The printer works fine from other (Mac, Windows) machines.

I did see a note on NixOS printing wiki mentioning a problem with mdns not working properly with IPv6 , but the printer and router are not even set up for IPv6 (I did try the suggested fix anyway without success). Anyway, I’d be grateful of any suggestions of what to try next.

13 Aug 2022 Edited: moved to Learn category on discourse.nixos.org, and my thanks to @Sandro for updating the canon-cups-ufr2 driver

2 Likes

I’ve noticed similar issues with my printer. If I change the address in Cups to be the IP of my printer, it seems to work consistently, but this is a lame solution and maybe my printer’s IP will change at some point.

1 Like

Hi Ryan, thanks for your reply. I have tried different configurations in cups, including simply using the ip address, etc., all to no avail: typically jobs are submitted to “successfully” to CUPS, in other words, CUPS reports completion, but with zero activity at the printer, and with the files still residing in the spool file /var/spool/cups. I really don’t understand what’s going on: the printer has worked under every other distro using the same driver from Canon, so I have to conclude there is something fundamentally wrong with the way CUPS is set up here. I’m out of things to try, though. :confused:

1 Like

OK, this is not really solved, but it works. I think the problem is really in two parts: first, CUPS finding the printer, and second: the driver. I added an entry in my configuration.nix file to further populate my /etc/hosts, equating the printer’s hostname with its local IP address; that change may have helped eliminate CUPS not being able to find the printer:

  networking.hosts = {
    "192.168.0.182" = [ "Canon7603ea.local" "Canon7603ea" ];
  };

But to be clear, the connection chosen by CUPS by default (the one it finds on its own, not specified by me),

dnssd://Canon%20MF440%20Series._ipp._tcp.local/?uuid=6d4ff0ce-6b11-11d8-8020-00bbc17603ea

works fine[1]: it was apparently the driver which was the issue. Even when CUPS successfully [sic] completed jobs, there was never any printer output (and no record of rejection in the printer’s own log file). It wasn’t until I changed the driver, per the suggestion from @peterhoeg about IPP Everywhere™ in this post, then I got the thing to actually print. So I selected the default printer that CUPS finds, but then selected the IPP Print Everywhere driver (actually the first on the Canon list, and not the canon-cups-ufr2 driver listed for this model). One caveat: CUPS test pages won’t print correctly (there will be some output, but not pretty) – as far as CUPS is concerned, this is just a Local Raw Printer with very few, if any features. But it does print, finally. :grinning:

Hope this saves someone else some time — I wasted many hours on this.
Edit added: Just to be clear, this isn’t really a permanent solution: it only gives you printing via lpr <filename>, and this printer won’t show up in many applications (default printer will be “print_to_file”).

[1] But only as a raw printer in conjunction with lpr – see note above.

1 Like

Good idea using network.hosts! I bet that will fix the issues I’m seeing (which are probably different than yours).

networking.hosts = {
“192.168.0.182” = [ “Canon7603ea.local” “Canon7603ea” ];
};

Printer discovery using any of the supposedly smart and easy-to-use protocols is unreliable regardless of platform - Windows, mac, Linux doesn’t matter. Manually configuring the connection is almost always the best option.

then selected the IPP Print Everywhere driver

It’s mentioned on the wiki but maybe it should be more prominent.

1 Like

Thanks to all who responded here. I’ve since learned that Canon may not actually support IPP Everywhere™ (it does support Apple’s AirPrint, but that’s different[1]), and at least according to OpenPrinting and the Printer Working Group, the only manufacturers to actively embrace true driverless printing are HP, Lexmark, and Oki.

That said, I finally did get the printer to register and print from applications such as Okular by explicitly choosing a RAW print queue (meaning output is shipped directly without a PPD file to the printer, which in this case can accept pdfs and at least some graphics files on its own). I don’t think the service discovery and initial communication with the printer, however accomplished (avahi, mdns/dnssd), was really the problem. The problem is that the canon-cups-ufr2 driver in NixOS just doesn’t seem to produce output at the printer (as to where the problem actually resides, I don’t know). Thanks again to all who answered and helped me on this problem.

[1] In this thread, Michael Sweet at Apple indicates that AirPrint support via CUPS will not happen:

You can publish DNS-SD records and iOS will use them, but you can’t make cupsd advertise them for you since we know CUPS + drivers != AirPrint.

1 Like

I’m sorry, that’s a cop out. Sure, mDNS can be unreliable in some challenging network environments, but when the computer and the printer are on the same switch, mDNS is very reliable.

When this works avahi-resolve-host-name NPI6AF238.local. but this doesn’t ping NPI6AF238.local., the network is misconfigured.

Add services.avahi.enable = true and services.avahi.nssmdns = true to your configuration.nix.

2 Likes

I had the opposite problem at one stage: it found a printer, and added it, and then found it, and added it, and found it, and added it, until I had something like 30 instances… none of which (or, perhaps, exactly one?) actually worked AFAICT

I’m sorry, that’s a cop out.

I realize that I worded my earlier reply rather poorly.

mDNS itself is (probably) not the issue, but instead that auto-discovered printers from Windows and macOS clients have a tendency to become unavailable for what seems to be no obvious reason, requiring them to be removed and re-added to function again.

My point was that instead of counting of auto-discovery to provide a reliably working printer in my experience is a poor choice and instead configuring them explicitly works far better.

The printer’s name is likely to be more stable than the printer’s IP address.

Listen, if auto-discovery/setup works for you, that’s all good. Nobody is asking you to change. I am just saying that in my experience, it’s been awful across platforms and networks and various family members have stopped calling asking for help with the printers after going the other route. Because it just works.

My printer gets a new IP address every time the router & the printer lose power at the same time (like during a power outage).

Have you considered making it a permanent lease in your routers configuration or attach a preconfigured IP to the printer that is out of the DHCP range?

For those landing here with problems with printing to Canon ImageCLASS and iSensys printers, please see the later posts here for hints on how to get these beasts to function in NixOS.