rust-lang / rustup

The Rust toolchain installer
https://rust-lang.github.io/rustup/
Apache License 2.0
6.11k stars 879 forks source link

corporate firewalls interfere with downloads #3134

Open gakadam opened 1 year ago

gakadam commented 1 year ago

Problem

Rustup toolchain install fails on WIN10. Log:

> rustup toolchain install nightly
info: syncing channel updates for 'nightly-x86_64-pc-windows-gnu'
750.8 KiB / 750.8 KiB (100 %) 416.0 KiB/s in  1s ETA:  0s
info: latest update on 2023-01-05, rust version 1.68.0-nightly (659e169d3 2023-01-04)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: retrying download for 'https://static.rust-lang.org/dist/2023-01-05/rust-docs-nightly-x86_64-pc-windows-gnu.tar.xz'
info: retrying download for 'https://static.rust-lang.org/dist/2023-01-05/rust-docs-nightly-x86_64-pc-windows-gnu.tar.xz'
info: retrying download for 'https://static.rust-lang.org/dist/2023-01-05/rust-docs-nightly-x86_64-pc-windows-gnu.tar.xz'
info: retrying download for 'https://static.rust-lang.org/dist/2023-01-05/rust-docs-nightly-x86_64-pc-windows-gnu.tar.xz'
error: component download failed for rust-docs-x86_64-pc-windows-gnu: could not download file from 'https://static.rust-lang.org/dist/2023-01-05/rust-docs-nightly-x86_64-pc-windows-gnu.tar.xz' to 'C:\XXXX\rustup\.rustup\downloads\d58a2e4217d7d9feca7423179e3090ff12bc5ca7423179e3090ff12bc52ec2fae8f216e32acb841f286b4.partial'

> rustup toolchain install stable
info: syncing channel updates for 'stable-x86_64-pc-windows-gnu'
info: latest update on 2022-12-15, rust version 1.66.0 (69f9c33d7 2022-12-12)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: retrying download for 'https://static.rust-lang.org/dist/2022-12-15/rust-docs-1.66.0-x86_64-pc-windows-gnu.tar.xz'
info: retrying download for 'https://static.rust-lang.org/dist/2022-12-15/rust-docs-1.66.0-x86_64-pc-windows-gnu.tar.xz'
info: retrying download for 'https://static.rust-lang.org/dist/2022-12-15/rust-docs-1.66.0-x86_64-pc-windows-gnu.tar.xz'
info: retrying download for 'https://static.rust-lang.org/dist/2022-12-15/rust-docs-1.66.0-x86_64-pc-windows-gnu.tar.xz'
error: component download failed for rust-docs-x86_64-pc-windows-gnu: could not download file from 'https://static.rust-lang.org/dist/2022-12-15/rust-docs-1.66.0-x86_64-pc-windows-gnu.tar.xz' to 'C:\XXXX\rustup\.rustup\downloads\093257159ba394c5306474373475d0a78031d7691e6c0fb1834503eb4790ceae.partial'

Steps

  1. execute rustup toolchain install stable

Possible Solution(s)

No response

Notes

No response

Rustup version

rustup 1.25.1 (bb60b1e89 2022-07-12)

Installed toolchains

None

NOTE:

On the same machine, rustup 1.25.1 works in wsl.

kinnison commented 1 year ago

Most likely this is a fault in that particular version of nightly. Does it install current nightly OK?

gakadam commented 1 year ago

Sorry for late reply. I tried on the system again today and it did not work:

rustup toolchain install nightly
info: syncing channel updates for 'nightly-x86_64-pc-windows-msvc'
info: latest update on 2023-01-20, rust version 1.68.0-nightly (4c83bd03a 2023-01-19)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: retrying download for 'https://static.rust-lang.org/dist/2023-01-20/rust-docs-nightly-x86_64-pc-windows-msvc.tar.xz'
info: retrying download for 'https://static.rust-lang.org/dist/2023-01-20/rust-docs-nightly-x86_64-pc-windows-msvc.tar.xz'
info: retrying download for 'https://static.rust-lang.org/dist/2023-01-20/rust-docs-nightly-x86_64-pc-windows-msvc.tar.xz'
info: retrying download for 'https://static.rust-lang.org/dist/2023-01-20/rust-docs-nightly-x86_64-pc-windows-msvc.tar.xz'
error: component download failed for rust-docs-x86_64-pc-windows-msvc: could not download file from 'https://static.rust-lang.org/dist/2023-01-20/rust-docs-nightly-x86_64-pc-windows-msvc.tar.xz' to 'C:\Users\xxx\rustup-msvc\.rustup\downloads\8e6afe92ef48c82fb19094fc800dadbfc5ed3ab9e91713fd0707dce03a6a8522.partial'

Thank you.

kwilson33 commented 1 year ago

I am having the same issue when trying to install rust stable (version 1.67.0) on my Windows 10 laptop. This laptop is managed (firewall, network, antivirus) by my work company, and I am guessing that is the problem.

info: retrying download for 'https://static.rust-lang.org/dist/2023-01-26/rust-docs-1.67.0-x86_64-pc-windows-msvc.tar.xz' info: retrying download for 'https://static.rust-lang.org/dist/2023-01-26/rust-docs-1.67.0-x86_64-pc-windows-msvc.tar.xz' info: retrying download for 'https://static.rust-lang.org/dist/2023-01-26/rust-docs-1.67.0-x86_64-pc-windows-msvc.tar.xz' info: retrying download for 'https://static.rust-lang.org/dist/2023-01-26/rust-docs-1.67.0-x86_64-pc-windows-msvc.tar.xz'

I notice that if I navigate to the URL and try downloading it manually, it also fails to download.

I tested this on 2 other Windows 10 PCs, and it worked. I am assuming it has something to do with my work's firewall/network settings. 😔

gakadam commented 1 year ago

@kwilson33 Yes, I think it is same with my machine.

I overcame it by installing compiler and docs separately.

I am okay to close this issue.

rbtcollins commented 1 year ago

We should perhaps make it easier for folk to download separately.

Something like

rustup toolchain add nightly
info: syncing channel updates for 'nightly-x86_64-pc-windows-msvc'
info: latest update on 2023-01-20, rust version 1.68.0-nightly (4c83bd03a 2023-01-19)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: retrying download for 'https://static.rust-lang.org/dist/2023-01-20/rust-docs-nightly-x86_64-pc-windows-msvc.tar.xz'
...
error: distribution download failed See <some doc page> for more information.

And that doc page would then have

## Overcoming network failures

Rustup requires network access to:
1) Download updates for itself 
2) Download channel metadata that describes what distributions and components are available
3) Download distributions (rustc, cargo etc)

If rustup cannot operate on the network at all, you will need to fix that, for instance by requesting permission from your network administrator, granting it permission to communicate on the network, or other local concerns.

If rustup can download the various metadata, but not (1) or (3) your network might have some issue with MSS / MTU mismatches or other configurations that affect bulk data downloads. If those generally work, then it iis likely compromised, such as by a corporate or government intercepting firewall.

Such firewalls sometimes permit operation as a proxy <link to our proxy docs>. Failing that, if you have some other means of downloading files, you can do an offline download as follows:
rustup --report-urls <command thats failing>
copy the urls this will report and download them via whatever means you have that works
place the files in a directory, and re-run rustup:
rustup --offline-download=path-to-dir <command that was failing>

This will cause rustup to use the files from the offline path rather than downloading fresh.

I've had multiple times during testing where this would be useful, and we have various bugs folk run into on new platforms that affect network use, so I think this might be generally useful.