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

"rustup update stable" fails when custom CARGO_HOME is set #2309

Closed
lucasholder opened this issue Apr 27, 2020 · 5 comments
Closed

"rustup update stable" fails when custom CARGO_HOME is set #2309

lucasholder opened this issue Apr 27, 2020 · 5 comments
Labels

Comments

@lucasholder
Copy link

Problem

I am using a customCARGO_HOME and when I do rustup update stable, I get this error: error: rustup is not installed at '/Users/lucas/.my-cargo-dir.

Steps

CARGO_HOME=/tmp/somedir rustup update stable

Possible Solution(s)

Notes

Output of rustup --version:
rustup 1.21.1 (7832b2e 2019-12-20)

Output of rustup show:

Default host: x86_64-apple-darwin
rustup home: /Users/lucas/.rustup

installed toolchains

stable-x86_64-apple-darwin
nightly-x86_64-apple-darwin

installed targets for active toolchain

wasm32-unknown-unknown
x86_64-apple-darwin

active toolchain

stable-x86_64-apple-darwin (default)
rustc 1.43.0 (4fb7144ed 2020-04-20)

@kinnison
Copy link
Contributor

If your custom CARGO_HOME does not match the one rustup was installed with then this kind of behaviour is expected. If it does, then perhaps something has broken the hardlinks to confuse rustup

@amrsoll
Copy link

amrsoll commented May 31, 2020

Behaviour confirmed after having to re-install rustup using the install script from rustup.rs.

EDIT : Error on my part, I forgot to export the CARGO_HOME variable.

The phrasing of the installer suggests that it should be possible to modify those paths after the fact.

This can be modified with the CARGO_HOME environment variable.

Steps to reproduce with rustup 1.21.1 (7832b2ebe 2019-12-20)

CARGO_HOME=$HOME/.config/cargo
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # installer from rustup.rs
# [...] go through the installer which should install rustup in ~/.config/cargo
$CARGO_HOME/bin/rustup update # SUCCESS

# Try default location without the CARGO_HOME  variable set
mv ~/.config/cargo ~/.cargo
unset CARGO_HOME
~/.cargo/bin/rustup update # SUCCESS

# Changing CARGO_HOME to something different than during install
CARGO_HOME=$HOME/.cargo2
mv ~/.cargo ~/.cargo2
$CARGO_HOME/bin/rustup update # FAIL
# error: rustup is not installed at '/home/<user>/.cargo'

Installed & Active Toolchain

nightly-x86_64-unknown-linux-gnu

Installed targets

x86_64-unknown-linux-gnu

@kinnison
Copy link
Contributor

kinnison commented Jun 1, 2020

I am unable to replicate this issue as you describe it. Since you don't export CARGO_HOME properly in the first instance, rustup installs to ~/.cargo not to ~/.config/cargo and if I export CARGO_HOME properly in the first and third cases then everything works as expected.

Is it the case perhaps that you were not exporting CARGO_HOME properly?

@amrsoll
Copy link

amrsoll commented Jun 1, 2020

if I export CARGO_HOME properly in the first and third cases then everything works as expected.

Is it the case perhaps that you were not exporting CARGO_HOME properly?

You are correct. I had it in my .profile before I did the test. Everything was fine once I exported it correctly. (updated previous comment)

My problem was originally that cargo, rustup etc. don't follow the xdg standarts. 😞

I don't seem to reproduce this issue though, I think it can be closed @lucasholder ?

@rbtcollins
Copy link
Contributor

yep looks like, shell specific behaviour

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants