-
Notifications
You must be signed in to change notification settings - Fork 892
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 update fails on Windows "error: could not remove 'rustup-bin' file: 'C:\Users\USER\.cargo\bin\rustup.exe'" #1367
Comments
I don't understand why this is labeled "insufficient detail". |
For people that are having this issue, here's how I worked around it: cd "%USERPROFILE%\.cargo\bin"
ren rustup.exe rustup1.exe
mklink rustup.exe rustup1.exe
rustup update
del rustup1.exe |
@piscisaureus rustup already does this renaming itself, and this functionality is extensively tested - this error means that something else is holding a lock on rustup.exe, hence insufficient detail. Most likely reason is that the RLS is running in the background. |
Leaving this in case anyone bumped into the same issue. @Diggsey's explanation is spot on. I can't seemed to update rustup tonight, and after reading, I realized that RLS is running in the background (atom). Closed atom and it updates cleanly now. |
I have the same issue, probably RLS running in background but I don't know why rustup doesn't busy wait and tell that it can't remove the file. Now that everything else has been updated I am not really sure it's safe to use rustup since it left the system in inconsistent state where the rust itself has been updated but rustup is presumably not? Update: seems like running |
I confirm the issue on Windows 7 with RLS running (VSCode open). The solution is to stop RLS (by closing VSCode). The |
I also received the same error. Upon closing VSCode (which had RLS running), re-running |
I do have a similar problem. Now whenever there is a rustup self-update, I get the following error:
If I then manually start a CMD as "gitlab" and do the same steps, everything works. So far I haven't found a solution. I do not have concurrent builds so there should be no additional lock on any file. |
Is it possible to include in the error message something helpful or even better, an automatic fix, as this is an issue anyone trying to run rustup update in vs code is likely to experience. |
There isn't a lot we can do to fix it without introducing other issues instead due to the limitations in Windows. It's possible we could construct a more informative error context though. |
Most of the installers on Windows seem to use the Restart Manager API. The Microsoft documentation contains some description and example code for using the API. Note that the API can just be used to detect which process holds a lock on some file (similar to |
That is very interesting, thank you @t-rapp |
Closing out of all instances of VS Code and even running Command Prompt as Administrator did not help, but rebooting the computer and rerunning the command did (I did not need to run Command Prompt as Administrator after rebooting). |
I imagine this means that at least one |
#2441 is the systemic bug for these sort of errors. |
@kinnison: Although this issue has been closed I'd like to get rid of some RestartManager API example code that I just ported to Rust, for future reference. |
I've now looked into it and I don't think RestartManager is suitable for the problem for rustup. It doesn't handle the case of new processes starting up during the update procedure. And it depends on throwing up UI prompts for shutting down and restarting things. It's a fine solution for the general case but we can do better in the special case. |
I'm getting the same error, except there is nothing rust-related running apart from |
This was due MS Visual Studio Code locking the %USERPROFILE%/.cargo directory for me. I have a few seemingly common rust extensions enabled. Quitting Code released the file locks. |
had this issue because intellij was locking rustup |
Running into this again. This time, it's failing to update
|
It keeps happening and my original workaround doesn't work.
What am I supposed to do? |
For whatever reason: on Windows 10, |
@ChrisDenton can you reproduce this? |
For clarification, the workaround I found only works when In other words, starting the However, directly starting A wild guess: it might be related to permissions differences (e.g. user account-level installation vs system-wide installation) between |
Running
rustup self update
on Windows is failing because it can't delete it's own binary.The text was updated successfully, but these errors were encountered: