rustup: rustup update error

I get this error today:

C:\rust_things>rustup -V
rustup 1.8.0 (cb2d14862 2017-12-17)
C:\rust_things>rustup self update
info: checking for self-updates
error: could not create link from 'C:\Users\finkelman\.cargo\bin\rustup.exe' to 'C:\Users\finkelman\.cargo\bin\rustc.exe'

Don’t know what it means just reporting.

Win 10, 64 bit.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 41
  • Comments: 28 (2 by maintainers)

Commits related to this issue

Most upvoted comments

These are the tools you need to delete:

https://i.imgur.com/o4TYpLJ.png

I ran into the same problem. In “raw.rs” the function hardlink tries to unlink the destinaton file but does not care about the io::Result. This call fails on my system. Any attempt to link the file fails due to an already existing file.

As far as I understand informations from MSDN right now hardlinks are not removeable when the the file is locked. It seems to be locked due to running rustup.exe.

Has the mechanisms for handling .cargo/bin changed recently? The Problem was introduced with #1310 and cb2d148622a2584839a0cb1e8f8926e5662f59b6.

Fresh install WIN10 Enterprise Version 1709 (OS Build 16299.125)

λ rustup -v update verbose: read metadata version: ‘12’ verbose: updating existing install for ‘stable-x86_64-pc-windows-msvc’ verbose: toolchain directory: ‘C:\Users\user.rustup\toolchains\stable-x86_64-pc-windows-msvc’ info: syncing channel updates for ‘stable-x86_64-pc-windows-msvc’ verbose: creating temp file: C:\Users\user.rustup\tmp\5fvcc3mwhxgy6hei_file verbose: downloading file from: ‘https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256’ verbose: downloading with curl verbose: deleted temp file: C:\Users\user.rustup\tmp\5fvcc3mwhxgy6hei_file verbose: toolchain is already up to date info: checking for self-updates

stable-x86_64-pc-windows-msvc unchanged - rustc 1.22.1 (05e2e1c41 2017-11-22)

error: could not create link from ‘C:\Users\user.cargo\bin\rustup.exe’ to ‘C:\Users\user.cargo\bin\rustc.exe’

I’m getting a similar error:

>rustup self update
info: checking for self-updates
info: downloading self-update
info: rustup updated successfully to 1.8.0

>error: could not remove 'rustup-bin' file: 'C:\Users\user\.cargo\bin\rustup.exe'
info: caused by: Access is denied. (os error 5)

I noticed that the last error messages appear after a new prompt, after rustup.exe has exited. This seems to indicate that the failing operation is done in a subprocess. Looking at Procmon output this is indeed the case:

rustup.exe self update
    "C:\Users\user\.cargo\bin/rustup-init.exe" --version
    "C:\Users\user\.cargo\bin/rustup-init.exe" --self-replace

That last last command is done after “rustup.exe” exits in self_update.rs:

#[cfg(windows)]
pub fn self_replace() -> Result<()> {
    try!(wait_for_parent());
    try!(install_bins());

    Ok(())
}

This code hasn’t been changed for a long time, so I don’t know why it started failing now for me, but I think there is a race condition: The executable file is not immediately accessible after the process has exited. (This presentation and the similarly named Youtube video give interesting facts about e.g. the asynchronous nature of file deletion in Windows: Racing the Filesystem by Niall Douglas.)

I would try to have a sleep/retry loop around install_bins() in that function.

Getting the same error:

C:\Users\Brian> rustup update
info: syncing channel updates for 'stable-x86_64-pc-windows-msvc'
info: syncing channel updates for 'nightly-x86_64-pc-windows-msvc'
info: latest update on 2017-12-20, rust version 1.24.0-nightly (b39c4bc12 2017-12-19)
info: downloading component 'rustc'
error: component download failed for rustc-x86_64-pc-windows-msvc
info: checking for self-updates

       stable-x86_64-pc-windows-msvc unchanged - rustc 1.22.1 (05e2e1c41 2017-11-22)
  nightly-x86_64-pc-windows-msvc update failed - rustc 1.24.0-nightly (77efd6800 2017-12-15)

error: could not create link from 'C:\Users\Brian\.cargo\bin\rustup.exe' to 'C:\Users\Brian\.cargo\bin\rustc.exe'

@Yanpas an updated version of rustup had not been released, it shoudl be fixed now.

To downgrade appveyor to older version, use

- appveyor DownloadFile https://static.rust-lang.org/rustup/archive/1.7.0/i686-pc-windows-gnu/rustup-init.exe -FileName rustup-init.exe