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 self uninstall fails on Windows if a custom toolchain is installed #2789

Open
jyn514 opened this issue Jun 4, 2021 · 4 comments · May be fixed by #2864
Open

rustup self uninstall fails on Windows if a custom toolchain is installed #2789

jyn514 opened this issue Jun 4, 2021 · 4 comments · May be fixed by #2864

Comments

@jyn514
Copy link
Member

jyn514 commented Jun 4, 2021

Problem
Rustup gives a "permission denied" error if you try to uninstall it after linking a custom toolchain.

Steps

$ git clone https://github.com/rust-lang/rust
$ cd rust
$ cargo install --path src/tools/x
$ echo 'profile = "tools"' > config.toml
$ x build
$ rustup toolchain link stage2 build/x86_64-pc-windows-msvc/stage2
$ rustup self uninstall


Thanks for hacking in Rust!

This will uninstall all Rust toolchains and data, and remove
%USERPROFILE%\.cargo/bin from your PATH environment variable.

Continue? (y/N) y

info: removing rustup home
error: could not remove 'rustup_home' directory: 'C:\Users\Joshua Nelson\.rustup': Access is denied. (os error 5)

The only thing left in ~/.rustup is .rustup/toolchains/stage2/.

Notes

Output of rustup --version: rustup 1.24.2 (755e2b0 2021-05-12)
Output of rustup show:

Default host: x86_64-pc-windows-msvc
rustup home:  C:\Users\Joshua Nelson\.rustup

no active toolchain
@jyn514 jyn514 added the bug label Jun 4, 2021
@rbtcollins
Copy link
Contributor

Probably the recursive delete crate we use doesn't know how to remove a reparse point.

@rbtcollins rbtcollins added the O-windows Windows related label Jun 5, 2021
@kinnison
Copy link
Contributor

kinnison commented Jun 8, 2021

Could we essentially do a "for each installed toolchain, uninstall toolchain, then uninstall self` in the uninstallation pathway?

It'd be a tad more long-winded than our current approach, but it would result in things being more predictable perhaps?

@Darunada
Copy link

Darunada commented Oct 9, 2021

I went with your suggested approach, let me know what you think, thanks!

@abc598300612
Copy link

Probably the rust was still being used.
I had the same issue When I uninstalled rust on windows.
Finally,I resolved by killing rust in task manager.

@rami3l rami3l modified the milestones: 1.25.0, 1.28.0 Jan 17, 2024
@rami3l rami3l modified the milestones: 1.28.0, 1.28.1 Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants