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:
I use NetworkManager.
I started traveling two weeks ago. I noticed that my NixOS box was virtually unusable on most wifi networks I connected to.
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.
Mostly noticed that DNS would work JUST FINE when trying dig @{router_ip} somehost.com
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.
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:
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)
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
nmtui -> disconnect -> connect (same network)
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.
nm + systemd-resolved a supported configuration, upstream? In NixOS?Please run nix-shell -p nix-info --run "nix-info -m" and paste the
results.
There are several explanations:
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: