Repository navigation
Closed
Description
Building any project with dependencies on crates.io, with the latest nightly, on Arch Linux, ends with this error:
$ cargo build --verbose
Updating registry `https://github.com/rust-lang/crates.io-index`
Downloading pkg-config v0.0.1
Unable to get packages from source
Caused by:
Failed to download package `pkg-config v0.0.1` from https://crates.io/api/v1/crates/pkg-config/0.0.1/download
Caused by:
Peer certificate cannot be authenticated with given CA certificates
Sample Cargo.toml reproducing the issue:
$ cat Cargo.toml
[package]
name = "nickel-demo"
version = "0.0.1"
authors = ["Timothée Ravier <[email protected]>"]
[dependencies.nickel]
git = "https://github.com/nickel-org/nickel.rs.git"
And version info:
$ rustc --version=verbose
rustc 0.13.0-nightly (395901393 2014-11-24 00:46:30 +0000)
binary: rustc
commit-hash: 395901393c369c910a8ae36ace71402cb206d217
commit-date: 2014-11-24 00:46:30 +0000
host: x86_64-unknown-linux-gnu
release: 0.13.0-nightly
$ cargo --version
cargo 0.0.1-pre-nightly (1bdfb25 2014-11-20 19:29:22 +0000)
Using curl manually gives the following output:
$ curl -v https://crates.io/api/v1/crates/pkg-config/0.0.1/download
* Hostname was NOT found in DNS cache
* Trying 107.20.211.76...
* Connected to crates.io (107.20.211.76) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: none
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* Server certificate:
* subject: OU=GT87339749; OU=See www.rapidssl.com/resources/cps (c)14; OU=Domain Control Validated - RapidSSL(R); CN=crates.io
* start date: 2014-11-06 11:11:23 GMT
* expire date: 2015-11-09 14:30:14 GMT
* subjectAltName: crates.io matched
* issuer: C=US; O=GeoTrust Inc.; CN=RapidSSL SHA256 CA - G3
* SSL certificate verify ok.
> GET /api/v1/crates/pkg-config/0.0.1/download HTTP/1.1
> User-Agent: curl/7.39.0
> Host: crates.io
> Accept: */*
>
< HTTP/1.1 302 Found
< Connection: keep-alive
< Server: nginx
< Date: Tue, 25 Nov 2014 13:46:14 GMT
< Transfer-Encoding: chunked
< Set-Cookie: cargo_session=--3c156d7a3629aa08a1a0d538832f99ea30835cc8; HttpOnly; Secure; Path=/
< Location: https://crates-io.s3-us-west-1.amazonaws.com/crates/pkg-config/pkg-config-0.0.1.crate
< Strict-Transport-Security: max-age=31536000
< Via: 1.1 vegur
<
* Connection #0 to host crates.io left intact
And tracing cargo build with strace gives:
$ strace -f -e trace=file cargo build --verbose
(...)
Downloading pkg-config v0.0.1
stat("/home/tim/.cargo/registry/cache/github.com-1ecc6299db9ec823", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
getcwd("/home/tim/projects/perso/rust/nickel-demo", 2048) = 42
stat("/home/tim/projects/perso/rust/nickel-demo/.cargo/config", 0x7fffb1eba210) = -1 ENOENT (No such file or directory)
stat("/home/tim/projects/perso/rust/.cargo/config", 0x7fffb1eba210) = -1 ENOENT (No such file or directory)
stat("/home/tim/projects/perso/.cargo/config", 0x7fffb1eba210) = -1 ENOENT (No such file or directory)
stat("/home/tim/projects/.cargo/config", 0x7fffb1eba210) = -1 ENOENT (No such file or directory)
stat("/home/tim/.cargo/config", 0x7fffb1eba210) = -1 ENOENT (No such file or directory)
stat("/home/.cargo/config", 0x7fffb1eba210) = -1 ENOENT (No such file or directory)
stat("/.cargo/config", 0x7fffb1eba210) = -1 ENOENT (No such file or directory)
access("/home/tim/.gitconfig", F_OK) = 0
stat("/home/tim/.gitconfig", {st_mode=S_IFREG|0644, st_size=1541, ...}) = 0
stat("/home/tim/.gitconfig", {st_mode=S_IFREG|0644, st_size=1541, ...}) = 0
open("/home/tim/.gitconfig", O_RDONLY) = 3
access("/home/tim/.config/git/config", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/gitconfig", F_OK) = -1 ENOENT (No such file or directory)
stat("/home/tim/.gitconfig", {st_mode=S_IFREG|0644, st_size=1541, ...}) = 0
open("/home/rustbuild/root64/ssl/openssl.cnf", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/var/ssl", 0x7fffb1eba7a0) = -1 ENOENT (No such file or directory)
stat("/usr/share/ssl", 0x7fffb1eba7a0) = -1 ENOENT (No such file or directory)
stat("/usr/local/ssl", 0x7fffb1eba7a0) = -1 ENOENT (No such file or directory)
stat("/usr/local/openssl", 0x7fffb1eba7a0) = -1 ENOENT (No such file or directory)
stat("/usr/local/share", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/usr/lib/ssl", 0x7fffb1eba7a0) = -1 ENOENT (No such file or directory)
stat("/usr/ssl", 0x7fffb1eba7a0) = -1 ENOENT (No such file or directory)
stat("/etc/openssl", 0x7fffb1eba7a0) = -1 ENOENT (No such file or directory)
stat("/etc/pki/tls", 0x7fffb1eba7a0) = -1 ENOENT (No such file or directory)
stat("/etc/ssl", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/etc/hosts", O_RDONLY|O_CLOEXEC) = 3
open("/etc/gai.conf", O_RDONLY|O_CLOEXEC) = 3
stat("/dev/urandom", {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 9), ...}) = 0
open("/dev/urandom", O_RDONLY) = 4
open("/etc/ssl/cert.pem", O_RDONLY) = 4
open("/etc/hosts", O_RDONLY|O_CLOEXEC) = 4
open("/etc/ssl/cert.pem", O_RDONLY) = 5
stat("/etc/ssl/certs/415660c1.0", 0x7fffb1eba1e0) = -1 ENOENT (No such file or directory)
Unable to get packages from source
Caused by:
Failed to download package `pkg-config v0.0.1` from https://crates.io/api/v1/crates/pkg-config/0.0.1/download
Caused by:
Peer certificate cannot be authenticated with given CA certificates
+++ exited with 101 +++
So it looks like the curl module is not looking at the correct place for certificate checking and so far my attempts to use environment variables such as CURL_CA_BUNDLE have been unsuccessful with cargo.
This may be a rust-curl bug but I can't confirm this because trying to build a minimal example with the curl-rust crate using cargo fails with the same error :(.
Metadata
Metadata
Assignees
Labels
No labels
Activity
alexcrichton commentedon Nov 25, 2014
Interesting! It's always a fun time linking openssl :)
The code in question for this sort of probe is in the openssl-sys crate which we then leverage in curl-rust by default. So, in light of this information, I have a few questions:
straceof curl itself downloading a file from crates.io? I find it useful to compare the two outputs.Thanks for opening an issue!
Siosm commentedon Nov 25, 2014
So opening
/etc/ssl/cert.pemshould be OK. But instead, it looks like cargo is going for/etc/ssl/certs/415660c1.0, which does not exist.Here it opens
/etc/ssl/certs/ca-certificates.crtdirectly as this path was given directly at configure/compile time: https://projects.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/curl#n40Siosm commentedon Nov 25, 2014
I cannot reproduce the issue on CentOS 7 nor on Fedora 20, so this is an Arch Linux specific issue. Here is the relevant strace output for CentOS 7 (Fedora 20 is similar):
Siosm commentedon Nov 25, 2014
Is Rust recursively following symbolic links? Here we have:
alexcrichton commentedon Nov 26, 2014
Would you be able to build cargo from source to test out a change? I would be curious if this diff applied to openssl-sys would work for you:
You could build cargo with that patch via:
Siosm commentedon Nov 26, 2014
Unfortunately, I followed your instructions and I ran into the same error while trying to build cargo :(.
But I've tried something else which seems to solve the issue for me:
So this is really strange and looks like an Arch Linux bug. I'll report this asap and will report back here.
I'm now hitting another bug (which still prevents me from trying your patch) but I'll make another bug report tomorrow.
alexcrichton commentedon Nov 26, 2014
I'll note that we're doing somewhat sketchy things with openssl (we're linking it statically in the nightly distribution) which may not be kosher on all platforms, so it may not necessarily be a bug with Arch.
I also just realized, can you try running
SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt cargo fetch? (using nightlies) Either that or theSSL_CERT_DIRenvironment variable may help cargo find this location, although we should definitely find it by default as well.Siosm commentedon Nov 26, 2014
Well, I've tried every combination I could think of and the only one working is:
SSL_CERT_FILE=/etc/ca-certificates/extracted/pem/email-ca-bundle.pem cargo build ...This is really strange when the following commands both work:
Siosm commentedon Nov 26, 2014
My other bug is rust-lang/rust#16402, which is unrelated.
I've tried using cargo with your patch but it doesn't seem to work.
alexcrichton commentedon Nov 26, 2014
Hm interesting! We may just be missing some option to libcurl, do you know if that
email-ca-bundle.pemfile is symlinked anywhere else on the system?Siosm commentedon Dec 1, 2014
It does not seem that email-ca-bundle.pem is linked from somewhere else.
Anyway, the issue is now resolved for me as the updated ca-certificates-utils-20140923-7.1 package from Arch Linux creates all the symlinks expected by openssl/curl in cargo, and thus fixes this bug.
So, as far as I understand, this was a temporary Arch Linux specific issue.
alexcrichton commentedon Dec 1, 2014
Ok, thanks for looking into this @Siosm!
13 remaining items
southerngs commentedon Jun 25, 2015
I tried on two other systems this evening (one Ubuntu 12.04 and one Arch Linux) and was not able to reproduce the problem. The system that I have the problem with is behind a firewall and requires use of a proxy server (the ones that work are not). I thought I would add this information in case anyone else sees this issue.
Also in all cases I'm testing with the release 1.0 version of Rust and included Cargo (
cargo 0.2.0-nightly (efb482d 2015-04-30) (built 2015-04-30)).azerupi commentedon Jun 26, 2015
I am also on Arch Linux and I have the same issue on stable that uses
cargo 0.2.0-nightly.But it's gone on the beta version that uses
cargo 0.3.0-nightlySo I guess I will have to stick to the beta version for the next couple of weeks until it moves to stable
Keats commentedon Jun 26, 2015
On Archlinux as well, I didn't use Rust for about a month when it was working and i am now running into the issue, same after running a rustup to get 1.1:
I'll try @Siosm workaround when I have time
daniel-ferguson commentedon Jun 26, 2015
Just to note cargo
0.3.0-nightlycan be installed for older rusts (I'm on1.0.0), I assume without ill consequence.The newer version runs on my Arch box fine.
Binaries are available here:
https://crates.io/install
Siosm commentedon Jun 26, 2015
As far as I'm concerned, this issue is only affecting the stable 1.0 and 1.1 releases. The 1.2 beta and nightly releases are working for me.
tksfz commentedon Jul 5, 2015
Same here (works on 1.2 beta and 1.3 nightly; breaks on stable 1.1).
sjmackenzie commentedon Jul 5, 2015
So the NixOS community have updated rust and it's without problem. I'm running
rustMasterandcargoSnapshot.Keats commentedon Jul 7, 2015
It seems to now work for me, only did a pacman -Syu, nothing related to rust
kendall commentedon Jul 13, 2015
I get this error trying to work through the guessing game toy program in the docs:
I'm only using a nightly because I had the problem initially with Rust 1.1 and I switched to a nightly, thinking it might be fixed there...
Fetching libc by hand with curl seems fine:
cargoSnapshot: 2015-04-02 -> 2015-06-17, hide from nix-env