rust-lang / rustup

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

error: could not download file from 'https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256' to [...] #4050

Open ssg47 opened 5 days ago

ssg47 commented 5 days ago

Verification

Problem

I'm trying to install on a corporate Windows 10 laptop using the current version of rustup-init.exe which I've just downloaded.

I'm seeing this:

Welcome to Rust!

This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.

Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:

  C:\Users\my-user-id\.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory is located at:
  C:\Users\my-user-id\.cargo

This can be modified with the CARGO_HOME environment variable.

The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:

  C:\Users\my-user-id\.cargo\bin

This path will then be added to your PATH environment variable by
modifying the HKEY_CURRENT_USER/Environment/PATH registry key.

You can uninstall at any time with rustup self uninstall and
these changes will be reverted.

Current installation options:

   default host triple: x86_64-pc-windows-msvc
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

1) Proceed with standard installation (default - just press enter)
2) Customize installation
3) Cancel installation
>1

info: profile set to 'default'
info: default host triple is x86_64-pc-windows-msvc
info: syncing channel updates for 'stable-x86_64-pc-windows-msvc'
error: could not download file from 'https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256' to 'C:\Users\my-user-id\.rustup\tmp\8vozg73cf7ftx94w_file': failed to make network request: error sending request for url (https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256): client error (Connect): dns error: No such host is known. (os error 11001): No such host is known. (os error 11001)

Press the Enter key to continue.

Steps

  1. Download rustup-init.exe to my Downloads folder.
  2. Double-click rustup-init.exe to execute.
  3. Select option (1) Proceed with standard installation (default - just press enter)

When I do this, it returns the error within a second.

Possible Solution(s)

No response

Notes

No response

Rustup version

rustup-init 1.27.1 (54dd3d00f 2024-04-24)

Installed toolchains

N/a

OS version

Win10 22H2 (OS Build 19045.4894)

ssg47 commented 5 days ago

I wondered if it might be a proxy server issue. The laptop's proxy server is configured via a PAC file. So, I used:

(Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -Name AutoConfigURL).AutoConfigURL

to get the URL to the PAC file. Downloaded it, opened it up in Notepad and found the IP address/Port of one of the proxy servers at the bottom of the file. Opened up PowerShell and ran:

$env:HTTP_PROXY = '12.34.56.78:80'
$env:HTTPS_PROXY = '12.34.56.78:80'

where 12.34.56.7880 was the ipaddress & port from the PAC file. Then, in the same PowerShell, ran:

C:\Users\my-user-id\Downloads\rustup-init.exe

Selected option (1) as before and, this time, it took about 20 seconds to give this output:

[...]
1) Proceed with standard installation (default - just press enter)
2) Customize installation
3) Cancel installation
>1

info: profile set to 'default'
info: default host triple is x86_64-pc-windows-msvc
info: syncing channel updates for 'stable-x86_64-pc-windows-msvc'
error: could not download file from 'https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256' to 'C:\Users\my-user-id\.rustup\tmp\kzirzmyy2zy5r85o_file': failed to make network request: error sending request for url (https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256): client error (Connect): tcp connect error: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (os error 10060): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (os error 10060)

Press the Enter key to continue.
rami3l commented 5 days ago

@ssg47 Thanks for filing this issue! Given that there's a download backend change upfront (https://github.com/rust-lang/rustup/issues/3806), are you interested in trying our bleeding-edge build and see if it changes anything? Many thanks in advance! 🙏

ssg47 commented 5 days ago

Gladly. Didn't work, though I'm afraid:

info: profile set to 'default'
info: default host triple is x86_64-pc-windows-msvc
info: syncing channel updates for 'stable-x86_64-pc-windows-msvc'
error: could not download file from 'https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256' to 'C:\Users\my-user-id\.rustup\tmp\mikrkozofypyuf79_file': failed to make network request: error sending request for url (https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256): client error (Connect): dns error: No such host is known. (os error 11001): No such host is known. (os error 11001)

Press the Enter key to continue.

I think it's failing to authenticate with the proxy server. I guess I'm going to have to get the URL(s) whitelisted (for me, at least). Is there a complete list of URLs anywhere?

rami3l commented 5 days ago

error sending request for url (https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256): client error (Connect): dns error: No such host is known. (os error 11001)

@ssg47 The error message is definitely different though, so looks like we're making progress. Is there something wrong with your DNS config?

Is there a complete list of URLs anywhere?

That's subject to change. However, I'm sure that almost all files related to toolchain installation are downloaded from a specific distribution server, so:

https://github.com/rust-lang/rustup/blob/3db381b0bec0f8f36351d431aae723654e4261ae/src/config.rs#L961

has covered most cases. Its default value, of course, is

https://github.com/rust-lang/rustup/blob/3db381b0bec0f8f36351d431aae723654e4261ae/src/dist/mod.rs#L47

Also, if it sounds okay to you, you might use unofficial mirrors instead. For example, if you're located in mainland China, the TUNA mirror might be interesting to look at.

ssg47 commented 3 days ago

When I raised the ticket, I was in the office. Now, I'm working from home but using the corporate VPN. The proxy is Zscaler (for all locations). I think there is some kind of split/bypass implemented. So, I think, (some) web traffic goes direct, rather then through the VPN and then out.

For completeness, running from a PowerShell window, using the original download, with no proxy environment variables configured, I get this:

error: could not download file from 'https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256' to 'C:\Users\my-user-id\.rustup\tmp\kte4_wcsf_al_gbz_file': failed to make network request: error sending request for url (https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256): client error (Connect): dns error: No such host is known. (os error 11001): No such host is known. (os error 11001)

The bleeding-edge build also gives:

error: could not download file from 'https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256' to 'C:\Users\my-user-id\.rustup\tmp\l131elw4y77zkfxa_file': failed to make network request: error sending request for url (https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256): client error (Connect): dns error: No such host is known. (os error 11001): No such host is known. (os error 11001)

Both errors are generated within a second or so.

After configuring

$env:HTTPS_PROXY = '12.34.56.78:80'

where 12.34.56.7880 was the ipaddress & port from the PAC file, the standard build gives:

error: could not download file from 'https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256' to 'C:\Users\my-user-id\.rustup\tmp\ygi_q26rvsu6dimw_file': failed to make network request: error sending request for url (https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256): operation timed out

and, likewise, the bleeding edge build gives:

error: could not download file from 'https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256' to 'C:\Users\my-user-id\.rustup\tmp\ywd7u703xu1kkpc3_file': failed to make network request: error sending request for url (https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256): operation timed out

As before, both return after around thirty seconds.

You asked about DNS. I can run

Invoke-WebRequest -Method Get -Uri https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256

and get

StatusCode        : 200
StatusDescription : OK
Content           : {53, 53, 57, 54...}
RawContent        : HTTP/1.1 200 OK
    etc...

so I think DNS is fine. [I'm not in mainland China.] I'll request https://static.rust-lang.org is whitelisted. I wonder how long that will take...