Linux 的 Windows 子系统上的 Rust 安装失败:无法重命名组件文件
Rust installation fails on Windows Subsystem for Linux: could not rename component file
我正在尝试通过 运行 here 官方提供的以下命令在 Windows 子系统上为 Linux (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 应用程序中尝试它会导致相同的错误。
显然,您需要直接在 WSL 提示符下关闭 Visual Studio 代码和 运行 命令。潜在问题是最常遇到的 WSL 错误之一:
- npm package fails to install "npm ERR! Error: EACCES: permission denied"
- Unable to save file when inotify is in use (using Node)
- EACCES when renaming folder that is being watched from nodejs
如果病毒扫描程序也可以触发此操作,而不仅仅是 Visual Studio 代码,我不会感到惊讶。
似乎在命令的开头添加 sudo 就可以解决问题。
在多次安装失败并出现相同错误后,我不得不核对 .rustup
目录。然后我 运行 使用 sudo 的 Rust 安装程序。我还建议暂时关闭您的防病毒保护,因为这似乎会导致问题。
整个命令序列:
$ sudo rm -rf ./home/<your_username>/.rustup
$ curl 'https://sh.rustup.rs' -sSf > rustinstall.sh
$ sudo ./rustinstall.sh -y
可能的解决方案 - 在安装期间禁用 real-time 防病毒保护
我有一个非常相似的问题:
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: 0s
info: downloading component 'rust-std'
61.3 MiB / 61.3 MiB (100 %) 269.1 KiB/s in 6m 2s ETA: 0s
info: downloading component 'cargo'
4.6 MiB / 4.6 MiB (100 %) 499.2 KiB/s in 10s ETA: 0s
info: downloading component 'rust-docs'
11.0 MiB / 11.0 MiB (100 %) 128.8 KiB/s in 1m 24s ETA: 0s
info: installing component 'rustc'
91.1 MiB / 91.1 MiB (100 %) 8.7 MiB/s in 9s ETA: 0s
info: installing component 'rust-std'
61.3 MiB / 61.3 MiB (100 %) 11.4 MiB/s in 5s ETA: 0s
info: installing component 'cargo'
info: installing component 'rust-docs'
11.0 MiB / 11.0 MiB (100 %) 537.6 KiB/s in 44s ETA: 0s
info: 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)
我在 this thread - Installing rust-docs component on Windows 10 is very slow 上读到关于 windows 文档解包的问题。他们提到 anti-virus 会导致速度问题。
我关闭了 anti-virus real-time 保护并再次 运行 安装脚本,这次没有问题。
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: 0s
info: installing component 'rust-std'
61.3 MiB / 61.3 MiB (100 %) 12.2 MiB/s in 5s ETA: 0s
info: installing component 'cargo'
info: installing component 'rust-docs'
11.0 MiB / 11.0 MiB (100 %) 299.2 KiB/s in 27s ETA: 0s
info: default toolchain set to 'stable'
stable installed - rustc 1.36.0 (a53f9df32 2019-07-03)
Rust is installed now. Great!
WSL 2 的任何人都可以试试这个:
export RUSTUP_IO_THREADS=1
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
我正在尝试通过 运行 here 官方提供的以下命令在 Windows 子系统上为 Linux (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 应用程序中尝试它会导致相同的错误。
显然,您需要直接在 WSL 提示符下关闭 Visual Studio 代码和 运行 命令。潜在问题是最常遇到的 WSL 错误之一:
- npm package fails to install "npm ERR! Error: EACCES: permission denied"
- Unable to save file when inotify is in use (using Node)
- EACCES when renaming folder that is being watched from nodejs
如果病毒扫描程序也可以触发此操作,而不仅仅是 Visual Studio 代码,我不会感到惊讶。
似乎在命令的开头添加 sudo 就可以解决问题。
在多次安装失败并出现相同错误后,我不得不核对 .rustup
目录。然后我 运行 使用 sudo 的 Rust 安装程序。我还建议暂时关闭您的防病毒保护,因为这似乎会导致问题。
整个命令序列:
$ sudo rm -rf ./home/<your_username>/.rustup
$ curl 'https://sh.rustup.rs' -sSf > rustinstall.sh
$ sudo ./rustinstall.sh -y
可能的解决方案 - 在安装期间禁用 real-time 防病毒保护
我有一个非常相似的问题:
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: 0s
info: downloading component 'rust-std' 61.3 MiB / 61.3 MiB (100 %) 269.1 KiB/s in 6m 2s ETA: 0s
info: downloading component 'cargo' 4.6 MiB / 4.6 MiB (100 %) 499.2 KiB/s in 10s ETA: 0s
info: downloading component 'rust-docs' 11.0 MiB / 11.0 MiB (100 %) 128.8 KiB/s in 1m 24s ETA: 0s
info: installing component 'rustc' 91.1 MiB / 91.1 MiB (100 %) 8.7 MiB/s in 9s ETA: 0s
info: installing component 'rust-std' 61.3 MiB / 61.3 MiB (100 %) 11.4 MiB/s in 5s ETA: 0s
info: installing component 'cargo'
info: installing component 'rust-docs' 11.0 MiB / 11.0 MiB (100 %) 537.6 KiB/s in 44s ETA: 0s
info: 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)
我在 this thread - Installing rust-docs component on Windows 10 is very slow 上读到关于 windows 文档解包的问题。他们提到 anti-virus 会导致速度问题。
我关闭了 anti-virus real-time 保护并再次 运行 安装脚本,这次没有问题。
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: 0s
info: installing component 'rust-std' 61.3 MiB / 61.3 MiB (100 %) 12.2 MiB/s in 5s ETA: 0s
info: installing component 'cargo'
info: installing component 'rust-docs' 11.0 MiB / 11.0 MiB (100 %) 299.2 KiB/s in 27s ETA: 0s
info: default toolchain set to 'stable'
stable installed - rustc 1.36.0 (a53f9df32 2019-07-03)
Rust is installed now. Great!
WSL 2 的任何人都可以试试这个:
export RUSTUP_IO_THREADS=1
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh