-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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 cannot print to network printer due to mdns timeouts #118628
Comments
Confirm, I have the same problem (with Xerox WorkCentre). And your workaround fixed it for me too. Thanks! |
I wanted to link this issue from the wiki and found that @juanibiapina added there a comment suggesting that he might have the same problem. @juanibiapina, does the above workaround make your setup work without restarting cups after booting? If yes, I'd update your comment, because it's not accurate. The |
Hi, I'm back and I'll test your workaround soon. About |
Sorry, I can't test it again. My printer is busted. |
OK, thanks for letting me know :-) |
Ok, my printer has sudently revived and this solves the issue for me as well. |
I marked this as stale due to inactivity. → More info |
Confirming that the issue still exists with current nixos-unstable. |
Out of curiosity, is this workaround supposed to break or use outdated softwares? If not, would it make sense to directly apply your workaround by default? |
This workaround makes mDNS working only for IPv4. If you are on a IPv6-only network, mDNS won't work for you. On mixed IPv4/IPv6 network, you might not see some devices. That's definitely not what some people want :-) Btw, #146406 may be relevant to this problem. I've not read all the comments there, but the keywords seem similar to what I remember when debugging this issue. I think the solution might be to increase or decrease some timeout somewhere, but I'm not sure where. More debugging/analysis is needed. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: |
Same happening here with a Canon MF643C. I found a workaround, but yours seems better. Mine was to manually add the name.local expected on '/etc/hosts' file. This only works if your printer has a fixed ip (like 10.1.2.3). networking.extraHosts = |
I also hit this issue. Given that (I assume) most people are running ipv4, can we not try the v4 exclusive module first, and still fallback to the one that also works with v6, so that it "just works" for this rather common use case? Given, that will slowdown v6 name resolution, but I guess we could also add a big warning in the option. |
Looks like this is closed by bba808d services.printing.enable = true;
services.avahi.enable = true;
services.avahi.nssmdns4 = true; |
Unfortunately, that commit is not sufficient for me. Current version of CUPS complains with: "No destination host name supplied by cups-browsed for printer "Brother_MFC_L2700DW_series_mDNS", is cups-browsed running?" The referenced commit makes my
With it, running
From the output of Anyway, if I disable IPv6 in the printer, What I need is |
Please submit a PR. |
…mdns source This is a followup to commit bba808d ("nixos/avahi-daemon: resolve mdns only over enabled protocols, disable ipv6 by default", 2023-10-01, PR NixOS#258424). mdns occurs twice in /etc/nsswitch.conf but that commit changed only the first one (mdns_minimal, before resolve). This commits ensures that both occurrences are set consistently. This is not only consistent with upstream example[1] but it also fixes NixOS#118628 -- a longstanding issue with CUPS and printer detection. [1] https://github.com/avahi/nss-mdns#activation
https://fosstodon.org/@adingbatponder/111716425335189702 Uses a direct printer install. Same sort of problems encountered. |
Describe the bug
When printing to Brother MFC-L2700DW printer (with this package created from a similar model in nixpkgs), CUPS often (but not always) complains about "Impossible to connect to printerCCB4208.local: Name or service not known" even though I followed the instructions from NixOS wiki and enabled
services.avahi.nssmdns
.To Reproduce
Steps to reproduce the behavior:
Expected behavior
The job is sent to the printer and printed.
Additional context
When the printer cannot be connected, running
systemctl restart cups nscd
usually helps and the stuck job gets to the printer.After my investigation, I think that the cause is long delay in mDNS name resolution. By default NixOS uses
mdns
NSS module, which tries to resolve both IPv4 and IPv6 addresses sequentially. It seems to start with IPv6, which does not resolve to a valid address so after 5s timeout the resolution continues with IPv4. So the address of the printer is returned after slightly more that 5 seconds (can be verified withtime getent hosts printerCCB4208.local
), which seems to be too long for CUPS so it gives up and tries again later and the same repeats, because nscd in NixOS does not cache the results.My current solution to the problem is to switch from
mdns
NSS tomdns4
with the following in myconfiguration.nix
:I've also tried
services.avahi.ipv6 = false;
but it didn't help.The question is whether to make it easier for others. Possible things that come to my mind:
nssmdns4
option.Notify maintainers
@matthewbauer @andir
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result."x86_64-linux"
Linux 5.4.108, NixOS, 21.05pre279456.04a2b269d89 (Okapi)
yes
yes
nix-env (Nix) 2.3.10
"nixos-21.05pre279456.04a2b269d89, nixos-hardware"
"home-manager"
/home/wsh/nix/nixpkgs
Maintainer information:
The text was updated successfully, but these errors were encountered: