rustup: Install panic on Ubuntu 20.04 in Windows Subsystem for Linux

Problem

Install crashes with a panic on Ubuntu 20.04 in Windows Subsystem for Linux (Version 1)

Steps

  1. Install Ubuntu 20.04 in WSL (WSL version 1)
  2. run curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  3. wait for stacktrace

Full log:

info: downloading installer

Welcome to Rust!

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

It will add the cargo, rustc, rustup and other commands to
Cargo's bin directory, located at:

  /home/user/.cargo/bin

This can be modified with the CARGO_HOME environment variable.

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

  /home/user/.rustup

This can be modified with the RUSTUP_HOME environment variable.

This path will then be added to your PATH environment variable by
modifying the profile file located at:

  /home/user/.profile

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

Current installation options:


   default host triple: x86_64-unknown-linux-gnu
     default toolchain: stable
               profile: default
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1

info: profile set to 'default'
info: default host triple is x86_64-unknown-linux-gnu
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2020-04-23, rust version 1.43.0 (4fb7144ed 2020-04-20)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `22`,
 right: `4`', src/libstd/sys/unix/thread.rs:166:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `22`,
 right: `4`', src/libstd/sys/unix/thread.rs:166:21
stack backtrace:
   0:     0x7f00772dbc9c - backtrace::backtrace::libunwind::trace::h65597d255cb1398b
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1:     0x7f00772dbc9c - backtrace::backtrace::trace_unsynchronized::hd4f479d7150ec4a0
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2:     0x7f00772dbc9c - std::sys_common::backtrace::_print_fmt::h015072984a2b172c
                               at src/libstd/sys_common/backtrace.rs:77
   3:     0x7f00772dbc9c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6df05d3335f32194
                               at src/libstd/sys_common/backtrace.rs:61
   4:     0x7f0076fba81c - core::fmt::write::h1f444f4312eb6c27
                               at src/libcore/fmt/mod.rs:1028
   5:     0x7f00772db526 - std::io::Write::write_fmt::h8d147888220078ef
                               at src/libstd/io/mod.rs:1412
   6:     0x7f00772db19e - std::sys_common::backtrace::_print::h8a6df0fa81d6af62
                               at src/libstd/sys_common/backtrace.rs:65
   7:     0x7f00772db19e - std::sys_common::backtrace::print::h6f05b4733407e509
                               at src/libstd/sys_common/backtrace.rs:50
   8:     0x7f00772db19e - std::panicking::default_hook::{{closure}}::h0d0a23bd02315dd8
                               at src/libstd/panicking.rs:188
   9:     0x7f00772da943 - std::panicking::default_hook::h8d15a9aecb4efac6
                               at src/libstd/panicking.rs:205
  10:     0x7f00772da943 - std::panicking::rust_panic_with_hook::hbe174577402a475d
                               at src/libstd/panicking.rs:464
  11:     0x7f00772da4be - std::panicking::continue_panic_fmt::h4d855dad868accf3
                               at src/libstd/panicking.rs:373
  12:     0x7f00772da450 - std::panicking::begin_panic_fmt::ha0f013e3301a9528
                               at src/libstd/panicking.rs:328
  13:     0x7f00772aae86 - <rustup::diskio::threaded::Threaded as rustup::diskio::Executor>::join::hf33124263a81d2a4
  14:     0x7f00772aa636 - core::ptr::real_drop_in_place::haa8255139d9471a2
  15:     0x7f0076fd5190 - core::ptr::real_drop_in_place::h04c627b98e68397b
  16:     0x7f007729e777 - rustup::dist::component::package::unpack_without_first_dir::h352b57d236248e9a
  17:     0x7f00772762f6 - rustup::dist::manifestation::Manifestation::update::h8c800deec8167b5b
  18:     0x7f0077264b8a - rustup::dist::dist::try_update_from_dist_::h113375517e7a85ca
  19:     0x7f007724964c - rustup::toolchain::Toolchain::install::h048b51ffab245b48
  20:     0x7f0077246c8c - rustup::toolchain::Toolchain::install_from_dist::h00b9aafeb93470e5
  21:     0x7f0076f143ee - rustup_init::self_update::install::h4cee0e396cee456b
  22:     0x7f0076f25ca2 - rustup_init::run_rustup_inner::ha545371fd2dc19a6
  23:     0x7f0076f22d64 - rustup_init::main::hba9a23e308c96901
  24:     0x7f0076eb7a03 - std::rt::lang_start::{{closure}}::h1778d9ce6385bef5
  25:     0x7f0076f2c458 - main
  26:     0x7f0076b870b3 - __libc_start_main
  27:     0x7f0076eb4029 - <unknown>
