Transcript below. This is on Linux Mint 18.3.
[phil:~/repos] 8m45s $ cargo install mdbook
Updating registry `https://github.com/rust-lang/crates.io-index`
Downloading mdbook v0.2.0
warning: spurious network error (2 tries remaining): [6] Couldn't resolve host name (Could not resolve host: static.crates.io)
warning: spurious network error (1 tries remaining): [6] Couldn't resolve host name (Could not resolve host: static.crates.io)
error: [6] Couldn't resolve host name (Could not resolve host: static.crates.io)
[phil:~/repos] 8m50s $ ping static.crates.io
PING d19xqa3lc3clo8.cloudfront.net (13.32.67.146) 56(84) bytes of data.
64 bytes from server-13-32-67-146.lhr4.r.cloudfront.net (13.32.67.146): icmp_seq=1 ttl=245 time=17.1 ms
64 bytes from server-13-32-67-146.lhr4.r.cloudfront.net (13.32.67.146): icmp_seq=2 ttl=245 time=17.4 ms
64 bytes from server-13-32-67-146.lhr4.r.cloudfront.net (13.32.67.146): icmp_seq=3 ttl=245 time=15.9 ms
64 bytes from server-13-32-67-146.lhr4.r.cloudfront.net (13.32.67.146): icmp_seq=4 ttl=245 time=22.8 ms
^C
--- d19xqa3lc3clo8.cloudfront.net ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 15.925/18.333/22.830/2.657 ms
[phil:~/repos] 9m1s $ cargo --version
cargo 1.29.0-nightly (b42488270 2018-08-04)
[phil:~/repos] 9m4s $
Maybe just a transient error? WFM..
09:21:02 $ ping static.crates.io
PING d19xqa3lc3clo8.cloudfront.net (143.204.192.7): 56 data bytes
64 bytes from 143.204.192.7: icmp_seq=0 ttl=237 time=3.556 ms
64 bytes from 143.204.192.7: icmp_seq=1 ttl=237 time=6.756 ms
64 bytes from 143.204.192.7: icmp_seq=2 ttl=237 time=10.586 ms
64 bytes from 143.204.192.7: icmp_seq=3 ttl=237 time=3.073 ms
64 bytes from 143.204.192.7: icmp_seq=4 ttl=237 time=2.178 ms
64 bytes from 143.204.192.7: icmp_seq=5 ttl=237 time=2.985 ms
^C
--- d19xqa3lc3clo8.cloudfront.net ping statistics ---
6 packets transmitted, 6 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 2.178/4.856/10.586/2.943 ms
It's not transient, in fact if you look at the original post I did try pinging that host and it succeeded, but the cargo command failed. Since then I have rebooted and it still fails with the same error.
Interestingly, I have two Windows computers connected to the Internet via the same router, and installing mdbook in both Cygwin and WSL works fine. So it looks like something is screwed with the Linux mint installation? No idea what though.
Further fact: cloning mdbook and building it manually using cargo build works fine.
I have the same failure when trying to fetch dependencies like getopt while building rustc-1.25.0 using BLFS instructions on Ubuntu 14.04.
The symptoms are the same: I can ping static.crates.io, but cargo fails to resolve the host. Adding the 13.33.76.234 static.crates.io line to /etc/hosts works around the problem (the IP address was taken from ping output).
Same thing occurs with cargo install alacritty. This is really annoying - I can't even build alacritty after cloning the repo:
$ cargo build --release
Updating git repository `https://github.com/jwilm/rust-fontconfig`
Updating git repository `https://github.com/jwilm/libfontconfig`
Downloading arraydeque v0.4.2
warning: spurious network error (2 tries remaining): [6] Couldn't resolve host name (Could not resolve host: static.crates.io)
warning: spurious network error (1 tries remaining): [6] Couldn't resolve host name (Could not resolve host: static.crates.io)
error: unable to get packages from source
Caused by:
[6] Couldn't resolve host name (Could not resolve host: static.crates.io)
Does anybody have a clue on what is causing it or how to fix it?
Probably DNS issues, you can try using different DNS servers.
Same issue on Arch, using 8.8.8.8
~ î‚° cargo install --git https://github.com/greshake/i3status-rust i3status-rs
Updating git repository `https://github.com/greshake/i3status-rust`
Installing i3status-rs v0.14.1 (https://github.com/greshake/i3status-rust#39fb0a11)
Updating crates.io index
warning: spurious network error (2 tries remaining): [6] Couldn't resolve host name (Could not resolve host: static.crates.io)
warning: spurious network error (2 tries remaining): [6] Couldn't resolve host name (Could not resolve host: static.crates.io)
warning: spurious network error (2 tries remaining): [6] Couldn't resolve host name (Could not resolve host: static.crates.io)
^C
~ î‚° dig +short static.crates.io
d19xqa3lc3clo8.cloudfront.net.
13.224.66.56
13.224.66.64
13.224.66.49
13.224.66.19
~ î‚° cargo version
cargo 1.44.0-nightly (390e8f245 2020-04-07)