Just trying to install on Ubuntu 18.04. Somehow my system curl can just download the file, but then some part of the installer can't resolve the host name?
$ bash <(curl https://nixos.org/nix/install) -127-
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2472 100 2472 0 0 10519 0 --:--:-- --:--:-- --:--:-- 10519
downloading Nix 2.1.3 binary tarball for x86_64-linux from 'https://nixos.org/releases/nix/nix-2.1.3/nix-2.1.3-x86_64-linux.tar.bz2' to '/tmp/nix-binary-tarball-unpack.WVAREBHpg0'...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 21.2M 100 21.2M 0 0 3390k 0 0:00:06 0:00:06 --:--:-- 3603k
Note: a multi-user installation is possible. See https://nixos.org/nix/manual/#sect-multi-user-installation
performing a single-user installation of Nix...
directory /nix does not exist; creating it by running 'mkdir -m 0755 /nix && chown florian /nix' using sudo
[sudo] password for florian:
copying Nix to /nix/store................................
initialising Nix database...
Nix: creating /home/florian/.nix-profile
installing 'nix-2.1.3'
building '/nix/store/9jddl2a8j1igdq3ml4lw8m2609ri0m89-user-environment.drv'...
created 6 symlinks in user environment
warning: unable to download 'https://nixos.org/channels/nixpkgs-unstable': Couldn't resolve host name (6); retrying in 340 ms
warning: unable to download 'https://nixos.org/channels/nixpkgs-unstable': Couldn't resolve host name (6); retrying in 652 ms
warning: unable to download 'https://nixos.org/channels/nixpkgs-unstable': Couldn't resolve host name (6); retrying in 1072 ms
warning: unable to download 'https://nixos.org/channels/nixpkgs-unstable': Couldn't resolve host name (6); retrying in 2240 ms
error: unable to download 'https://nixos.org/channels/nixpkgs-unstable': Couldn't resolve host name (6)
$ host nixos.org -127-
nixos.org has address 54.217.220.47
nixos.org mail is handled by 10 mx00.udag.de.
nixos.org mail is handled by 20 mx01.udag.de.
Ok, it seems to have installed just fine - the same error when running ~/.nix-profile/bin/nix-channel --update.
What's the contents of your /etc/nsswitch.conf? There may be some NSS modules there that Nix's Glibc doesn't have access to.
@winks Had the same issue, Googled to find #687, solution on my distro (Arch):
$ systemctl start nscd
@edolstra
passwd: compat systemd
group: compat systemd
shadow: compat
gshadow: files
#hosts: files mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns
hosts: files resolve mdns4_minimal [NOTFOUND=return] [!UNAVAIL=return] dns
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
And yes, putting dns before resolve works, but I don't see this as a solution, see below.
@Zopieux thanks, but I don't have nscd and I don't plan on installing it just for nixpkgs.
Also this worked on 16.04 ootb, so I do think it's not an other-OS problem per se, if one assumes that nixpkgs is supposed to work on other distros, and name resolution in general works. I can't believe this would be the only application on my machine that doesn't work without nscd.
Most helpful comment
@winks Had the same issue, Googled to find #687, solution on my distro (Arch):