Running rustup self update after manually updating the toolchaing fixed everything
rustup 0.4.0 (3171903 2016-07-22)
Default host: x86_64-unknown-linux-gnu
installed toolchains
--------------------
stable-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)
active toolchain
----------------
nightly-x86_64-unknown-linux-gnu (default)
rustc 1.12.0-nightly (936bfea94 2016-07-20)
Runing rustup update updates both the toolchains
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: downloading component 'rustc'
43.3 MiB / 43.3 MiB (100 %) 259.2 KiB/s ETA: 0 s
info: downloading component 'rust-std'
55.8 MiB / 55.8 MiB (100 %) 188.8 KiB/s ETA: 0 s
info: downloading component 'rust-docs'
7.2 MiB / 7.2 MiB (100 %) 172.8 KiB/s ETA: 0 s
info: downloading component 'cargo'
4.1 MiB / 4.1 MiB (100 %) 288.0 KiB/s ETA: 0 s
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'rust-docs'
info: installing component 'cargo'
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: downloading component 'rustc'
49.0 MiB / 49.0 MiB (100 %) 188.8 KiB/s ETA: 0 s
info: downloading component 'rust-std'
61.9 MiB / 61.9 MiB (100 %) 140.8 KiB/s ETA: 0 s
info: downloading component 'rust-docs'
8.4 MiB / 8.4 MiB (100 %) 259.2 KiB/s ETA: 0 s
info: downloading component 'cargo'
4.2 MiB / 4.2 MiB (100 %) 224.0 KiB/s ETA: 0 s
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'rust-docs'
info: installing component 'cargo'
info: checking for self-updates
info: downloading self-update
error: failed to set permissions for '/home/edoput/.cargo/bin/rustup-init'
info: caused by: No such file or directory (os error 2)
In ~/.cargo/bin/rustup the executable files are not updated
ls -al ~/.cargo/bin/
totale 52280
drwxr-xr-x 2 edoput sudo 4096 ago 21 12:49 .
drwxr-xr-x 5 edoput sudo 4096 lug 22 16:45 ..
-rwxr-xr-x 6 edoput sudo 8918368 lug 23 13:51 cargo
-rwxr-xr-x 6 edoput sudo 8918368 lug 23 13:51 rustc
-rwxr-xr-x 6 edoput sudo 8918368 lug 23 13:51 rustdoc
-rwxr-xr-x 6 edoput sudo 8918368 lug 23 13:51 rust-gdb
-rwxr-xr-x 6 edoput sudo 8918368 lug 23 13:51 rust-lldb
-rwxr-xr-x 6 edoput sudo 8918368 lug 23 13:51 rustup
Running rustup show
Default host: x86_64-unknown-linux-gnu
thread '<main>' panicked at 'extension should have target toolchain', ../src/libcore/option.rs:699
running rustup show with backtrace
stack backtrace:
1: 0x557072873f70 - std::sys::backtrace::tracing::imp::write::h9fb600083204ae7f
2: 0x55707287c20b - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::hca543c34f11229ac
3: 0x55707287be93 - std::panicking::default_hook::hc2c969e7453d080c
4: 0x55707286026f - std::sys_common::unwind::begin_unwind_inner::h30e12d15ce2b2e25
5: 0x557072861bf8 - std::sys_common::unwind::begin_unwind_fmt::hb2de8a9968d38523
6: 0x557072873331 - rust_begin_unwind
7: 0x5570728b26af - core::panicking::panic_fmt::h257ceb0aa351d801
8: 0x5570728b9964 - core::option::expect_failed::h2d57a5644f345e0b
9: 0x557072515497 - rustup::toolchain::Toolchain::list_components::h6f5e5af7ff496961
10: 0x557072454644 - rustup_init::rustup_mode::show::hd748b4cc3a400485
11: 0x55707242c66f - rustup_init::rustup_mode::main::h904c4ed7acbad99d
12: 0x55707242837e - rustup_init::run_multirust::h70cbf6663515e18b
13: 0x5570724274e1 - rustup_init::main::h81d74e5ca7cf36c2
14: 0x55707287bad4 - std::sys_common::unwind::try::try_fn::h04c0c89e4add6cc4
15: 0x5570728732bb - __rust_try
16: 0x55707287b51b - std::rt::lang_start::h61f4934e780b4dfc
17: 0x7f99a09ca72f - __libc_start_main
18: 0x5570724273d4 - <unknown>
Running rustup update stable or rustup update nightly works without panic.
same here (upgrading to 1.3.0)
Same here, trying to update rustup. Successfully updates toolchains, fails to update rustup itself:
daboross:/home/daboross/
$ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'beta-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: downloading component 'rustc'
52.0 MiB / 52.0 MiB (100 %) 3.9 MiB/s ETA: 0 s
info: downloading component 'rust-std'
82.8 MiB / 82.8 MiB (100 %) 3.6 MiB/s ETA: 0 s
info: downloading component 'cargo'
5.0 MiB / 5.0 MiB (100 %) 3.3 MiB/s ETA: 0 s
info: downloading component 'rust-docs'
12.6 MiB / 12.6 MiB (100 %) 3.4 MiB/s ETA: 0 s
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'cargo'
info: installing component 'rust-docs'
info: checking for self-updates
info: downloading self-update
error: failed to set permissions for '/home/daboross/.cargo/bin/rustup-init'
info: caused by: No such file or directory (os error 2)
daboross:/home/daboross/
$ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'beta-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: checking for self-updates
info: downloading self-update
error: failed to set permissions for '/home/daboross/.cargo/bin/rustup-init'
info: caused by: No such file or directory (os error 2)
Exactly the same here (upgrading to 1.4.0).
Also same error in log as above.
No idea what changed, but I just realized that it has successfully updated to v1.4.0 one of the times that I ran rustup update (I wasn't paying attention because I just was trying to update nightly).
I still don't have a .cargo/bin/rustup-init file, but it seems to have succeeded anyways.
I hit this going to 1.5.0. I immediately ran rustup self update and that succeeded.
$ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'beta-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2017-06-28, rust version 1.20.0-nightly (f590a44ce 2017-06-27)
info: downloading component 'rustc'
38.7 MiB / 38.7 MiB (100 %) 3.1 MiB/s ETA: 0 s
info: downloading component 'rust-std'
57.6 MiB / 57.6 MiB (100 %) 3.2 MiB/s ETA: 0 s
info: downloading component 'cargo'
3.7 MiB / 3.7 MiB (100 %) 3.2 MiB/s ETA: 0 s
info: downloading component 'rust-docs'
3.6 MiB / 3.6 MiB (100 %) 3.0 MiB/s ETA: 0 s
info: downloading component 'rust-std' for 'x86_64-unknown-linux-musl'
11.6 MiB / 11.6 MiB (100 %) 3.1 MiB/s ETA: 0 s
info: downloading component 'rust-src'
info: removing component 'rustc'
info: removing component 'rust-std'
info: removing component 'cargo'
info: removing component 'rust-docs'
info: removing component 'rust-std' for 'x86_64-unknown-linux-musl'
info: removing component 'rust-src'
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'cargo'
info: installing component 'rust-docs'
info: installing component 'rust-std' for 'x86_64-unknown-linux-musl'
info: installing component 'rust-src'
info: checking for self-updates
info: downloading self-update
error: failed to set permissions for '/home/david/.cargo/bin/rustup-init'
info: caused by: No such file or directory (os error 2)
$ rustup self update
info: checking for self-updates
info: downloading self-update
info: rustup updated successfully to 1.5.0
@dtolnay 's solution worked for me!
This is occurring again on my system - not sure if it's related to the original failure. Running rustup self update afterwards or repeatedly doesn't seem to help it. It keeps failing with:
$ rustup self update
info: checking for self-updates
info: downloading self-update
error: failed to set permissions for '/home/daboross/.cargo/bin/rustup-init'
info: caused by: No such file or directory (os error 2)
As it says, there is no .cargo/bin/rustup-init file. If I create it with touch, rustup will delete it, then error with the same message.
It was fixed by doing both touch .cargo/bin/rustup-init; and chmod +x .cargo/bin/rustup-init. I'm.. not sure why, maybe then it didn't try to change permissions?
For me the problem was solved by closing GNOME Builder before starting the update, otherwise the file would disappear after some time if created manually without invoking rustup yet.
Hmm, interesting. I haven't used GNOME Builder at all, but maybe I had some other thing running which had the same effect.
Running into this again with the latest update.
The workarounds mentioned in my post above (touch .cargo/bin/rustup-init; chmod +x .cargo/bin/rustup-init) no longer work.
rustup show and other rustup commands work correctly. It's only rustup update self (and rustup update' self portion) which error.
Update: running rustup self update once did not work. Running it a second time did work...
$ rustup self update
info: checking for self-updates
info: downloading self-update
error: failed to set permissions for '/home/daboross/.cargo/bin/rustup-init'
info: caused by: No such file or directory (os error 2)
$ RUST_LOG=debug rustup self update
info: checking for self-updates
info: downloading self-update
info: rustup updated successfully to 1.13.0
Had this again updating to rustup 1.16.0. Same situation as my last post. It failed the first time I ran rustup update, but succeeded a second run.
... rest of the update ...
info: installing component 'rustfmt'
info: installing component 'rust-src'
info: checking for self-updates
info: downloading self-update
error: failed to set permissions for '/home/daboross/.cargo/bin/rustup-init'
info: caused by: No such file or directory (os error 2)
daboross:/home/daboross/Projects/Rust/screeps-starter-rust/
$ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: checking for self-updates
info: downloading self-update
stable-x86_64-unknown-linux-gnu unchanged - rustc 1.31.1 (b6c32da9b 2018-12-18)
nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.33.0-nightly (14b96659e 2018-12-25)
daboross:/home/daboross/Projects/Rust/screeps-starter-rust/
$ rustup --version
rustup 1.16.0 (beab5ac2b 2018-12-06)
Ran into this again on a different machine. As with the OP, the solution was to run rustup self update instead.
Unlike last time I ran into this, it fails continuously. Every invocation of rustup update errored with the same error.
Terminal Log
55.7 MiB / 55.7 MiB (100 %) 18.2 MiB/s in 3s ETA: 0s
info: installing component 'rustfmt'
info: checking for self-updates
info: downloading self-update
error: failed to set permissions for '/home/daboross/.cargo/bin/rustup-init'
error: caused by: No such file or directory (os error 2)
โโโโโโโโโโโโโโโโโโโโโโโโ:~chalk/
$ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2020-11-28, rust version 1.50.0-nightly (6a889570e 2020-11-27)
info: skipping nightly which is missing installed component 'rustfmt-preview'
info: syncing channel updates for 'nightly-2020-11-27-x86_64-unknown-linux-gnu'
info: latest update on 2020-11-27, rust version 1.50.0-nightly (72da5a9d8 2020-11-26)
info: skipping nightly which is missing installed component 'rustfmt-preview'
info: syncing channel updates for 'nightly-2020-11-26-x86_64-unknown-linux-gnu'
info: latest update on 2020-11-26, rust version 1.50.0-nightly (b48cafd9e 2020-11-25)
info: skipping nightly which is missing installed component 'rustfmt-preview'
info: syncing channel updates for 'nightly-2020-11-25-x86_64-unknown-linux-gnu'
info: checking for self-updates
info: downloading self-update
error: failed to set permissions for '/home/daboross/.cargo/bin/rustup-init'
error: caused by: No such file or directory (os error 2)
โโโโโโโโโโโโโโโโโโโโโโโโ:~chalk/
$ touch .cargo/bin/rustup-init; chmod +x .cargo/bin/rustup-init
touch: cannot touch '.cargo/bin/rustup-init': No such file or directory
chmod: cannot access '.cargo/bin/rustup-init': No such file or directory
โโโโโโโโโโโโโโโโโโโโโโโโ:~chalk/
$ cd
โโโโโโโโโโโโโโโโโโโโโโโโ:~/
$ touch .cargo/bin/rustup-init; chmod +x .cargo/bin/rustup-init
โโโโโโโโโโโโโโโโโโโโโโโโ:~/
$ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2020-11-28, rust version 1.50.0-nightly (6a889570e 2020-11-27)
info: skipping nightly which is missing installed component 'rustfmt-preview'
info: syncing channel updates for 'nightly-2020-11-27-x86_64-unknown-linux-gnu'
info: latest update on 2020-11-27, rust version 1.50.0-nightly (72da5a9d8 2020-11-26)
info: skipping nightly which is missing installed component 'rustfmt-preview'
info: syncing channel updates for 'nightly-2020-11-26-x86_64-unknown-linux-gnu'
info: latest update on 2020-11-26, rust version 1.50.0-nightly (b48cafd9e 2020-11-25)
info: skipping nightly which is missing installed component 'rustfmt-preview'
info: syncing channel updates for 'nightly-2020-11-25-x86_64-unknown-linux-gnu'
info: checking for self-updates
info: downloading self-update
error: failed to set permissions for '/home/daboross/.cargo/bin/rustup-init'
error: caused by: No such file or directory (os error 2)
Log of it working with rustup self update:
$ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2020-11-28, rust version 1.50.0-nightly (6a889570e 2020-11-27)
info: skipping nightly which is missing installed component 'rustfmt-preview'
info: syncing channel updates for 'nightly-2020-11-27-x86_64-unknown-linux-gnu'
info: latest update on 2020-11-27, rust version 1.50.0-nightly (72da5a9d8 2020-11-26)
info: skipping nightly which is missing installed component 'rustfmt-preview'
info: syncing channel updates for 'nightly-2020-11-26-x86_64-unknown-linux-gnu'
info: latest update on 2020-11-26, rust version 1.50.0-nightly (b48cafd9e 2020-11-25)
info: skipping nightly which is missing installed component 'rustfmt-preview'
info: syncing channel updates for 'nightly-2020-11-25-x86_64-unknown-linux-gnu'
info: checking for self-updates
info: downloading self-update
error: failed to set permissions for '/home/daboross/.cargo/bin/rustup-init'
error: caused by: No such file or directory (os error 2)
โโโโโโโโโโโโโโโโโโโโโโโโ:~/
$ rustup --version
rustup 1.22.1 (b01adbbc3 2020-07-08)
โโโโโโโโโโโโโโโโโโโโโโโโ:~/
$ rustup self update
info: checking for self-updates
info: downloading self-update
rustup updated - 1.23.0 (from 1.22.1)
โโโโโโโโโโโโโโโโโโโโโโโโ:~/
$ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2020-11-28, rust version 1.50.0-nightly (6a889570e 2020-11-27)
info: skipping nightly which is missing installed component 'rustfmt'
info: syncing channel updates for 'nightly-2020-11-27-x86_64-unknown-linux-gnu'
info: latest update on 2020-11-27, rust version 1.50.0-nightly (72da5a9d8 2020-11-26)
info: skipping nightly which is missing installed component 'rustfmt'
info: syncing channel updates for 'nightly-2020-11-26-x86_64-unknown-linux-gnu'
info: latest update on 2020-11-26, rust version 1.50.0-nightly (b48cafd9e 2020-11-25)
info: skipping nightly which is missing installed component 'rustfmt'
info: syncing channel updates for 'nightly-2020-11-25-x86_64-unknown-linux-gnu'
info: checking for self-updates
stable-x86_64-unknown-linux-gnu unchanged - rustc 1.48.0 (7eac88abb 2020-11-16)
nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.50.0-nightly (1c389ffef 2020-11-24)
info: cleaning up downloads & tmp directories
โโโโโโโโโโโโโโโโโโโโโโโโ:~/
$
I still have no idea what caused this, or why I continue to experience it every so often. It's been 2 years, and this is on a different computer (& different linux distribution) but there's probably _something_ in my environment causing this.
Other than guessing that you had something else deciding to grab at the binaries I'm unsure what could cause this. rustup self update is the same code as runs at the end of rustup update so there's no specific reason in rustup why one would succeed where the other failed.
Similar to @daboross, running rustup self update multiple times worked. In my case I had to run it three times!
```
โญโ[11:48]: jeldredge at jeldredge-mbp in ~/fbsource/fbcode/relay
โฐโโค rustup update
info: syncing channel updates for 'stable-x86_64-apple-darwin'
info: latest update on 2020-11-19, rust version 1.48.0 (7eac88abb 2020-11-16)
info: downloading component 'clippy'
info: downloading component 'rustc'
49.9 MiB / 49.9 MiB (100 %) 26.0 MiB/s in 2s ETA: 0s
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: downloading component 'rust-std' for 'wasm32-unknown-unknown'
info: downloading component 'rls'
info: downloading component 'rust-src'
info: downloading component 'rust-analysis'
info: removing previous version of component 'clippy'
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 'rust-std' for 'wasm32-unknown-unknown'
info: removing previous version of component 'rls'
info: removing previous version of component 'rust-src'
info: removing previous version of component 'rust-analysis'
info: installing component 'clippy'
info: Defaulting to 500.0 MiB unpack ram
info: installing component 'rustc'
49.9 MiB / 49.9 MiB (100 %) 13.2 MiB/s in 3s ETA: 0s
info: installing component 'rust-std'
20.4 MiB / 20.4 MiB (100 %) 12.4 MiB/s in 1s ETA: 0s
info: installing component 'cargo'
info: installing component 'rust-docs'
13.3 MiB / 13.3 MiB (100 %) 4.4 MiB/s in 2s ETA: 0s
info: installing component 'rust-std' for 'wasm32-unknown-unknown'
12.9 MiB / 12.9 MiB (100 %) 6.4 MiB/s in 2s ETA: 0s
info: installing component 'rls'
7.1 MiB / 7.1 MiB (100 %) 3.4 MiB/s in 2s ETA: 0s
info: installing component 'rust-src'
info: installing component 'rust-analysis'
info: checking for self-updates
info: downloading self-update
error: failed to set permissions for '/Users/jeldredge/.cargo/bin/rustup-init'
error: caused by: No such file or directory (os error 2)
โญโ[11:49]: jeldredge at jeldredge-mbp in ~/fbsource/fbcode/relay
โฐโโค rustup self update
info: checking for self-updates
info: downloading self-update
error: failed to set permissions for '/Users/jeldredge/.cargo/bin/rustup-init'
error: caused by: No such file or directory (os error 2)
โญโ[11:50]: jeldredge at jeldredge-mbp in ~/fbsource/fbcode/relay
โฐโโค rustup self update
info: checking for self-updates
info: downloading self-update
error: failed to set permissions for '/Users/jeldredge/.cargo/bin/rustup-init'
error: caused by: No such file or directory (os error 2)
โญโ[11:51]: jeldredge at jeldredge-mbp in ~/fbsource/fbcode/relay
โฐโโค rustup self update
info: checking for self-updates
info: downloading self-update
rustup updated - 1.23.1 (from 1.22.1)
```
Did you have anything else running rust or rust related binaries at that time (e.g. other terminals running cargo, or an instance of an editor with an rls or rust-analyzer underneath it)?
strace would be a good tool to find out what is going on...
Did you have anything else running rust or rust related binaries at that time (e.g. other terminals running cargo, or an instance of an editor with an rls or rust-analyzer underneath it)?
I do have a habit of updating all my cargo-installed projects at the same time as running rustup update, so it could definitely be this! Can't be sure, but I'll try to pay attention when it happens next.
I just tried updating to the latest version explicitly after closing all other programs, and it did succeed. Though it seems like intermittent failure in any case so I can't be sure that says anything.
Will make sure to run strace when updating from now on to see if I can help debug this.
Most helpful comment
I hit this going to 1.5.0. I immediately ran
rustup self updateand that succeeded.