rustup update error

Created on 19 Dec 2017  路  28Comments  路  Source: rust-lang/rustup

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.

Most helpful comment

These are the tools you need to delete:

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

All 28 comments

I'm getting the same thing. Win 10, 64 bit.

Seeing this on Windows 7 x64 for cargo, cargo-fmt, rls, rustc, rustdoc, rustfmt, rust-gdb, and rust-lldb

I don't know if it is relevant but cargo is not finding cargo-fmt despite it being on my path.

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'

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.

Possibly related. Running rustup self update on Windows 10 64-bit in the git-for-windows bash shell. Past updates have worked successfully. No rustup executables exist in cargo/bin after the error messages below.

$ rustup self update
info: checking for self-updates
info: downloading self-update
info: rustup updated successfully to 1.8.0
error: could not copy file from 'C:\Users\mike\.local\share\cargo\bin\rustup-init.exe' to 'C:\Users\mike\.local\share\cargo\bin\rustup.exe'
info: caused by: Access is denied. (os error 5)

Downloading rustup-init.exe and running from a regular command prompt I get the following errors:

C:\Users\mike\Downloads>rustup-init.exe --no-modify-path
error: it looks like you have an existing installation of Rust at:
error: C:\Users\mike\.local\share\cargo\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

C:\Users\mike\Downloads>rustup-init.exe --no-modify-path -y
warning: tool `rustfmt` is already installed, remove it from `C:\Users\mike\.local\share\cargo\bin`, then run `rustup update` to have rustup manage this tool.
warning: tool `cargo-fmt` is already installed, remove it from `C:\Users\mike\.local\share\cargo\bin`, then run `rustup update` to have rustup manage this tool.
info: updating existing rustup installation

Running cargo uninstall rustfmt-nightly and allows rustup to install successfully but subsequent self updates fail:

C:\Users\mike\Downloads>rustup-init.exe --no-modify-path -y
info: updating existing rustup installation
C:\Users\mike\Downloads>rustup self update
info: checking for self-updates
error: could not create link from 'C:\Users\mike\.local\share\cargo\bin\rustup.exe' to 'C:\Users\mike\.local\share\cargo\bin\rustc.exe'

Yeah, I can confirm that rustup update does not work anymore. You need to delete all of the tools it mentions at the same time for it not to error out. It'll error out on the next update again though

These are the tools you need to delete:

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

Me too (also win 10 x64)

We're seeing the same failure across many AppVeyor builds, eg.

verbose: toolchain 'stable-i686-pc-windows-msvc' installed
info: default toolchain set to 'stable'
  stable installed - rustc 1.22.1 (05e2e1c41 2017-11-22)
set PATH=%PATH%;%USERPROFILE%\.cargo\bin
rustup update
info: syncing channel updates for 'stable-i686-pc-windows-msvc'
info: checking for self-updates
  stable-i686-pc-windows-msvc unchanged - rustc 1.22.1 (05e2e1c41 2017-11-22)
error: could not create link from 'C:\Users\appveyor\.cargo\bin\rustup.exe' to 'C:\Users\appveyor\.cargo\bin\rustc.exe'

https://ci.appveyor.com/project/r8d8/emerald-rs-wimdr/build/1.0.234/job/8uxp8lp6gsgnqi11

Any solves or workarounds would be very welcome -- this is a blocking issue for many of our projects.

Confirm.
I have this problem in Windows 7 x64.

Confirm,
I have this problem in Windows 10 x64

I do have the same issue too.
Win 10 x64

Same issue

Same here Win10 x64 (17063):

位 rustup update
info: syncing channel updates for 'beta-x86_64-pc-windows-msvc'
info: syncing channel updates for 'nightly-x86_64-pc-windows-msvc'
info: checking for self-updates

     beta-x86_64-pc-windows-msvc unchanged - rustc 1.23.0-beta.2 (c9107ee93 2017-12-08)
  nightly-x86_64-pc-windows-msvc unchanged - rustc 1.24.0-nightly (c284f8807 2017-12-24)

warning: tool `rustfmt` is already installed, remove it from `C:\Users\scott\.cargo\bin`, then run `rustup update` to have rustup manage this tool.
warning: tool `cargo-fmt` is already installed, remove it from `C:\Users\scott\.cargo\bin`, then run `rustup update` to have rustup manage this tool.

Removed 'rustfmt' and 'cargo-fmt' as indicated, then:

位 rustup update
info: syncing channel updates for 'beta-x86_64-pc-windows-msvc'
info: syncing channel updates for 'nightly-x86_64-pc-windows-msvc'
info: checking for self-updates

     beta-x86_64-pc-windows-msvc unchanged - rustc 1.23.0-beta.2 (c9107ee93 2017-12-08)
  nightly-x86_64-pc-windows-msvc unchanged - rustc 1.24.0-nightly (c284f8807 2017-12-24)

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

Confirm, Windows 10 x64, and given the stack trace

   rustup self update
info: checking for self-updates
error: could not create link from 'C:\Users\hcyue\.cargo\bin\rustup.exe' to 'C:\Users\hcyue\.cargo\bin\rustc.exe'

info: backtrace:

