skip to Main Content

I am tying to build a Rust project on Debian that uses the rand library but am getting an SSL error on cargo build:

→ cargo build
    Updating crates.io index
error: failed to load source for a dependency on `rand`

Caused by:
  Unable to update registry `https://github.com/rust-lang/crates.io-index`

Caused by:
  failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  SSL error: 0xffff8880 - SSL - A fatal alert message was received from our peer; class=Ssl (16)

Trying to curl the URL works fine:

→ curl https://github.com/rust-lang/crates.io-index
<html output>

2

Answers


  1. Chosen as BEST ANSWER

    Setting the environment variable CARGO_HTTP_CHECK_REVOKE=false fixed this issue for me e.g.

    export CARGO_HTTP_CHECK_REVOKE=false
    cargo build
    

  2. I found that the cause of this issue is network filtering by ISPs (in the UK: WebSafe, HomeSafe, Parental Controls or similar).

    Either some of the domains rust uses are being blocked, or large response payloads aren’t properly handled by ISP filtering software.

    The solution is to either disable these filters in your ISP’s control panel, or switch your DNS (as the filters are all DNS based).

    If I switch to 1.1.1.1 or 8.8.8.8 in /etc/resolv.conf on linux this issue goes away completely.

    I discovered this after encountering a similar issue with brew.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search