thread panicked while panicking. aborting.
Illegal instruction (core dumped)

Full backtrace from curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | RUST_BACKTRACE=full sh:

thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `22`,
 right: `4`', src/libstd/sys/unix/thread.rs:166:21
stack backtrace:
   0:     0x7f37bdedbc9c - backtrace::backtrace::libunwind::trace::h65597d255cb1398b
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1:     0x7f37bdedbc9c - backtrace::backtrace::trace_unsynchronized::hd4f479d7150ec4a0
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2:     0x7f37bdedbc9c - std::sys_common::backtrace::_print_fmt::h015072984a2b172c
                               at src/libstd/sys_common/backtrace.rs:77
   3:     0x7f37bdedbc9c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6df05d3335f32194
                               at src/libstd/sys_common/backtrace.rs:61
   4:     0x7f37bdbba81c - core::fmt::write::h1f444f4312eb6c27
                               at src/libcore/fmt/mod.rs:1028
   5:     0x7f37bdedb526 - std::io::Write::write_fmt::h8d147888220078ef
                               at src/libstd/io/mod.rs:1412
   6:     0x7f37bdedb19e - std::sys_common::backtrace::_print::h8a6df0fa81d6af62
                               at src/libstd/sys_common/backtrace.rs:65
   7:     0x7f37bdedb19e - std::sys_common::backtrace::print::h6f05b4733407e509
                               at src/libstd/sys_common/backtrace.rs:50
   8:     0x7f37bdedb19e - std::panicking::default_hook::{{closure}}::h0d0a23bd02315dd8
                               at src/libstd/panicking.rs:188
   9:     0x7f37bdeda943 - std::panicking::default_hook::h8d15a9aecb4efac6
                               at src/libstd/panicking.rs:205
  10:     0x7f37bdeda943 - std::panicking::rust_panic_with_hook::hbe174577402a475d
                               at src/libstd/panicking.rs:464
  11:     0x7f37bdeda4be - std::panicking::continue_panic_fmt::h4d855dad868accf3
                               at src/libstd/panicking.rs:373
  12:     0x7f37bdeda450 - std::panicking::begin_panic_fmt::ha0f013e3301a9528
                               at src/libstd/panicking.rs:328
  13:     0x7f37bdeaae86 - <rustup::diskio::threaded::Threaded as rustup::diskio::Executor>::join::hf33124263a81d2a4
  14:     0x7f37bde9cd40 - rustup::dist::component::package::unpack_without_first_dir::h352b57d236248e9a
  15:     0x7f37bde762f6 - rustup::dist::manifestation::Manifestation::update::h8c800deec8167b5b
  16:     0x7f37bde64b8a - rustup::dist::dist::try_update_from_dist_::h113375517e7a85ca
  17:     0x7f37bde4964c - rustup::toolchain::Toolchain::install::h048b51ffab245b48
  18:     0x7f37bde46c8c - rustup::toolchain::Toolchain::install_from_dist::h00b9aafeb93470e5
  19:     0x7f37bdb143ee - rustup_init::self_update::install::h4cee0e396cee456b
  20:     0x7f37bdb25ca2 - rustup_init::run_rustup_inner::ha545371fd2dc19a6
  21:     0x7f37bdb22d64 - rustup_init::main::hba9a23e308c96901
  22:     0x7f37bdab7a03 - std::rt::lang_start::{{closure}}::h1778d9ce6385bef5
  23:     0x7f37bdb2c458 - main
  24:     0x7f37bd6d70b3 - __libc_start_main
  25:     0x7f37bdab4029 - <unknown>

About this issue

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

Most upvoted comments

@Diggsey I fixed mine with this.

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

I have the exact same issue. This is probably due to the WSL1 bug mentioned in https://github.com/rust-lang/rustup/issues/2245 and tracked here: https://github.com/microsoft/WSL/issues/4898.

Basically newer versions of glibc (such as the one used by Ubuntu 20.04) switched nanosleep to use CLOCK_REALTIME which WSL1 does not support, and the relevant section of thread.rs causes the panic by trying to sleep. Microsoft mentions a fix is being backported to WSL1.

@EMCain It is just inside the default windows shell. wsl is a windows command.

This is indeed not something we can fix in rustup. Really it’s sad that it wasn’t caught before ubuntu released, but maybe they can fix it short-term until WSL updates.