Rust installation fails on Windows Subsystem for Linux: could not rename component file
我正在尝试通过运行以下官方提供的命令在Linux的Windows子系统(WSL)上安装Rust:
curl https://sh.rustup.rs -sSf | sh
我已经从Microsoft Store安装了Ubuntu。
问题是失败失败并出现5个类似错误:
error: could not rename component file from '/home/thesdev/.rustup/tmp/glf5z1z643ehld0x_dir/bk' to '/home/thesdev/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/share/man'
...
error: failed to install component: 'rust-docs-x86_64-unknown-linux-gnu', detected conflict: '"share/doc/rust/html"'
屏幕截图来自VS Code。 在Ubuntu应用程序中尝试它会导致相同的错误。
显然,您需要关闭Visual Studio Code并直接在WSL提示符下运行命令。潜在的问题是最常见的WSL错误:
- npm软件包无法安装" npm ERR!错误:EACCES:权限被拒绝"
- 使用inotify时无法保存文件(使用Node)
- 重命名从nodejs监视的文件夹时,EACCES
如果病毒扫描程序也可以触发此事件,而不仅仅是Visual Studio Code,我也不会感到惊讶。
潜在的解决方案-在安装过程中禁用实时防病毒保护
我有一个非常类似的问题:
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2019-07-04, rust version 1.36.0 (a53f9df32 2019-07-03)
info: downloading component 'rustc'
91.1 MiB / 91.1 MiB (100 %) 777.6 KiB/s in 1m 30s ETA: 0sinfo: downloading component 'rust-std'
61.3 MiB / 61.3 MiB (100 %) 269.1 KiB/s in 6m 2s ETA: 0sinfo: downloading component 'cargo'
4.6 MiB / 4.6 MiB (100 %) 499.2 KiB/s in 10s ETA: 0sinfo: downloading component 'rust-docs'
11.0 MiB / 11.0 MiB (100 %) 128.8 KiB/s in 1m 24s ETA: 0sinfo: installing component 'rustc'
91.1 MiB / 91.1 MiB (100 %) 8.7 MiB/s in 9s ETA: 0sinfo: installing component 'rust-std'
61.3 MiB / 61.3 MiB (100 %) 11.4 MiB/s in 5s ETA: 0sinfo: installing component 'cargo'
info: installing component 'rust-docs'
11.0 MiB / 11.0 MiB (100 %) 537.6 KiB/s in 44s ETA: 0sinfo: rolling back changes
error: could not rename component file from '/home/dg/.rustup/tmp/k_625bkits6oph6j_dir/rust-docs/share/doc/rust/html' to '/home/dg/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/share/doc/rust/html'info: caused by: Permission denied (os error 13)
我读了这个线程-在Windows 10上安装rust-docs组件非常慢,因为有关在Windows上解压缩文档的问题。他们提到反病毒会导致速度问题。
我关闭了防病毒实时保护,然后再次运行安装脚本,这次没有任何问题。
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2019-07-04, rust version 1.36.0 (a53f9df32 2019-07-03)
info: downloading component 'rustc'
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
91.1 MiB / 91.1 MiB (100 %) 9.1 MiB/s in 8s ETA: 0sinfo: installing component 'rust-std'
61.3 MiB / 61.3 MiB (100 %) 12.2 MiB/s in 5s ETA: 0sinfo: installing component 'cargo'
info: installing component 'rust-docs'
11.0 MiB / 11.0 MiB (100 %) 299.2 KiB/s in 27s ETA: 0sinfo: default toolchain set to 'stable'
stable installed - rustc 1.36.0 (a53f9df32 2019-07-03)
Rust is installed now. Great!
似乎在命令开头添加sudo可以解决问题。
在几次安装失败并出现相同的错误之后,我不得不核对
整个命令序列:
1 2 3 | $ sudo rm -rf ./home/<your_username>/.rustup $ curl 'https://sh.rustup.rs' -sSf > rustinstall.sh $ sudo ./rustinstall.sh -y |