Nixpkgs: DNS: regular problems again (unknown/captive APs)

Created on 25 Jun 2019  路  11Comments  路  Source: NixOS/nixpkgs

Issue description

I just can't seem to escape network/dns oddities in my NixOS laptop. I don't know exactly what's going on, so I'm going to try to coherently dump what I know and think is relevant:

  1. I use NetworkManager.

  2. I started traveling two weeks ago. I noticed that my NixOS box was virtually unusable on most wifi networks I connected to.

  3. Sometimes nothing would work - couldn't trigger a captive portal (I know neverssl.com to trigger an http redirect), couldn't hit DNS on 1.1.1.1/8.8.8.8, etc.

  4. Mostly noticed that DNS would work JUST FINE when trying dig @{router_ip} somehost.com

  5. Noticed that basically all of my problems would go away if I merely replaced the contents of /etc/resolv.conf to point at the router.

  6. I disabled systemd-resolved in my nixos config and basically all of these problems disappeared.

BUT, now we're back to the original issue, somehow, sort of? The usual suspect (restart NSCD) has not helped, but I keep finding myself in this case:

  1. I have Firefox open, everything seems to be more or less working. I hadn't tried Github, but gmail, mozilla's bugtracker, riot, all worked fine. They weren't pre-existing tabs either, I opened them AFTER connecting to this current wifi network. (It's also unlikely they were cached, this was a completely clean session/boot after having been in Windows)

  2. I can't git pull from github. Flat out can't, I get: ssh: Could not resolve hostname github.com: Name or service not known

  3. nmtui -> disconnect -> connect (same network)

  4. git pull works just fine

I can't think of anything I'm doing that is abnormal. Does anyone have any debugging tips. I can live with this (weird dns issues -> check systemd-resolved OR check nscd OR try reconnecting == 100% unblock rate), but it's not ideal.

Questions

  1. Is nm + systemd-resolved a supported configuration, upstream? In NixOS?

Technical details

Please run nix-shell -p nix-info --run "nix-info -m" and paste the
results.

stale nixos

All 11 comments

There are several explanations:

  • a recent bug made nixos-rebuild empty resolv.conf in absence of configured nameservers.
  • edns (extended dns) can be blocked on certain networks, but it's a default on nixos.
  • even though I know about the previous points I still have resolution problems like you do, which is really irritating, haven't looked into it yet though.

Try:

resolvectl flush-caches

In my caseFailed to flush caches: Unit dbus-org.freedesktop.resolve1.service not found so it shouldn't be the problem. At some point wonder if it was about IPv6 but I currently have the problem with only ipv4 in /etc/resolv.conf

(fwiw, I had certainly run that command (resolvectl flush-caches) when I had systemd-resolved and it was not fixing the problem. I very strongly suspect that edns is the culprit.)

I've started to wonder if Firefox has some sort of buggy behavior too. I didn't mention it earlier, but I do have times that I can not resolve ANY (aka, new, not negatively-cached misses) hostnames from an already-running Firefox, but if I open Chrome or restart Firefox, things will work normally. It's one of those symptoms that sound so illogical that I would normally suspect user-error or a bad memory, but it's a fairly regular occurence for me as well. Sometimes this even happens on my personal cell phone tether that normally "just works".

I do have times that I can not resolve ANY (aka, new, not negatively-cached misses) hostnames from an already-running Firefox, but if I open Chrome or restart Firefox, things will work normally.

Thank you! I'm not alone it seems. I have experienced this too but it's extremely sporadic.

I have too o/ I believe restarting firefox usually fixes it ?

I believe restarting firefox usually fixes it ?

For me, yes.

Yes, Firefox gets stuck for me sometimes. I haven't tried much to debug that. (I don't think it's related to the original post, though.)

Running into this also, particularly anytime my wifi drops and reconnects, Firefox continues to insist that I'm offline until I restart it. Chrome handles the transition fine.

I very strongly suspect that edns is the culprit.

FWIW, I use NetworkManager and resolveconf and I'm running with networking.resolvconf.dnsExtensionMechanism = false;, but it's possible firefox has its own edns thing internally?

Switching to DNS over HTTPS in Firefox didn't help either.

I had an issue with DNS while traveling. First i fixed it by disabling automatic DNS and setting 1.1.1.1 and 1.0.0.1 as DNS (Cloudflare). After reading a comment by @teto here, i've set

{ # ...
  networking.resolvconf.dnsExtensionMechanism = false;
}

and now the issue is gone (with the automatic DNS).

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

rzetterberg picture rzetterberg  路  3Comments

copumpkin picture copumpkin  路  3Comments

edolstra picture edolstra  路  3Comments

ayyess picture ayyess  路  3Comments