cargo icon indicating copy to clipboard operation
cargo copied to clipboard

Cannot pull from crates.io on mint linux 20.3

Open JonathanWoollett-Light opened this issue 2 years ago • 9 comments

Problem

On new install of mint 20.3 when attempting to run cargo install rusty-hook I receive

jonathan@jonathan-pc:~/Projects/testint-setup$ cargo install rusty-hook
    Updating crates.io index
error: failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  network failure seems to have happened
  if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
  https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli

Caused by:
  SSL error: received early EOF; class=Ssl (16); code=Eof (-20)

Steps

  1. Install mint linux
  2. Install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  3. Run any cargo command which requires pulling from crates.io (e.g. cargo build on a project with dependencies or cargo install <any package>).

Possible Solution(s)

No response

Notes

I first encountered this issue with an extremely minimal set of installed applications under an hour after doing a clean install.

Version

cargo 1.61.0 (a028ae4 2022-04-29)
release: 1.61.0
commit-hash: a028ae42fc1376571de836be702e840ca8e060c2
commit-date: 2022-04-29
host: x86_64-unknown-linux-gnu
libgit2: 1.4.2 (sys:0.14.2 vendored)
libcurl: 7.80.0-DEV (sys:0.4.51+curl-7.80.0 vendored ssl:OpenSSL/1.1.1m)
os: Linux Mint 20.3 (una) [64-bit]

JonathanWoollett-Light avatar Jun 16 '22 22:06 JonathanWoollett-Light

It's hard to remote debug. The root cause varies from platform to platform. ehuss wrote a simple guide to follow if seeing SSL connection issue, as this may be the same issue as #9113.

weihanglo avatar Jun 18 '22 06:06 weihanglo

Also, knowing how Rust is installed is also important.

weihanglo avatar Jun 18 '22 06:06 weihanglo

  1. Boot from linuxmint-20.3-cinnamon-64bit.iso (https://linuxmint.com/edition.php?id=292)
  2. Establish ethernet or WiFi internet connection.
  3. Open terminal
  4. curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  5. source $HOME/.cargo/env
  6. cargo install rusty-hook

Errors:

mint@mint:~$ cargo install rusty-hook
    Updating crates.io index
error: failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  network failure seems to have happened
  if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
  https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli

Caused by:
  SSL error: received early EOF; class=Ssl (16); code=Eof (-20)

image

I believe this is the mcve.

JonathanWoollett-Light avatar Jun 18 '22 14:06 JonathanWoollett-Light

Thanks for the clear example!

Here are more approaches to help investigate this issue:

  • Could you set net.git-fetch-with-cli and do it again? This uses system git binary instead of Cargo's libgit2.
  • Are you able to clone the index registry with git binary? Something like git fetch https://github.com/rust-lang/crates.io-index.
  • Does it work with an upgrade of your system openssl (or any SSL lib)?

weihanglo avatar Jun 18 '22 15:06 weihanglo

It wouldn't seem any of these helps resolve the problem, here is full terminal output covering these (it is too long to include directly in this comment).

JonathanWoollett-Light avatar Jun 18 '22 15:06 JonathanWoollett-Light

From line 259-264 of your output, looks like it's a general TLS error on Linux, not only happens with Cargo.

mint@mint:~$ git clone https://github.com/rust-lang/crates.io-index
Cloning into 'crates.io-index'...
remote: Enumerating objects: 418179, done.
remote: Counting objects: 100% (1462/1462), done.
remote: Compressing objects: 100% (653/653), done.
error: RPC failed; curl 56 GnuTLS recv error (-9): Error decoding the received TLS packet.
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

Having searched on the Internet, some suggest to increase post buffer size or do a apt install gnutls-bin. Maybe give it a shot?

weihanglo avatar Jun 18 '22 16:06 weihanglo

So moving from Mint to Ubuntu fixes the issue with git clone https://github.com/rust-lang/crates.io-index but the issue with cargo install rusty-hook (and other crates.io operations) remains.

JonathanWoollett-Light avatar Jun 19 '22 18:06 JonathanWoollett-Light

Same issue here. Fresh rust install, can't build hello world because it can't update from crates.io.

I've even cloned crates.io and set the default registry to that local one, in ~/.cargo/config.toml and myproject/.cargo/config.toml but it still wants to download the entire thing from scratch.

manoadamro avatar Jul 05 '22 19:07 manoadamro

This seems to also be an issue with Ubuntu. My configuration here:

jonathan@jonathan-desk:~$ neofetch
            .-/+oossssoo+/-.               jonathan@jonathan-desk 
        `:+ssssssssssssssssss+:`           ---------------------- 
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 22.04 LTS x86_64 
    .ossssssssssssssssssdMMMNysssso.       Kernel: 5.15.0-46-generic 
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Uptime: 39 mins 
  +ssssssssshmydMMMMMMMNddddyssssssss+     Packages: 2041 (dpkg), 13 (snap) 
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Shell: bash 5.1.16 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Resolution: 3840x2160 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   DE: GNOME 42.1 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   WM: Mutter 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   WM Theme: Adwaita 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Theme: Yaru-dark [GTK2/3] 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Icons: Yaru [GTK2/3] 
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/    Terminal: gnome-terminal 
  +sssssssssdmydMMMMMMMMddddyssssssss+     CPU: AMD Ryzen 9 5900X (24) @ 3.700GHz 
   /ssssssssssshdmNNNNmyNMMMMhssssss/      GPU: NVIDIA GeForce RTX 3060 Ti Lite Hash Rate 
    .ossssssssssssssssssdMMMNysssso.       Memory: 4326MiB / 128723MiB 
      -+sssssssssssssssssyyyssss+-
        `:+ssssssssssssssssss+:`                                   
            .-/+oossssoo+/-.                                       


jonathan@jonathan-desk:~$ 

JonathanWoollett-Light avatar Aug 29 '22 20:08 JonathanWoollett-Light

Same issue on Mac OS (13.6.3) Intel

beshur avatar Feb 16 '24 07:02 beshur

I have the same issue in ubuntu 22.04. Interestingly, it's happening randomly. You can see an example run here https://github.com/furkansahin/frequency/actions/runs/8419571829/job/23052464174. Using git, I can easily clone and fetch the target repository, however, using cargo, it fails randomly. I could also validate that system date time is not an issue. Adding git-fetch-with-cli = true to cargo did not help either. The only solution I could find is adding retry = 5 parameter. It seems like continuous tries are solving the issue but this is not ideal. Anyone has an idea?

furkansahin avatar Mar 25 '24 12:03 furkansahin