Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install panic on Ubuntu 20.04 in Windows Subsystem for Linux #2293

Closed
leth opened this issue Apr 23, 2020 · 18 comments
Closed

Install panic on Ubuntu 20.04 in Windows Subsystem for Linux #2293

leth opened this issue Apr 23, 2020 · 18 comments
Labels

Comments

@leth
Copy link

leth commented Apr 23, 2020

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.aaakk.us.kg-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1:     0x7f00772dbc9c - backtrace::backtrace::trace_unsynchronized::hd4f479d7150ec4a0
                               at /cargo/registry/src/github.aaakk.us.kg-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.aaakk.us.kg-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1:     0x7f37bdedbc9c - backtrace::backtrace::trace_unsynchronized::hd4f479d7150ec4a0
                               at /cargo/registry/src/github.aaakk.us.kg-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>
@leth leth added the bug label Apr 23, 2020
@fboulnois
Copy link

I have the exact same issue. This is probably due to the WSL1 bug mentioned in #2245 and tracked here: microsoft/WSL#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.

@kinnison
Copy link
Contributor

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.

@nfwatsoncom
Copy link

Failure is same with Ubuntu 20.04 on WSL2.

@rbtcollins
Copy link
Contributor

@nfwatsoncom are you absolutely sure you're using WSL2? The underlying cause of this bug is the non-linux kernel implementation in WSL, which WSL2 avoids by using an actual Linux kernel. The generally good advice of filing a new bug if your situation doesn't match exactly applies here I think.

I'm closing this as a dup of #2245

@Nejat
Copy link

Nejat commented May 28, 2020

@nfwatsoncom are you absolutely sure you're using WSL2? The underlying cause of this bug is the non-linux kernel implementation in WSL, which WSL2 avoids by using an actual Linux kernel. The generally good advice of filing a new bug if your situation doesn't match exactly applies here I think.

I'm closing this as a dup of #2245

I just updated to the release version of the May 2020 update with WSL2, installed Ubuntu 20.04 and immediately attempted to install rustup. It failed with the following output

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-05-07, rust version 1.43.1 (8d69840ab 2020-05-04)
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:     0x7f90236dbc9c - backtrace::backtrace::libunwind::trace::h65597d255cb1398b
                               at /cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1:     0x7f90236dbc9c - backtrace::backtrace::trace_unsynchronized::hd4f479d7150ec4a0
                               at /cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2:     0x7f90236dbc9c - std::sys_common::backtrace::_print_fmt::h015072984a2b172c
                               at src/libstd/sys_common/backtrace.rs:77
   3:     0x7f90236dbc9c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6df05d3335f32194
                               at src/libstd/sys_common/backtrace.rs:61
   4:     0x7f90233ba81c - core::fmt::write::h1f444f4312eb6c27
                               at src/libcore/fmt/mod.rs:1028
   5:     0x7f90236db526 - std::io::Write::write_fmt::h8d147888220078ef
                               at src/libstd/io/mod.rs:1412
   6:     0x7f90236db19e - std::sys_common::backtrace::_print::h8a6df0fa81d6af62
                               at src/libstd/sys_common/backtrace.rs:65
   7:     0x7f90236db19e - std::sys_common::backtrace::print::h6f05b4733407e509
                               at src/libstd/sys_common/backtrace.rs:50
   8:     0x7f90236db19e - std::panicking::default_hook::{{closure}}::h0d0a23bd02315dd8
                               at src/libstd/panicking.rs:188
   9:     0x7f90236da943 - std::panicking::default_hook::h8d15a9aecb4efac6
                               at src/libstd/panicking.rs:205
  10:     0x7f90236da943 - std::panicking::rust_panic_with_hook::hbe174577402a475d
                               at src/libstd/panicking.rs:464
  11:     0x7f90236da4be - std::panicking::continue_panic_fmt::h4d855dad868accf3
                               at src/libstd/panicking.rs:373
  12:     0x7f90236da450 - std::panicking::begin_panic_fmt::ha0f013e3301a9528
                               at src/libstd/panicking.rs:328
  13:     0x7f90236aae86 - <rustup::diskio::threaded::Threaded as rustup::diskio::Executor>::join::hf33124263a81d2a4
  14:     0x7f90236aa636 - core::ptr::real_drop_in_place::haa8255139d9471a2
  15:     0x7f90233d5190 - core::ptr::real_drop_in_place::h04c627b98e68397b
  16:     0x7f902369e777 - rustup::dist::component::package::unpack_without_first_dir::h352b57d236248e9a
  17:     0x7f90236762f6 - rustup::dist::manifestation::Manifestation::update::h8c800deec8167b5b
  18:     0x7f9023664b8a - rustup::dist::dist::try_update_from_dist_::h113375517e7a85ca
  19:     0x7f902364964c - rustup::toolchain::Toolchain::install::h048b51ffab245b48
  20:     0x7f9023646c8c - rustup::toolchain::Toolchain::install_from_dist::h00b9aafeb93470e5
  21:     0x7f90233143ee - rustup_init::self_update::install::h4cee0e396cee456b
  22:     0x7f9023325ca2 - rustup_init::run_rustup_inner::ha545371fd2dc19a6
  23:     0x7f9023322d64 - rustup_init::main::hba9a23e308c96901
  24:     0x7f90232b7a03 - std::rt::lang_start::{{closure}}::h1778d9ce6385bef5
  25:     0x7f902332c458 - main
  26:     0x7f9022f370b3 - __libc_start_main
  27:     0x7f90232b4029 - <unknown>
