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

Can't install rustup because of existing rust that I can't remove #953

Closed
mikeyhew opened this issue Feb 12, 2017 · 16 comments

Comments

@mikeyhew
Copy link

commented Feb 12, 2017

We have a copy of rustc version 1.14.0 installed on my school's server. I want to set up the latest version of rust (currently 1.15.1) in my home directory, ideally using rustup. But because of the existing copy of rust - which I can't remove, since I don't have root access - rustup-init fails with the following error:

warning: it looks like you have an existing installation of Rust
warning: rustup cannot be installed alongside Rust. Please uninstall first
warning: run `/usr/local/lib/rustlib/uninstall.sh` as root to uninstall Rust
error: cannot install while Rust is installed
@suhr

This comment has been minimized.

Copy link

commented Mar 3, 2017

I wonder why can't rustup have a special system toolchan, that cannot be installed or updated but can be chosen.

@brson brson added the bug label Mar 16, 2017

@brson

This comment has been minimized.

Copy link
Contributor

commented Mar 17, 2017

I'm not sure the best way to fix this offhand. I think the reason I did this was to reduce potential confusion after install, having seen cases where people were still invoking the old rustc afterwards. For example, there are many cases where rustup fails to configure PATH, and that would leave the old rustc active.

We could possibly loosen this to a warning, like "warning: There is an existing rustc installed to $path. Depending on how $PATH is configured, the existing toolchain may take precedence."

Could also make it interactive, but that's deeper surgery.

A 'system' toolchain is a useful feature to add, but does not solve the problem of users being confused about which toolchain they are using.

@Diggsey Diggsey added this to Self installation in Issue Categorisation May 3, 2017

@Diggsey Diggsey moved this from Self installation to Environment issues in Issue Categorisation May 4, 2017

@chris3k

This comment has been minimized.

Copy link

commented May 5, 2017

Temporary workaroud (let's call it - force install) for this, is to download rustup.rs source code and comment sanity checks in do_pre_install_sanity_checks() (or apply patch)

diff --git a/src/rustup-cli/self_update.rs b/src/rustup-cli/self_update.rs
index 7d1a641..c289962 100644
--- a/src/rustup-cli/self_update.rs
+++ b/src/rustup-cli/self_update.rs
@@ -381,7 +381,7 @@ fn do_pre_install_sanity_checks() -> Result<()> {
         warn!("it looks like you have an existing installation of Rust");
         warn!("rustup cannot be installed alongside Rust. Please uninstall first");
         warn!("run `{}` as root to uninstall Rust", uninstaller_path.display());
-        return Err("cannot install while Rust is installed".into());
+        // return Err("cannot install while Rust is installed".into());
     }

     if rustup_sh_exists {

Then compile (cargo build) and then proceed with installation, e.g. RUSTUP_HOME=/home/user/.multirust CARGO_HOME=/home/user/.cargo ./target/debug/rustup-init --no-modify-path.

@mikeyhew

This comment has been minimized.

Copy link
Author

commented May 10, 2017

The copy of rustc that we had on my school's server has since been removed, so I was able to install rustup just fine when I tried it last week. That being said, there should be some way to force installation, even if there is an existing Rust installation somewhere.

@mgeisler

This comment has been minimized.

Copy link
Contributor

commented Jul 28, 2017

You can bypass the check by setting RUSTUP_INIT_SKIP_PATH_CHECK to yes:

$ ./rustup-init 
error: it looks like you have an existing installation of Rust at:
error: /usr/bin
error: rustup cannot be installed alongside Rust. Please uninstall first
error: if this is what you want, restart the installation with `-y'
error: cannot install while Rust is installed
$ RUSTUP_INIT_SKIP_PATH_CHECK=yes ./rustup-init 

Welcome to Rust!

This will download and install the official compiler for the Rust programming 
language, and its package manager, Cargo.
# ...

I think the error message should at least mention this environment variable -- I only found it after looking through the source of rustup-init.

@yangchengjian

This comment has been minimized.

Copy link

commented Oct 21, 2017

I meet the some question too, and I use

$RUSTUP_INIT_SKIP_PATH_CHECK=yes sh ./rustup-init.sh 

to reinstall rust, It's work.

Thanks @mgeisler

@anjalianjali1234

This comment has been minimized.

Copy link

commented Aug 28, 2018

Sorry for the late reply.

You just need to run:
curl -sSf https://static.rust-lang.org/rustup.sh | sh

it will fix the problem.

@geofmureithi

This comment has been minimized.

Copy link

commented Dec 28, 2018

@anjalianjali1234 This no longer works:(rustc1.3.0)

$ curl -sSf https://static.rust-lang.org/rustup.sh | sh
The location of rustup.sh has moved.
Run the following command to install from the new location:
    curl https://sh.rustup.rs -sSf | sh
@ssowellsvt

This comment has been minimized.

Copy link

commented Jan 11, 2019

Just run:

sudo apt remove rustc
then
curl https://sh.rustup.rs/ -sSf | sh

@mikeyhew

This comment has been minimized.

Copy link
Author

commented Jan 12, 2019

@ssowellsvt one of the premises of this issue is that the user doesn't have root access and can't use sudo.

But as @mgeisler pointed out, RUSTUP_INIT_SKIP_PATH_CHECK=yes works. So I think we can close this issue?

@PAVAN-IS201401018

This comment has been minimized.

Copy link

commented Jan 16, 2019

The copy of rustc that we had on my school's server has since been removed, so I was able to install rustup just fine when I tried it last week. That being said, there should be some way to force installation, even if there is an existing Rust installation somewhere.

How it was removed?

@mikeyhew

This comment has been minimized.

Copy link
Author

commented Jan 16, 2019

I don't know. Probably one of the admins removed it.

@anjalianjali1234

This comment has been minimized.

Copy link

commented Jan 17, 2019

@mikeyhew

This comment has been minimized.

Copy link
Author

commented Jan 23, 2019

@anjalianjali1234 was that comment directed at me? I'm not sure what you're getting at.

@mikeyhew

This comment has been minimized.

Copy link
Author

commented Jan 23, 2019

Anyway, it looks like the issue was fixed in #705. You can now add the -y option to skip the check for an existing rustc or cargo binary in PATH, and this is referenced in the error message.

@Li-ReDBox

This comment has been minimized.

Copy link

commented Mar 2, 2019

Not sure what has happened, using -y or RUSTUP_INIT_SKIP_PATH_CHECK to stop checking when installing rustup did not work for me:

./rustup-init --version
rustup-init 1.16.0 (beab5ac2b 2018-12-06)

RUSTUP_INIT_SKIP_PATH_CHECK=yes ./rustup-init 
warning: it looks like you have an existing installation of Rust
warning: rustup cannot be installed alongside Rust. Please uninstall first
warning: run `/usr/local/lib/rustlib/uninstall.sh` as root to uninstall Rust
error: cannot install while Rust is installed

./rustup-init -y./rustup-init -y
warning: it looks like you have an existing installation of Rust
warning: rustup cannot be installed alongside Rust. Please uninstall first
warning: run `/usr/local/lib/rustlib/uninstall.sh` as root to uninstall Rust
error: cannot install while Rust is installed

warning: it looks like you have an existing installation of Rust
warning: rustup cannot be installed alongside Rust. Please uninstall first
warning: run `/usr/local/lib/rustlib/uninstall.sh` as root to uninstall Rust
error: cannot install while Rust is installed

Is it possible to install rustup without un-installing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.