Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

thread 'main' panicked at 'assertion failed: `(left == right)` left: `22`, right: `4`' when installing Rust for WSL

I go to the website and see a script to download the Rust installer:

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

I changed some things in the Customize Installation option and proceed with the installation then get the following error:

info: profile set to 'complete'
info: setting default host triple to x86_64-unknown-linux-gnu
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2020-05-04, rust version 1.45.0-nightly (65b448273 2020-05-03)
warning: Force-skipping unavailable component 'lldb-preview-x86_64-unknown-linux-gnu'
warning: Force-skipping unavailable component 'rls-x86_64-unknown-linux-gnu'
info: downloading component 'cargo'
  5.0 MiB /   5.0 MiB (100 %)   3.2 MiB/s in  2s ETA:  0s
info: downloading component 'clippy'
info: downloading component 'llvm-tools-preview'
info: downloading component 'miri'
  1.7 MiB /   1.7 MiB (100 %) 672.4 KiB/s in  2s ETA:  0s
info: downloading component 'rust-analysis'
info: downloading component 'rust-docs'
 12.2 MiB /  12.2 MiB (100 %)   3.2 MiB/s in  4s ETA:  0s
info: downloading component 'rust-src'
info: downloading component 'rust-std'
 15.8 MiB /  15.8 MiB (100 %)   3.9 MiB/s in  4s ETA:  0s
info: downloading component 'rustc'
 60.5 MiB /  60.5 MiB (100 %)   3.0 MiB/s in 17s ETA:  0s
info: downloading component 'rustc-dev'
 63.4 MiB /  63.4 MiB (100 %)   3.7 MiB/s in 19s ETA:  0s
info: downloading component 'rustfmt'
  3.4 MiB /   3.4 MiB (100 %)   3.0 MiB/s in  1s ETA:  0s
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:     0x7fb935adbc9c - backtrace::backtrace::libunwind::trace::h65597d255cb1398b
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1:     0x7fb935adbc9c - backtrace::backtrace::trace_unsynchronized::hd4f479d7150ec4a0
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2:     0x7fb935adbc9c - std::sys_common::backtrace::_print_fmt::h015072984a2b172c
                               at src/libstd/sys_common/backtrace.rs:77
   3:     0x7fb935adbc9c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6df05d3335f32194
                               at src/libstd/sys_common/backtrace.rs:61
   4:     0x7fb9357ba81c - core::fmt::write::h1f444f4312eb6c27
                               at src/libcore/fmt/mod.rs:1028
   5:     0x7fb935adb526 - std::io::Write::write_fmt::h8d147888220078ef
                               at src/libstd/io/mod.rs:1412
   6:     0x7fb935adb19e - std::sys_common::backtrace::_print::h8a6df0fa81d6af62
                               at src/libstd/sys_common/backtrace.rs:65
   7:     0x7fb935adb19e - std::sys_common::backtrace::print::h6f05b4733407e509
                               at src/libstd/sys_common/backtrace.rs:50
   8:     0x7fb935adb19e - std::panicking::default_hook::{{closure}}::h0d0a23bd02315dd8
                               at src/libstd/panicking.rs:188
   9:     0x7fb935ada943 - std::panicking::default_hook::h8d15a9aecb4efac6
                               at src/libstd/panicking.rs:205
  10:     0x7fb935ada943 - std::panicking::rust_panic_with_hook::hbe174577402a475d
                               at src/libstd/panicking.rs:464
  11:     0x7fb935ada4be - std::panicking::continue_panic_fmt::h4d855dad868accf3
                               at src/libstd/panicking.rs:373
  12:     0x7fb935ada450 - std::panicking::begin_panic_fmt::ha0f013e3301a9528
                               at src/libstd/panicking.rs:328
  13:     0x7fb935aaae86 - <rustup::diskio::threaded::Threaded as rustup::diskio::Executor>::join::hf33124263a81d2a4
  14:     0x7fb935aaa636 - core::ptr::real_drop_in_place::haa8255139d9471a2
  15:     0x7fb9357d5190 - core::ptr::real_drop_in_place::h04c627b98e68397b
  16:     0x7fb935a9e777 - rustup::dist::component::package::unpack_without_first_dir::h352b57d236248e9a
  17:     0x7fb935a762f6 - rustup::dist::manifestation::Manifestation::update::h8c800deec8167b5b
  18:     0x7fb935a64b8a - rustup::dist::dist::try_update_from_dist_::h113375517e7a85ca
  19:     0x7fb935a4964c - rustup::toolchain::Toolchain::install::h048b51ffab245b48
  20:     0x7fb935a46c8c - rustup::toolchain::Toolchain::install_from_dist::h00b9aafeb93470e5
  21:     0x7fb9357143ee - rustup_init::self_update::install::h4cee0e396cee456b
  22:     0x7fb935725ca2 - rustup_init::run_rustup_inner::ha545371fd2dc19a6
  23:     0x7fb935722d64 - rustup_init::main::hba9a23e308c96901
  24:     0x7fb9356b7a03 - std::rt::lang_start::{{closure}}::h1778d9ce6385bef5
  25:     0x7fb93572c458 - main
  26:     0x7fb9352070b3 - __libc_start_main
  27:     0x7fb9356b4029 - <unknown>
thread panicked while panicking. aborting.
Illegal instruction (core dumped)

I also tried installing with stable as default and the same thing happened where it panics on the assertion (left == right). What might have caused this?

like image 304
LeoVen Avatar asked Mar 02 '23 11:03

LeoVen


2 Answers

This issue is here: https://github.com/rust-lang/rustup/issues/2245

The problem:

microsoft/WSL#4898 seems to be the underlying cause; glibc has now implemented nanosleep in terms of clock_nanosleep, which depends on an unsupported WSLv1 codepath https://sourceware.org/ml/libc-alpha/2019-11/msg00155.html

Solution is to downgrade glibc.

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

The above command is specific to downgrading glibc for Arch WSL. I would try the similar command for your given WSL distribution package manager.

It looks like STEEL has given the way of doing this for Ubuntu.

like image 103
tgiachetti Avatar answered Apr 06 '23 16:04

tgiachetti


I had the same problem on Windows 10 Version 1909 Build 18363.959 using Ubuntu and WSL1. Was able to solve it using the workaround that I found here: https://github.com/rust-lang/rustup/issues/2245#issuecomment-656918060

Simply execute the following commands:

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

Thanks to Marcus Cobden for this solution (see GitHub link)

like image 44
Flavio Lazzarini Avatar answered Apr 06 '23 15:04

Flavio Lazzarini