thread panicked while panicking. aborting.
Illegal instruction (core dumped)

@Diggsey
Copy link
Contributor

Diggsey commented May 28, 2020

@Nejat you need to explicitly opt into WSL 2 befire you create your distro, using this command:

wsl --set-default-version 2

It is not enough to just have the update.

@Nejat
Copy link

Nejat commented May 28, 2020

@Diggsey thanks that worked

@Dav3rs
Copy link

Dav3rs commented Jun 9, 2020

How can I fix this and install Rust? I have the same issue. WSL2+Ubuntu20.04 crash in the cargo installation step.

@kinnison
Copy link
Contributor

kinnison commented Jun 9, 2020

I believe the wsl tool supports upgrading an existing WSL 1 system to a WSL 2 one. Check out the help for that tool.

@rbtcollins
Copy link
Contributor

@Charlie96D Again, are you absolutely sure you're using WSL2? You probably have a WSL1 instance, in which case your solution is to actually use WSL2, which will fix this, or an older glibc, which will also fix this. See the bug that this is a duplicate of.

@Dav3rs
Copy link

Dav3rs commented Jun 11, 2020

Sorry, I had no idea that windows 20.04 comes with wsl2 disabled by default. Everything is ok.

@steelx
Copy link

steelx commented Jun 11, 2020

i also have WSL2 with ubuntu. And the issue persists
I updated my wsl to wsl2 with existing installed Ubuntu.

@Diggsey
Copy link
Contributor

Diggsey commented Jun 11, 2020

This issue only occurs on wsl1 @steelx run wsl --list -v

@steelx
Copy link

steelx commented Jun 12, 2020

@Diggsey I fixed mine with this.

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

@mununki
Copy link

mununki commented Jun 13, 2020

@steelx Thx!

@EMCain
Copy link

EMCain commented Jun 21, 2020

sorry, where are people running the wsl commands like wsl --set-default-version 2? Is it inside the Linux Subsystem terminal, or somewhere else like Windows Powershell? Trying to run it in the subystem terminal gets me this:

emcain@DESKTOP-RP9QN0S:~$ wsl --set-default-version 2

Command 'wsl' not found, but can be installed with:

sudo apt install wsl

emcain@DESKTOP-RP9QN0S:~$ sudo apt install wsl
[sudo] password for emcain:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package wsl

Edit: this looks relevant, and like I may need to update my Windows version, so I'm trying that first.

https://docs.microsoft.com/en-us/windows/wsl/install-win10#update-to-wsl-2

@jaynus
Copy link

jaynus commented Jun 23, 2020

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

@aisivan36
Copy link

aisivan36 commented Aug 22, 2020

Thanks, it worked and Rust became installed on my WSL 2 Ubuntu

PS C:\Users\Ivan Boginski> wsl --list -v
NAME STATE VERSION

  • Ubuntu Running 1
    PS C:\Users\Ivan Boginski> wsl --set-default-version 2
    For information on key differences with WSL 2 please visit https://aka.ms/wsl2
    PS C:\Users\Ivan Boginski> wsl --list --verbose
    NAME STATE VERSION
  • Ubuntu Running 1
    PS C:\Users\Ivan Boginski> wsl --set-version Ubuntu-20.04 2
    There is no distribution with the supplied name.
    PS C:\Users\Ivan Boginski> wsl --set-version Ubuntu 2
    Conversion in progress, this may take a few minutes...
    For information on key differences with WSL 2 please visit https://aka.ms/wsl2
    Conversion complete.
    PS C:\Users\Ivan Boginski>
    PS C:\Users\Ivan Boginski> wsl --list --verbose
    NAME STATE VERSION
  • Ubuntu Stopped 2
    PS C:\Users\Ivan Boginski> wsl --list --verbose
    NAME STATE VERSION
  • Ubuntu Running 2

@rust-lang rust-lang locked as resolved and limited conversation to collaborators Aug 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests