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 update error #1316

Closed
Eh2406 opened this issue Dec 19, 2017 · 28 comments · Fixed by ethereumproject/go-ethereum#455
Closed

rustup update error #1316

Eh2406 opened this issue Dec 19, 2017 · 28 comments · Fixed by ethereumproject/go-ethereum#455

Comments

@Eh2406
Copy link

Eh2406 commented Dec 19, 2017

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.

@Antelope13
Copy link

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

@kjeremy
Copy link

kjeremy commented Dec 19, 2017

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

@Eh2406
Copy link
Author

Eh2406 commented Dec 19, 2017

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

@BrianLee608
Copy link

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'

@systemtrap
Copy link

systemtrap commented Dec 20, 2017

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 cb2d148.

@iliekturtles
Copy link

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'

@CryZe
Copy link

CryZe commented Dec 22, 2017

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

@CryZe
Copy link

CryZe commented Dec 22, 2017

These are the tools you need to delete:

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

@petertiedemann
Copy link

Me too (also win 10 x64)

@whilei
Copy link

whilei commented Dec 22, 2017

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.

@DustinByfuglien
Copy link

Confirm.
I have this problem in Windows 7 x64.

@nonsensecreativity
Copy link

Confirm,
I have this problem in Windows 10 x64

@workingj
Copy link

I do have the same issue too.
Win 10 x64

@gagarin55
Copy link

Same issue

@sc0ttwad3
Copy link

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'

whilei added a commit to ethereumproject/go-ethereum that referenced this issue Dec 27, 2017
@nameoverflow
Copy link

nameoverflow commented Dec 27, 2017

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

@matklad
Copy link
Member

matklad commented Dec 27, 2017

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

@perfectcream
Copy link

perfectcream commented Dec 28, 2017

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
rust-lang/rust#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

@mirandadam
Copy link

mirandadam commented Dec 29, 2017

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?

@SProst
Copy link

SProst commented Dec 30, 2017

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)

@kankri
Copy link

kankri commented Dec 30, 2017

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.

@b5n
Copy link

b5n commented Jan 3, 2018

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'

@Sufuninja
Copy link

Same^^^

alexcrichton added a commit to alexcrichton/rustup.rs that referenced this issue Jan 3, 2018
The previous logic had some subtle bugs for a number of reasons, and hopefully
this iteration irons them out.

Closes rust-lang#1316
bors added a commit that referenced this issue Jan 3, 2018
Fix self update errors filling in missing proxies

The previous logic had some subtle bugs for a number of reasons, and hopefully
this iteration irons them out.

Closes #1316
alexcrichton added a commit to alexcrichton/rustup.rs that referenced this issue Jan 4, 2018
The previous logic had some subtle bugs for a number of reasons, and hopefully
this iteration irons them out.

Closes rust-lang#1316
alexcrichton added a commit to alexcrichton/rustup.rs that referenced this issue Jan 4, 2018
The previous logic had some subtle bugs for a number of reasons, and hopefully
this iteration irons them out.

Closes rust-lang#1316
alexcrichton added a commit to alexcrichton/rustup.rs that referenced this issue Jan 4, 2018
The previous logic had some subtle bugs for a number of reasons, and hopefully
this iteration irons them out.

Closes rust-lang#1316
alexcrichton added a commit to alexcrichton/rustup.rs that referenced this issue Jan 4, 2018
The previous logic had some subtle bugs for a number of reasons, and hopefully
this iteration irons them out.

Closes rust-lang#1316
alexcrichton added a commit to alexcrichton/rustup.rs that referenced this issue Jan 4, 2018
The previous logic had some subtle bugs for a number of reasons, and hopefully
this iteration irons them out.

Closes rust-lang#1316
alexcrichton added a commit to alexcrichton/rustup.rs that referenced this issue Jan 4, 2018
The previous logic had some subtle bugs for a number of reasons, and hopefully
this iteration irons them out.

Closes rust-lang#1316
alexcrichton added a commit to alexcrichton/rustup.rs that referenced this issue Jan 4, 2018
The previous logic had some subtle bugs for a number of reasons, and hopefully
this iteration irons them out.

Closes rust-lang#1316
alexcrichton added a commit to alexcrichton/rustup.rs that referenced this issue Jan 4, 2018
The previous logic had some subtle bugs for a number of reasons, and hopefully
this iteration irons them out.

Closes rust-lang#1316
alexcrichton added a commit to alexcrichton/rustup.rs that referenced this issue Jan 4, 2018
The previous logic had some subtle bugs for a number of reasons, and hopefully
this iteration irons them out.

Closes rust-lang#1316
alexcrichton added a commit to alexcrichton/rustup.rs that referenced this issue Jan 4, 2018
The previous logic had some subtle bugs for a number of reasons, and hopefully
this iteration irons them out.

Closes rust-lang#1316
alexcrichton added a commit to alexcrichton/rustup.rs that referenced this issue Jan 4, 2018
The previous logic had some subtle bugs for a number of reasons, and hopefully
this iteration irons them out.

Closes rust-lang#1316
alexcrichton added a commit to alexcrichton/rustup.rs that referenced this issue Jan 4, 2018
The previous logic had some subtle bugs for a number of reasons, and hopefully
this iteration irons them out.

Closes rust-lang#1316
bors added a commit that referenced this issue Jan 4, 2018
Fix self update errors filling in missing proxies

The previous logic had some subtle bugs for a number of reasons, and hopefully
this iteration irons them out.

Closes #1316
@bors bors closed this as completed in #1326 Jan 4, 2018
@Yanpas
Copy link

Yanpas commented Jan 4, 2018

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

@alexcrichton
Copy link
Member

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

@hherman1
Copy link

hherman1 commented Mar 7, 2018

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)

@Arnavion
Copy link

Arnavion commented Mar 7, 2018

@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

mattico pushed a commit to mattico/rustup.rs that referenced this issue Apr 5, 2018
The previous logic had some subtle bugs for a number of reasons, and hopefully
this iteration irons them out.

Closes rust-lang#1316
@Zykino
Copy link

Zykino commented Oct 26, 2018

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.

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

Successfully merging a pull request may close this issue.