stack backtrace:
   0:   0x634c34 - <no info>
   1:   0x5919db - <no info>
   2:   0x591a66 - <no info>
   3:   0x57026e - <no info>
   4:   0x56ff51 - <no info>
   5:   0x42eec9 - <no info>
   6:   0x420ae3 - <no info>
   7:   0x439330 - <no info>
   8:   0x438aa5 - <no info>
   9:   0x9190fb - <no info>
  10:   0x9164ca - <no info>
  11:   0x43d72c - <no info>
  12:   0x4013e3 - <no info>
  13: 0x743a8654 - BaseThreadInitThunk
  14: 0x76fa4a47 - RtlGetAppContainerNamedObjectPath

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

I think there are some changes about how Windows handle the path and link, you may reference URLs below:

[Stable] ICE on Windows 7 when compiling dependencies 路 Issue #45067
https://github.com/rust-lang/rust/issues/45067

Naming Files, Paths, and Namespaces (Windows)
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx

How to Make Windows 10 Accept File Paths Over 260 Characters
https://www.howtogeek.com/266621/how-to-make-windows-10-accept-file-paths-over-260-characters/

CreateHardLink function (Windows)
https://msdn.microsoft.com/zh-tw/library/windows/desktop/aa363860(v=vs.85).aspx

Workaround for >1023 hard links on Windows platforms
https://github.com/jbruchon/jdupes/commit/7cbdebfdea689e47275b6e8f32844d76ccbc3718

I am also getting this. Windows 10, 64 bit.
Also happens when:

  • fully uninstalling rust and installing plain vanilla stable
  • fully uninstalling rust and installing nightly without installing anything else
    Is there a fix in sight?

I began receiving this error after adding the rls-preview component. Not sure if that is related however.

nightly-x86_64-pc-windows-msvc unchanged - rustc 1.24.0-nightly (2dad872a2 2017-12-29)
Windows 10 Pro Insider Preview 64-bit (10.0, Build 17063) (17063.rs_prerelease.171213-1610)

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.

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.cargobinrustup.exe' to 'C:\Users\user.cargobin\rustc.exe'

Same^^^

I still get error: could not create link from 'C:\Users\USERNAME\.cargo\bin\rustup.exe' to 'C:\Users\USERNAME\.cargo\bin\rustc.exe'

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

Having this issue. Was on a pretty old version of rustup and updated recently. GOt the warnings about rustfmt and cargo-fmt, complied, and suffered.

The error:

PS C:\Users\me> rustfmt
error: toolchain 'stable-x86_64-pc-windows-msvc' does not have the binary `rustfmt.exe`

Attempt to solve:

PS C:\Users\me> rustup component add rustfmt
error: toolchain 'stable-x86_64-pc-windows-msvc' does not contain component 'rustfmt' for target 'x86_64-pc-windows-msvc'

Version:

PS C:\Users\me> rustup --version
rustup 1.11.0 (e751ff9f8 2018-02-13)

@hherman1 Perhaps you commented on the wrong issue. Anyway you're trying to add a component named rustfmt that does not exist, thus the error. The component you're looking for is named rustfmt-preview and you can see from rustup component list

I just got the same error updating to 1.30.

PS C:\Users\me> rustup update
info: syncing channel updates for 'stable-x86_64-pc-windows-gnu'
info: latest update on 2018-10-25, rust version 1.30.0 (da5f414c2 2018-10-24)
info: downloading component 'rustc'
 76.7 MiB /  76.7 MiB (100 %)  23.4 MiB/s ETA:   0 s
info: downloading component 'rust-std'
 51.7 MiB /  51.7 MiB (100 %)   8.4 MiB/s ETA:   0 s
info: downloading component 'cargo'
  4.5 MiB /   4.5 MiB (100 %) 910.8 KiB/s ETA:   0 s
info: downloading component 'rust-docs'
info: downloading component 'rust-mingw'
info: removing component 'rustc'
info: removing component 'rust-std'
info: removing component 'cargo'
info: removing component 'rust-docs'
info: removing component 'rust-mingw'
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'cargo'
info: installing component 'rust-docs'
info: installing component 'rust-mingw'
info: syncing channel updates for 'beta-x86_64-pc-windows-gnu'
info: checking for self-updates
info: downloading self-update

  stable-x86_64-pc-windows-gnu updated - rustc 1.30.0 (da5f414c2 2018-10-24)
  beta-x86_64-pc-windows-gnu unchanged - rustc 1.30.0-beta.17 (f33946f81 2018-10-23)

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

Also after trying rustup self update if it matters (just in case since I saw people using this command in this thread).

PS C:\Users\me> rustup self update
info: checking for self-updates
info: downloading self-update
info: rustup updated successfully to 1.14.0
PS C:\Users\me> error: could not remove 'rustup-bin' file: 'C:\Users\me\.cargo\bin\rustup.exe'
info: caused by: Access is denied. (os error 5)
PS C:\Users\me> rustup --version
rustup 1.12.0 (573895abc 2018-07-07)

Since the issue was closed about 1 year ago tell me if you prefer that I open a new one.

Was this page helpful?
0 / 5 - 0 ratings