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

fresh install fails on Windows: "error: could not rename component file from '... \rust-docs\share/doc/rust/html' ..." #1912

Open
s-n-ushakov opened this issue Jun 25, 2019 · 20 comments

Comments

@s-n-ushakov
Copy link

commented Jun 25, 2019

Problem
A fresh install of stable build fails on Windows 8.1 with message "error: could not rename component file from '... \rust-docs\share/doc/rust/html' ...".
Expected behavior would be the install to be successful :)

Steps

  1. Check Windows version is 8.1 (not checked for other versions)
  2. Ensure %USERPROFILE%\.rustup and %USERPROFILE%\.cargo folders do not exist
  3. Download the latest stable rustup-init.exe file (1.35.0 of 2019-05-23) and run it under normal (non-admin) user without elevating user rights.
  4. Respond with "1" to the question regarding "Current installation options"
  5. Wait until the install fails with message "error: could not rename component file from '... \rust-docs\share/doc/rust/html' ..."
C:\Users\ushakov\Documents\-work\Downloads\www.rust-lang.org>rustup-init.exe

Welcome to Rust!

This will download and install the official compiler for the Rust programming
language, and its package manager, Cargo.

It will add the cargo, rustc, rustup and other commands to Cargo's bin
directory, located at:

  C:\Users\ushakov\.cargo\bin

This path will then be added to your PATH environment variable by modifying the
HKEY_CURRENT_USER/Environment/PATH registry key.

You can uninstall at any time with rustup self uninstall and these changes will
be reverted.

Current installation options:

   default host triple: x86_64-pc-windows-msvc
     default toolchain: stable
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1

info: syncing channel updates for 'stable-x86_64-pc-windows-msvc'
info: latest update on 2019-05-23, rust version 1.35.0 (3c235d560 2019-05-20)
info: downloading component 'rustc'
 60.0 MiB /  60.0 MiB (100 %)   8.0 MiB/s in  9s ETA:  0s
info: downloading component 'rust-std'
 53.1 MiB /  53.1 MiB (100 %)   8.3 MiB/s in  7s ETA:  0s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
 10.3 MiB /  10.3 MiB (100 %)   9.3 MiB/s in  1s ETA:  0s
info: installing component 'rustc'
 60.0 MiB /  60.0 MiB (100 %)   7.7 MiB/s in  8s ETA:  0s
info: installing component 'rust-std'
 53.1 MiB /  53.1 MiB (100 %)   7.3 MiB/s in 15s ETA:  0s
info: installing component 'cargo'
  2.9 MiB /   2.9 MiB (100 %)   2.1 MiB/s in  6s ETA:  0s
info: installing component 'rust-docs'
 10.3 MiB /  10.3 MiB (100 %) 473.6 KiB/s in  1m 35s ETA:  0s
info: rolling back changes
error: could not rename component file from 'C:\Users\ushakov\.rustup\tmp\grl2pj2s61kwqrko_dir\rust-docs\share/doc/rust/html' to 'C:\Users\ushakov\.rustup\toolchains\stable-x86_64-pc-windows-msvc\share/doc/rust/html'
info: caused by: Отказано в доступе. (os error 5)

Press the Enter key to continue.

Possible Solution(s)
A possible temporary workaround may be to run the installer with admin privileges, as per https://stackoverflow.com/questions/52542965/rust-installation-fails-on-windows-subsystem-for-linux-could-not-rename-compone/55373522#55373522 , that proved to work for me.

Notes

Output of rustup --version:
rustup 1.18.3 (435397f48 2019-05-22)

Output of rustup show:

Default host: x86_64-pc-windows-msvc

stable-x86_64-pc-windows-msvc (default)
rustc 1.35.0 (3c235d560 2019-05-20)
@rbtcollins

This comment has been minimized.

Copy link
Collaborator

commented Jun 25, 2019

Thank you for generating this report. It does look to me like a probable anti-virus problem.

You mentioned in 1723 that you have procmon traces - have a look in that at the time of the error, are there any other processes with handles open anywhere in that subdirectory? I'm happy to look through if you can upload the PML (as a zip/tar) to s3 or seed it as a torrent or some such...

@s-n-ushakov

This comment has been minimized.

Copy link
Author

commented Jun 26, 2019

@rbtcollins I have placed the zipped PML log (11M) here: http://www.usn.pp.ru/tmp/rustup-init--procmon.2019-06-24.zip . Unfortunately could not find anything suspicious so far... Please let me know whether the log is good when your time allows...

@rbtcollins

This comment has been minimized.

Copy link
Collaborator

commented Jun 26, 2019

The log doesn't have enough info in it (or its not what I think it is, or Defender's implementation has changed radically from Windows 8 to 10).

So this is the event that fails:

5:03:57.3318549 PM	0.0137171	rustup-init.exe	12352	22804	SetRenameInformationFile	C:\Users\ushakov\.rustup\tmp\grl2pj2s61kwqrko_dir\rust-docs\share\doc\rust\html	ACCESS DENIED	ReplaceIfExists: True, FileName: C:\Users\ushakov\.rustup\toolchains\stable-x86_64-pc-windows-msvc\share\doc\rust\html

But there are no events in the trace from other processes than rustup-init.exe - I suspect you've got a filter on the process name.

Check that you aren't filtering for just rustup-init.exe in the filter dialog when you make the trace - something like "Path contains .rustup" would be a good filter - the default filters to exclude procmon.exe itself and so on are fine, but we do want to see activity from other processes within this directory structure.

After you've done the trace and saved the file, you can then edit the filter and add filter to exclude events from rustup-init.exe - I'd expect that then you'd see defender or whatever is causing the issue operating on those files.

