rustup: error: rustup is not installed at '/home/user/.cargo' when $RUSTUP_HOME is set to something other than the former

Problem

  1. Rustup cannot update when CARGO_HOME is not the Linux default ~/.cargo
  2. Then rustup self uninstall fails to work
  3. At https://www.rust-lang.org/tools/install, there are no further instructions, or a link to those instructions, on how to uninstall rustup.

Steps

20:02 $ echo $RUSTUP_HOME
/home/<snip>/.rustup
✔ ~/src/<snip> [port ↑·2|✚ 2…1]
20:02 $ echo $CARGO_HOME
/home/<snip>/.local/share/cargo
^[[A✔ ~/src/<snip> [port ↑·2|✚ 2…1]
20:02 $ which rustup
/home/<snip>/.local/share/cargo/bin/rustup
✔ ~/src/<snip> [port ↑·2|✚ 2…1]
20:02 $ rustup self update
error: rustup is not installed at '/home/<snip>/.cargo'

Possible Solution(s) No idea. We seem to be in a Mexican-standoff.

Notes

Output of rustup --version:

$ rustup --version
rustup 1.23.1 (3df2264a9 2020-11-30)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.56.0-nightly (5ad7389bd 2021-08-06)`

Output of rustup show:

20:14 $ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/<snip>/.rustup

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.56.0-nightly (5ad7389bd 2021-08-06)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 20 (6 by maintainers)

Commits related to this issue

Most upvoted comments

@Xenira thanks for the resolution.

Also ran into this problem in my gitlab pipeline. Cause is definitely the self update.

Resolved by running rustup set auto-self-update disable before my other commands.

@danieleades I suggest you try out https://gitlab.com/rust-ci/rust-ci - I know the authors of that and they’re pretty helpful.

@bbros-dev In other words, you think the current error message is unclear? That seems like a reasonable complaint to me. Might be an easy PR as well.