Skip to content

rustup update failing with could not rename component file #2729

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

Closed
spastorino opened this issue Apr 23, 2021 · 12 comments
Closed

rustup update failing with could not rename component file #2729

spastorino opened this issue Apr 23, 2021 · 12 comments

Comments

@spastorino
Copy link
Member

[santiago@galago ~]$ rustup --version
rustup 1.23.1 (2020-12-18)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.53.0-nightly (b84932674 2021-04-21)`

[santiago@galago ~]$ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'beta-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2021-04-23, rust version 1.53.0-nightly (7f4afdf02 2021-04-22)
info: downloading component 'rust-std' for 'i686-unknown-linux-gnu'
info: downloading component 'rustc-dev'
 95.0 MiB /  95.0 MiB (100 %)  36.6 MiB/s in  2s ETA:  0s
info: downloading component 'rust-src'
info: downloading component 'rust-analyzer-preview'
info: downloading component 'rust-analysis'
info: downloading component 'rls'
info: downloading component 'miri'
info: downloading component 'llvm-tools-preview'
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
 48.8 MiB /  48.8 MiB (100 %)  36.8 MiB/s in  1s ETA:  0s
info: downloading component 'rustfmt'
info: removing previous version of component 'rust-std' for 'i686-unknown-linux-gnu'
info: removing previous version of component 'rustc-dev'
info: removing previous version of component 'rust-src'
info: removing previous version of component 'rust-analyzer-preview'
info: removing previous version of component 'rust-analysis'
info: removing previous version of component 'rls'
info: removing previous version of component 'miri'
info: removing previous version of component 'llvm-tools-preview'
info: removing previous version of component 'cargo'
info: removing previous version of component 'clippy'
info: removing previous version of component 'rust-docs'
info: removing previous version of component 'rust-std'
info: removing previous version of component 'rustc'
info: removing previous version of component 'rustfmt'
info: installing component 'rust-std' for 'i686-unknown-linux-gnu'
info: using up to 500.0 MiB of RAM to unpack components
 24.3 MiB /  24.3 MiB (100 %)  13.0 MiB/s in  2s ETA:  0s
info: installing component 'rustc-dev'
 95.0 MiB /  95.0 MiB (100 %)  13.1 MiB/s in  7s ETA:  0s
info: installing component 'rust-src'
info: installing component 'rust-analyzer-preview'
info: installing component 'rust-analysis'
info: installing component 'rls'
info: installing component 'miri'
info: installing component 'llvm-tools-preview'
 21.4 MiB /  21.4 MiB (100 %)  13.9 MiB/s in  1s ETA:  0s
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 16.0 MiB /  16.0 MiB (100 %)   9.6 MiB/s in  1s ETA:  0s
info: rolling back changes
error: could not rename component file from '/home/santiago/.rustup/tmp/zf6jna9jd15jb4u__dir/bk' to '/home/santiago/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/share/man'
error: could not rename component file from '/home/santiago/.rustup/tmp/cduhrqr9cfacgp11_dir/bk' to '/home/santiago/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu'
error: could not rename component file from '/home/santiago/.rustup/tmp/df3zlcanlr6x35r5_dir/bk' to '/home/santiago/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/share/zsh'
error: could not rename component file from '/home/santiago/.rustup/tmp/ix1dug784t7aeozn_dir/bk' to '/home/santiago/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/etc'
error: could not rename component file from '/home/santiago/.rustup/tmp/l9rfug8ahze2fpjn_dir/bk' to '/home/santiago/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src'
...
@spastorino spastorino added the bug label Apr 23, 2021
@jyn514
Copy link
Member

jyn514 commented Apr 23, 2021

@spastorino Kinnison said on discord:

This happens if the component file gets corrupted. The easiest fix is to uninstall and reinstall the toolchain.

@rbtcollins
Copy link
Contributor

wheres the actual end of the output? I see the rollback start, but not the actual original error that triggered the rollback.

The could-not-renames are just symptoms of whatever the problem was I think

@spastorino
Copy link
Member Author

ohh yeah I see the problem

error: failed to install component: 'rust-docs-x86_64-unknown-linux-gnu', detected conflict: '"share/doc/rust/html"'

@spastorino
Copy link
Member Author

Uninstalled and installed again and it's now working. Anyway, unsure what happened or how the component file got corrupted.

@rbtcollins
Copy link
Contributor

dup of #2417

@radlyeel
Copy link

Newbie to rust here. Exactly how to "uninstall and reinstall the toolchain", please? This is my year to grok rust and this is my first issue.

@jyn514
Copy link
Member

jyn514 commented Apr 20, 2023

rustup toolchain uninstall stable && rustup toolchain install stable, replacing stable with the toolchain name that errored for you.

@radlyeel
Copy link

Thanks! I'm a pretty goof guesser, but I could've gone a long time before coming up wit that on my own!

@ryanvandelinder
Copy link

what lol ! FR just trying the install again worked smh ugghhhh thanks all lol

@not4rt
Copy link

not4rt commented Oct 12, 2024

Had the exact same problem, fixed by closing the IDE (vscode in my case) hehe

I think rust-analyzer plugin was blocking the folder.

@rami3l
Copy link
Member

rami3l commented Oct 14, 2024

Had the exact same problem, fixed by closing the IDE (vscode in my case) hehe

I think rust-analyzer plugin was blocking the folder.

@not4rt Thanks for the heads up. Given that, I think it'd be better to close this in favor of #2441.

@RivenSkaye
Copy link

RivenSkaye commented Apr 7, 2025

Rustup will sometimes successfully remove the old toolchain and then repeatedly fail to install it fresh - even when the problem isn't file conflicts. I've had it before and didn't think too much of rustup toolchain uninstall $FAILING_TOOLCHAIN && rustup toolchain install $FAILING_TOOLCHAIN until today. Where I spent about 20 minutes updating just the stable toolchain (nightlies rarely error for me, luckily).

Not sure if it's better to reopen the existing issue, or to open a new one. After all, the issue title perfectly reflects the actual problem

Failing output, $RUSTUP_HOME to substitute the full path

❯ rustup update
info: syncing channel updates for 'stable-x86_64-pc-windows-gnu'
info: latest update on 2025-04-03, rust version 1.86.0 (05f9846f8 2025-03-31)
info: downloading components # snip, this just works
info: removing previous version of components # snip, this just works
# snipping progress reports for brevity
info: installing component 'rust-std' for 'i686-pc-windows-gnu'
info: installing component 'rust-analyzer'
info: installing component 'rust-src'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
info: installing component 'rust-mingw'
info: installing component 'rust-std'
info: installing component 'rustc'
  9 IO-ops /   9 IO-ops (100 %)   2 IOPS in  4s
info: rolling back changes
error: could not rename component file from # snip!
# This repeats for literally every file in $RUSTUP_HOME/tmp downloaded for the current toolchain
# The final bit is interesting, note the ordering:
warn: could not delete temp directory: $RUSTUP_HOME\tmp\gkcvss83zmmb8r11_dir
error: could not rename component file
from '$RUSTUP_HOME\tmp\gkcvss83zmmb8r11_dir\rustc\lib\rustlib\x86_64-pc-windows-gnu\bin\rust-lld.exe'
to '$RUSTUP_HOME\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\bin\rust-lld.exe'

Subsequent failures happened in the form of a single rename failing instead, or the spurious:
error: failure removing component 'rustc-x86_64-pc-windows-gnu', directory does not exist: 'bin\rustc_driver-42db67a2a6008d5f.dll'

There was no IDE running, nothing else touching my Rust install, and just retrying it a couple times eventually leads to success, sort of:
stable-x86_64-pc-windows-gnu installed - (timeout reading rustc version)

edit: formatting fix to prevent sidescrolling

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

No branches or pull requests

8 participants