rustup update fails because of missing directory

Created on 15 Jun 2017  路  7Comments  路  Source: rust-lang/rustup

Same issue as: https://github.com/rust-lang-nursery/rustup.rs/issues/938

$ rustup update stable
info: syncing channel updates for 'stable-x86_64-apple-darwin'
info: downloading component 'rustc'
37.8 MiB / 37.8 MiB (100 %) 10.2 MiB/s ETA: 0 s
info: downloading component 'rust-std'
53.8 MiB / 53.8 MiB (100 %) 10.2 MiB/s ETA: 0 s
info: downloading component 'cargo'
3.6 MiB / 3.6 MiB (100 %) 799.6 KiB/s ETA: 0 s
info: downloading component 'rust-docs'
11.4 MiB / 11.4 MiB (100 %) 11.1 MiB/s ETA: 0 s
info: downloading component 'rust-src'
31.9 MiB / 31.9 MiB (100 %) 10.5 MiB/s ETA: 0 s
info: rolling back changes
error: failure removing component 'rust-src', directory does not exist: '"lib/rustlib/src/rust/src/llvm/test/tools/llvm-objdump/X86/Inputs/internal.exe.coff-x86_64"'

Most helpful comment

Well... after I removed my toolchains manually with:

$ rm -frv ~/.rustup/toolchains/*
$ rustup show
# ... downloaded some stuff

and then it worked.

This is what I think that happened:
I think something went wrong during the download of the initial toolchains. Then, rustup update got confused because some files were missing during removal of components (should it be?). After a cleanup on the toolchains directory, rustup fresh installed it all again and it worked fine.

Does rustup do integrity check after the download/installation of the toolchains already? If it does, then the corruption occured after that.

Anyway, wouldn't it be better to differentiate which error occurred during component removal? It's ok to abort the proccess when a permission error happens, but if it was an ErrorKind::ComponentMissingFile or ErrorKind::ComponentMissingDir error, I think the component removal shouln't be affected because of that).

https://github.com/rust-lang-nursery/rustup.rs/blob/master/src/rustup-dist/src/component/components.rs - at "// Remove parts" on lines 277

All 7 comments

$ rustc --version
rustc 1.17.0-nightly (b1e31766d 2017-03-03)

Same issue here:

$ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
270.6 KiB / 270.6 KiB (100 %) 101.8 KiB/s ETA:   0 s                
info: latest update on 2018-02-19, rust version 1.25.0-nightly (27a046e93 2018-02-18)
info: downloading component 'rustc'
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: downloading component 'rls-preview'
info: downloading component 'rust-src'
info: downloading component 'rust-analysis'
info: removing component 'rustc'
info: rolling back changes
error: failure removing component 'rustc-x86_64-unknown-linux-gnu', directory does not exist: '"share/doc/rust/COPYRIGHT"'
info: checking for self-updates

       stable-x86_64-unknown-linux-gnu unchanged - rustc 1.24.0 (4d90ac38c 2018-02-12)
  nightly-x86_64-unknown-linux-gnu update failed - rustc 1.23.0-nightly (d0f8e2913 2017-11-16)

BTW, "share/doc/rust/COPYRIGHT" is a missing file in the toolchain, not a directory...

$ rustup show
Default host: x86_64-unknown-linux-gnu

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)

active toolchain
----------------

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.23.0-nightly (d0f8e2913 2017-11-16)
$ rustup --version
rustup 1.11.0 (e751ff9f8 2018-02-13)

I'm curious here... why the removal of a component fails because the absence of a directory (and in this specific case, a doc/copyright one)? Isn't it safe to just warn (if it is not expected) and keep going?

Well... after I removed my toolchains manually with:

$ rm -frv ~/.rustup/toolchains/*
$ rustup show
# ... downloaded some stuff

and then it worked.

This is what I think that happened:
I think something went wrong during the download of the initial toolchains. Then, rustup update got confused because some files were missing during removal of components (should it be?). After a cleanup on the toolchains directory, rustup fresh installed it all again and it worked fine.

Does rustup do integrity check after the download/installation of the toolchains already? If it does, then the corruption occured after that.

Anyway, wouldn't it be better to differentiate which error occurred during component removal? It's ok to abort the proccess when a permission error happens, but if it was an ErrorKind::ComponentMissingFile or ErrorKind::ComponentMissingDir error, I think the component removal shouln't be affected because of that).

https://github.com/rust-lang-nursery/rustup.rs/blob/master/src/rustup-dist/src/component/components.rs - at "// Remove parts" on lines 277

Same issue:

rustup update stable
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2018-03-01, rust version 1.24.1 (d3ae9a9e0 2018-02-27)
info: downloading component 'rustc'
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: downloading component 'rust-std' for 'armv7-unknown-linux-gnueabihf'
info: downloading component 'rust-std' for 'arm-unknown-linux-gnueabihf'
info: removing component 'rustc'
info: rolling back changes
error: failure removing component 'rustc-x86_64-unknown-linux-gnu', directory does not exist: '"share/man/man1/rustdoc.1"'

I've deleted ~/.rustup/toolchains/* and now it works.

Probably belongs here, worked after I did what @danielpclark said above on Arch Linux.

> error: failure removing component 'rustc-x86_64-unknown-linux-gnu', directory does not exist: '"share/doc/rust/COPYRIGHT"'

Similar problems when trying to update. error: failure removing component 'rust-std-x86_64-apple-darwin', directory does not exist: '"lib/rustlib/x86_64-apple-darwin/lib/liblog-34f173aa5845f490.rlib"' using rustc 1.25.0 (84203cac6 2018-03-25)

Closed in favour of #1480, please comment there if you have further information.

Was this page helpful?
0 / 5 - 0 ratings