Change:
Describe the bug Most of my programs is unable resolve DNS after I updated my system to (from the last time nixos-ustables was updated which is approximately 14 days ago). This includes curl, chrome, resolvectl and nix which basically makes my system unusable. One really weird exception is the tool which is actually able to query both a remote server (such as 8.8.8.8) and the local systemd-resolved server to resolve DNS (which indicates that this is probably not the fault of systemd). There's also a error message in systemd-resolved's that said "Failed to escape hostname: Invalid argument". I also tried to edit my file to change the nameserver to 8.8.8.8 and that didn't change anything. here are some examples of the errors returned by those programs: To Reproduce I don't really know how to reproduct this issue Expected behavior DNS should be working properley on all programs Additional context Add any other context about the problem here. Notify maintainers <!-- Please @ people who are in the list of the offending package or module. If in doubt, check for whoever last touched something. --Metadata Please run and paste the result. Maintainer information:
Programs which are broken are using the libc calls to resolve the hostname, looks like the nss module from systemd-resolved can't resolve the hostname either. This looks to be some kind of failure within systemd-resolved, since systemd-resolve on the CLI fails with . We should also open an upstream bug unless we find some evidence that this is caused by NixOS.
This bug affects me too. Same error and same logs.
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
Same bug on my end.
I think I figured out what's the problem here. I opened an upstream issue: Can you try if the following patch works around the issue?
that worked! (though I have to manually edit the service file since automatic GC kicked in and I cannot rebuild my system:facepalm:) Also, I feel like there should be a basic network connectivity test to prevent bugs like this from being merged into the unstable channel.
And thanks for the quick action ! I agree, but I thought we actually have them for unstable?
I've the following to my : and I can confirm systemd-resolved works again. Now, how do you get to rebuild your system if like you don't have a working system to rollback to? I did (as root): to force using that file in order to be able to run .
aw man I did not know that if you stop systemd-resolved it will resolve normally. I removed the symlink and created a new directory there, copied everything from to there, manually edited systemd-resolved.service, and ran and after that restarted systemd-resolved. method is definitely more superior.
So... for now we push this workaround to nixpkgs master?
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
I'd say yes. Especially if there's no quick upstream fix in perspective. Hopefully this problem only affects users following unstable.
Stable doesn't get systemd updates, so it shouldn't be affected (based on flokli's analysis).
PR at

Discussion:
<del> { config, lib, ... }: </del> <ins> { config, pkgs, lib, ... }: </ins> with lib; let

wantedBy = [ "multi-user.target" ]; aliases = [ "dbus-org.freedesktop.resolve1.service" ]; restartTriggers = [ config.environment.etc."systemd/resolved.conf".source ]; <ins> # Upstream bug: https://github.com/systemd/systemd/issues/18078 # systemd-resolved without libidn2 is broken environment.LD_LIBRARY_PATH = "${lib.getLib pkgs.libidn2}/lib"; </ins> }; environment.etc = {