I would find the event in the first place by adding a filter on result for 'ACCESS DENIED'
image and then using the microsecond timestamp to find the event in context when that filter is disabled (or clicking on the event, then removing the filter may keep you on it - the UI can be a bit flaky though so...).

@s-n-ushakov

This comment has been minimized.

Copy link
Author

commented Jun 27, 2019

@rbtcollins I have finally managed to guess the time values to filter out all the events withing 2 sec timeframe around the failure event :) :

image

All the excludes are the standard ones suggested by procmon, except the one of mine that restricts the time.

Please find the resulting zipped PML log (0.5M) here: http://www.usn.pp.ru/tmp/rustup-init--procmon.2019-06-24--two-seconds-around.zip

@rbtcollins

This comment has been minimized.

Copy link
Collaborator

commented Jun 27, 2019

Ok so thats super interesting, - definitely other processses in the trace, but none operating on .rustup files.

I suspect we need to get into kernel tracing at this point - ETW / WPR https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-8.1-and-8/hh448205(v=win.10) - - basically looking for the cause of the access denied.

Before doing that, please try building and running master - there's some unpacking IO changes that might make this better - or worse - and would allow me to make the following statement:

We make that dir with the same code for both the binaries and docs, so either both should succeed or both should fail, which is why the third-party-process holding a handle open is the most likely scenario.

@s-n-ushakov

This comment has been minimized.

Copy link
Author

commented Jun 28, 2019

@rbtcollins Ok, I'll see if I succeed with building the master on the weekend. Meanwhile could you describe your ideas on further troubleshooting in some more detail? What the next steps may look like, and how to proceed?

@rbtcollins

This comment has been minimized.

Copy link
Collaborator

commented Jun 28, 2019

@s-n-ushakov basically we're at the edge of my ready-to-use knowledge, so I'm going to be vague. But something like: enable kernel event tracing on all file operations, run the failing scenario, disable event tracing, look through the trace which hopefully will have much more detail than procmon, because it wires into the kernel itself rather than purely userspace.

@EugeneChung

This comment has been minimized.

Copy link

commented Jul 5, 2019

I tried to install rust by chocolatey and got the similar error.

...\rust-docs\share\doc\rust\html' is denied.

After I turned off my vaccine program, it was successful.

@mpoullet

This comment has been minimized.

Copy link

commented Jul 7, 2019

I have the same issue here with the Avira anti-virus. Turning off the "Real-Time Protection" before running rustup-init.exe makes it work.

@ctaggart

This comment has been minimized.

Copy link

commented Jul 12, 2019

This failed about 5 times for me and then I found this thread. It worked after I deselected the box in the McAfee Access Protection Properties to "Prevent McAfee services from being stopped" and then stopped the `McAfee McShield" service. It is also known as the "McAfee On-Access Scanner service".

This was the error:

info: installing component 'rust-docs'
 11.3 MiB /  11.3 MiB (100 %) 355.2 KiB/s in  1m 28s ETA:  0s
info: rolling back changes
error: could not rename component file from 'C:\Users\taggac\.rustup\tmp\l2_bwq4ke00qaw9i_dir\rust-docs\share/doc/rust/html' to 'C:\Users\taggac\.rustup\toolchains\beta-x86_64-pc-windows-gnu\share/doc/rust/html'
info: caused by: Access is denied. (os error 5)

image

@s-n-ushakov

This comment has been minimized.

Copy link
Author

commented Aug 1, 2019

@rbtcollins I have to confess that I failed to do the ETW / WPR exercise so far, as my HDD with Windows died. Sorry... Now I am busy with gradual migration to Ubuntu, so it is not very much likely that I will be able to add more to this investigation, at least in the near future. But it is good to know that numerous colleagues here are reporting their observations of problem correlation with antivirus software...

@13webstreet

This comment has been minimized.

Copy link

commented Aug 12, 2019

Hi.
I confirm the same as the above. After turning off Avira antivirus it worked.

@kwaegel

This comment has been minimized.

Copy link

commented Aug 15, 2019

Same. Turning off the McAfee On-Access Scanner fixed the Access is denied. (os error 5) message.

@kinnison

This comment has been minimized.

Copy link
Collaborator

commented Aug 20, 2019

Badly behaved scan-on-write virus scanners are becoming a great pain to me. I wonder if there's any way we can detect and mitigate this.

@pitaj

This comment has been minimized.

Copy link

commented Aug 21, 2019

If I could disable my anti-virus temporarily I'm sure it would fix this issue. However, at work I am unable to disable the anti-virus program. This makes it impossible for me to use rustup update.

Is it possible to make it so rustup won't give up after the very first attempt at moving? Or give us an option to, instead of moving the files, try copying to destination and deleting from source instead?

@pitaj

This comment has been minimized.

Copy link

commented Aug 21, 2019

Update: this was fixed for me by building from latest master (d62e504)

I think this issue is actually fixed by the same fix for #1870

@kinnison

This comment has been minimized.

Copy link
Collaborator

commented Aug 22, 2019

Handy to know, thanks @pitaj -- I hope to get a release done soonish that will therefore solve this a bit.

@refaelsh

This comment has been minimized.

Copy link

commented Aug 23, 2019

I have the same problem. Corporate laptop with McAfee that can not be turn off. I need this release in order to start learning rust. Please hurry :-)

@refaelsh

This comment has been minimized.

Copy link

commented Aug 23, 2019

@pitaj Can you please share the binary you've build from the latest master? I cant install rust because of this issue and I cant build the latest master because I don't have rust.

@refaelsh

This comment has been minimized.

Copy link

commented Aug 23, 2019

Found a way: downloaded the latest master directly from the CI/CD server: here. I can now start learning rust :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
10 participants
You can’t perform that action at this time.