Skip to content

downloading rustc component fails often on WSL2 #4837

Closed as not planned
Closed as not planned

Description

@Skgland

Verification

Problem

Rustup fails often when trying to download the rustc component, while downloading the file from the url in the error message using wget succeeds without problems.

Steps

  1. Install rustup
  2. attempt to install a toolchain

Possible Solution(s)

No response

Notes

Rustup on the Windows 11 host does not appear to have the same problem.
Curl on the WSL2 guest appears to have the same problem.

Rustup version

rustup 1.29.0 (28d1352db 2026-03-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: the currently active `rustc` version is `rustc 1.94.1 (e408947bf 2026-03-25)`

Installed toolchains

Default host: x86_64-unknown-linux-gnu
rustup home:  /home/bennet/.rustup

installed toolchains
--------------------
stable-x86_64-unknown-linux-gnu (active, default)
beta-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu
1.83-x86_64-unknown-linux-gnu
1.85-x86_64-unknown-linux-gnu
1.92-x86_64-unknown-linux-gnu
1.93-x86_64-unknown-linux-gnu

active toolchain
----------------
name: stable-x86_64-unknown-linux-gnu
active because: it's the default toolchain
installed targets:
  s390x-unknown-linux-gnu
  x86_64-unknown-linux-gnu

OS version

$lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.4 LTS
Release:        24.04
Codename:       noble

Under WSL2 on Windows 11

Activity

  1. rami3l commented on Apr 27, 2026

    @rami3l
    Member

    @Skgland Thanks for reporting!

    If curl in your same environment has the same problem, this is very possibly a connection issue of your WSL2 environment...

    Being a true VM instead of utilizing API forwarding like WSL1 does, I think it's more likely that WSL2 could have such problems.

  2. Skgland commented on Apr 28, 2026

    @Skgland
    ContributorAuthor

    If curl in your same environment has the same problem, this is very possibly a connection issue of your WSL2 environment...

    Possibly, but wget in the same environment doesn't appear to have the same issue.

  3. rami3l commented on Apr 28, 2026

    @rami3l
    Member

    If curl in your same environment has the same problem, this is very possibly a connection issue of your WSL2 environment...

    Possibly, but wget in the same environment doesn't appear to have the same issue.

    @Skgland Wget implicitly has --tries=20 set; you can try to set it to 0 and see...

  4. Skgland commented on Apr 28, 2026

    @Skgland
    ContributorAuthor

    If curl in your same environment has the same problem, this is very possibly a connection issue of your WSL2 environment...

    Possibly, but wget in the same environment doesn't appear to have the same issue.

    @Skgland Wget implicitly has --tries=20 set; you can try to set it to 0 and see...

    As 0 appears to mean infinite retries I tried it with 1 instead. I haven't seen a single failure in over 22 attempts (didn't keep count initially).

    Curl failed in 13/22 attempts.

  5. rami3l commented on Apr 28, 2026

    @rami3l
    Member

    @Skgland Thanks for the quick response! Would you mind trying with curl --http1.1 in the same environment to see if this is a problem in the default HTTP version being used?

    Both we and cURL are using HTTP2 by default if that explains. Also, under Ubuntu 24.04.4 LTS the default wget version is v1 which doesn't support HTTP2 at all.


    Erratum: In our curl binding we see this feature set:

    [features]
    default = ["ssl"]
    
    http2 = ["curl-sys/http2"]

    ... so without the http2 feature explicitly set, even high libcurl versions are not using http2 by default.

  6. Skgland commented on Apr 28, 2026

    @Skgland
    ContributorAuthor

    I am not experiencing any failures with curl --http1.1

    wget version
    $ wget --version
    GNU Wget 1.21.4 built on linux-gnu.
    
    -cares +digest -gpgme +https +ipv6 +iri +large-file -metalink +nls
    +ntlm +opie +psl +ssl/openssl
    
    Wgetrc:
        /etc/wgetrc (system)
    Locale:
        /usr/share/locale
    Compile:
        gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/etc/wgetrc"
        -DLOCALEDIR="/usr/share/locale" -I. -I../../src -I../lib
        -I../../lib -Wdate-time -D_FORTIFY_SOURCE=3 -DHAVE_LIBSSL -DNDEBUG
        -g -O2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
        -ffile-prefix-map=/build/wget-LWnKWI/wget-1.21.4=. -flto=auto
        -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection
        -Wformat -Werror=format-security -fcf-protection
        -fdebug-prefix-map=/build/wget-LWnKWI/wget-1.21.4=/usr/src/wget-1.21.4-1ubuntu4.1
        -DNO_SSLv2 -D_FILE_OFFSET_BITS=64 -g -Wall
    Link:
        gcc -DHAVE_LIBSSL -DNDEBUG -g -O2 -fno-omit-frame-pointer
        -mno-omit-leaf-frame-pointer
        -ffile-prefix-map=/build/wget-LWnKWI/wget-1.21.4=. -flto=auto
        -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection
        -Wformat -Werror=format-security -fcf-protection
        -fdebug-prefix-map=/build/wget-LWnKWI/wget-1.21.4=/usr/src/wget-1.21.4-1ubuntu4.1
        -DNO_SSLv2 -D_FILE_OFFSET_BITS=64 -g -Wall -Wl,-Bsymbolic-functions
        -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now -lpcre2-8
        -luuid -lidn2 -lssl -lcrypto -lz -lpsl ../lib/libgnu.a
    
    Copyright (C) 2015 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later
    <http://www.gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    
    Originally written by Hrvoje Niksic <hniksic@xemacs.org>.
    Please send bug reports and questions to <bug-wget@gnu.org>.
    
    curl version
    $ curl --version
    curl 8.5.0 (x86_64-pc-linux-gnu) libcurl/8.5.0 OpenSSL/3.0.13 zlib/1.3 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.7 libpsl/0.21.2 (+libidn2/2.3.7) libssh/0.10.6/openssl/zlib nghttp2/1.59.0 librtmp/2.3 OpenLDAP/2.6.10
    Release-Date: 2023-12-06, security patched: 8.5.0-2ubuntu10.8
    Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
    Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd
    
    apt list --installed curl wget
    $ apt list --installed curl wget
    Listing... Done
    curl/noble-updates,noble-security,now 8.5.0-2ubuntu10.8 amd64 [installed,automatic]
    wget/noble-updates,noble-security,now 1.21.4-1ubuntu4.1 amd64 [installed,automatic]
    
  7. changed the title [-]downloading rustc component fails often[/-] [+]downloading rustc component fails often on WSL2[/+] on Apr 28, 2026
  8. added
    incompleteThe bug report does not have enough information
    on Apr 28, 2026
  9. rami3l commented on Apr 28, 2026

    @rami3l
    Member

    @Skgland Okay. So if both rustup and curl is failing with HTTP2 you can give wget2 --http2-only a try.

    If all three programs (rustup, curl and wget2) are failing reproducibly then you might have better changes seeing this with WSL 🙏

    Also @ChrisDenton I'm not sure if you have been using WSL a lot, but have you heard of anything like this? I do have a vague impression of WSL2 VMs having a bad time communicating with the host machine when I sold my last PC in 2020... I think there might have been something that HTTP2 sessions do more aggressively than HTTP1.1 ones that has broken this, maybe it's multiplexing?

  10. Skgland commented on Apr 28, 2026

    @Skgland
    ContributorAuthor

    Not seeing any issues with wget2 --http2-only --tries=1

    wget2 version
    $ wget2 --version
    GNU Wget2 2.1.0 - multithreaded metalink/file/website downloader
    
    +digest +https +ssl/gnutls +ipv6 +iri +large-file +nls -ntlm -opie +psl -hsts
    +iconv +idn2 +zlib -lzma +brotlidec +zstd -bzip2 +lzip +http2 +gpgme
    
    Copyright (C) 2012-2015 Tim Ruehsen
    Copyright (C) 2015-2021 Free Software Foundation, Inc.
    
    License GPLv3+: GNU GPL version 3 or later
    <http://www.gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    
    Please send bug reports and questions to <bug-wget@gnu.org>.
    
    $ apt list --installed wget2
    Listing... Done
    wget2/noble,now 2.1.0-2.1build2 amd64 [installed]
    
  11. Skgland commented on Apr 28, 2026

    @Skgland
    ContributorAuthor

    BTW, I don't think I have mentioned this bit the error I am getting for curl is curl: (56) Recv failure: Connection reset by peer

  12. rami3l commented on Apr 28, 2026

    @rami3l
    Member

    BTW, I don't think I have mentioned this bit the error I am getting for curl is curl: (56) Recv failure: Connection reset by peer

    Thanks for confirming that #4695 has indeed worked :)

  13. rami3l commented on Apr 28, 2026

    @rami3l
    Member

    BTW, I don't think I have mentioned this bit the error I am getting for curl is curl: (56) Recv failure: Connection reset by peer

    @Skgland It's quite unfortunate I cannot debug it myself, but in that case it's reasonable to suspect that this is related to the MTU setup on WSL2. You can try with lower either the buffer size or the MTU and see if the interruptions happen less often. Something like:

    curl --http2 --buffer-size 4096 (can't set it this way, option available via libcurl)

    ... or:

    sudo ip link set dev eth0 mtu 1350

    Adjust the values according to your setup. Either way, this is more likely a problem with your network stack rather than with rustup.

  14. Skgland commented on Apr 28, 2026

    @Skgland
    ContributorAuthor

    BTW, I don't think I have mentioned this bit the error I am getting for curl is curl: (56) Recv failure: Connection reset by peer

    @Skgland It's quite unfortunate I cannot debug it myself, but in that case it's reasonable to suspect that this is related to the MTU setup on WSL2. You can try with lower either the buffer size or the MTU and see if the interruptions happen less often. Something like:

    curl --http2 --buffer-size 4096
    ... or:

    My curl version does not recognize the --buffer-size flag

    sudo ip link set dev eth0 mtu 1350
    Adjust the values according to your setup. Either way, this is more likely a problem with your network stack rather than with rustup.

    Lowering the mtu to 1350 appeared to reduce the failure rate slightly, at mtu 1000 I no longer see errors (didn't try other steps inbetween).

    This appears to be indeed a network issue with WSL2 on my side.
    Thank you for your patience and help.

  15. reopened this on Apr 28, 2026
  16. rami3l commented on Apr 28, 2026

    @rami3l
    Member

    @Skgland My apologies, it seems the buffer size can only be set with the libcurl option but not with a CLI parameter.

    Anyway, glad to see that the root cause of your issue has been identified!

  17. added
    not-rustupWhatever is described in this issue isn't Rustup's fault
    and removed
    incompleteThe bug report does not have enough information
    on Apr 28, 2026
  18. Skgland commented on Apr 28, 2026

    @Skgland
    ContributorAuthor

    Anyway, glad to see that the root cause of your issue has been detected!

    I still find it a bit odd that it only effects http2 traffic of curl and rustup.
    wget, curl with http1.1 and wget2 with http2 were working fine.

    I now tried to use ping to find the largest usable MTU but that didn't have any problems even with the default MTU of 1500 (ping icmp payload of 1472 + 28 bytes package headers icmp + ip).
    Over 100 ping packages it had a package loss of 2% both at an MTU of 1500 and 1000.

  19. rami3l commented on Apr 28, 2026

    @rami3l
    Member

    I still find it a bit odd that it only effects http2 traffic of curl and rustup. wget, curl with http1.1 and wget2 with http2 were working fine.

    I now tried to use ping to find the largest usable MTU but that didn't have any problems even with the default MTU of 1500 (ping icmp payload of 1472 + 28 bytes package headers icmp + ip). Over 100 ping packages it had a package loss of 2% both at an MTU of 1500 and 1000.

    @Skgland It is possible that Wget2/GnuTLS has lower default max TLS record size so it will help in this issue. This is also why previously I mentioned reducing the buffer size.

  20. Skgland commented on Apr 28, 2026

    @Skgland
    ContributorAuthor

    I can no longer reproduce the problem even at the original/default MTU of 1500.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    not-rustupWhatever is described in this issue isn't Rustup's fault

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions