rustup: rustup panics with WSLv1 + glibc 2.31

Panics like:

info: installing component 'rust-std' for 'wasm32-wasi'
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `22`,
 right: `4`', src/libstd/sys/unix/thread.rs:166:21
stack backtrace:
   0:     0x7fad0b4dbc9c - backtrace::backtrace::libunwind::trace::h65597d255cb1398b
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1:     0x7fad0b4dbc9c - backtrace::backtrace::trace_unsynchronized::hd4f479d7150ec4a0
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2:     0x7fad0b4dbc9c - std::sys_common::backtrace::_print_fmt::h015072984a2b172c

Are caused by WSLv1 + glibc 2.31 which changed the implementation of nanosleep to depend on a different kernel codepath.

Verification:

  1. WSLv1 can be confirmed using the wsl command:
wsl --list --verbose

If --verbose is not supported, then WSL v2 is not installed on the machine. If verbose is supported, the version of WSL being used for each WSL instance will be reported against the name of the instance.

Workarounds:

  1. use older linux versions
  2. some users report that exporting RUSTUP_IO_THREADS=1 mitigates the problem
  3. use WSLv2

=====

Performing rustup update on WSL1 results in panic:

info: syncing channel updates for ‘stable-x86_64-unknown-linux-gnu’ info: latest update on 2020-02-27, rust version 1.41.1 (f3e1a954d 2020-02-24)

image

Windows 10 Pro, 1909, OS Build 18363.657

Previous updates using rustup worked without problems

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 7
  • Comments: 19 (6 by maintainers)

Most upvoted comments

I accidentally discovered that RUSTUP_IO_THREADS=1 fixes things for me in WSL 1! (I thought I was ssh-ed into raspberry pi 🤦)

I’d move to WSL2, but for some reason my desktop isn’t eligible for the update yet 🤷‍♂️

@leth

I accidentally discovered that RUSTUP_IO_THREADS=1 fixes things for me in WSL 1!

Confirmed. Great tip! Win 10 1909 OS 18363.836 WSL 1.

export RUSTUP_IO_THREADS=1
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Since I had existing Ubuntu installed with WSL 1. And after updating WSL 1 to WSL2 I had to do below fix. And it works now curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

wsl --set-default-version 2
wsl --list --verbose
wsl --set-version Ubuntu-20.04 2

This affects Arch Linux installation on WSL. The solution is to downgrade glibc:

pacman -U /var/cache/pacman/pkg/glibc-2.30-3-x86_64.pkg.tar.xz

https://github.com/paritytech/subport/issues/27#issuecomment-670586387

For WSL1 add this to the .bash_profile or .bashrc, works for me

export RUSTUP_IO_THREADS=1

Just did a rustup self update + rustup update in a WSL 1 instance, no issues.

robertc@lifelesstr2:~$ rustup self update
info: checking for self-updates
info: downloading self-update
info: rustup updated successfully to 1.21.1
robertc@lifelesstr2:~$ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2020-02-27, rust version 1.41.1 (f3e1a954d 2020-02-24)
info: downloading component 'rustc'
 58.0 MiB /  58.0 MiB (100 %)  11.7 MiB/s in  5s ETA:  0s
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: downloading component 'rls'
info: downloading component 'rust-src'
info: downloading component 'rust-analysis'
info: downloading component 'clippy'
info: downloading component 'rustfmt'
info: removing previous version of component 'rustc'
info: removing previous version of component 'rust-std'
info: removing previous version of component 'cargo'
info: removing previous version of component 'rust-docs'
info: removing previous version of component 'rls'
info: removing previous version of component 'rust-src'
info: removing previous version of component 'rust-analysis'
info: removing previous version of component 'clippy'
info: removing previous version of component 'rustfmt'
info: installing component 'rustc'
 58.0 MiB /  58.0 MiB (100 %)  10.3 MiB/s in 10s ETA:  0s
info: installing component 'rust-std'
 17.7 MiB /  17.7 MiB (100 %)  12.5 MiB/s in  1s ETA:  0s
info: installing component 'cargo'
info: installing component 'rust-docs'
 12.0 MiB /  12.0 MiB (100 %) 459.2 KiB/s in 13s ETA:  0s
info: installing component 'rls'
info: installing component 'rust-src'
info: installing component 'rust-analysis'
info: installing component 'clippy'
info: installing component 'rustfmt'
info: checking for self-updates

  stable-x86_64-unknown-linux-gnu updated - rustc 1.41.1 (f3e1a954d 2020-02-24) (from rustc 1.34.1 (fc50f328b 2019-04-24))

info: cleaning up downloads & tmp directories

So I don’t think this is WSL1 per se causing the problem. Is it reproducible?