5
votes

I'm trying to install Rust on the Windows Subsystem for Linux (WSL) by running the following command which is provided officially here:

curl https://sh.rustup.rs -sSf | sh

I've installed Ubuntu from the Microsoft Store.

The problem is that the fails with 5 similar errors:

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"'

Screenshot of the installation process

Screenshot is from VS Code. Trying it in the Ubuntu application results in the same errors.

5
try strace and see what syscall failsthe8472
Please don't post your code as an image. I down voted because the same principle applies as Image of terminal outputStargateur
@Stargateur I did it because it was lengthy. I included the more important parts of the output as text in the question though/thesdev
the is no problem, question can have a lot of character in it. Image can't be copied, mobile user and low connection user will prefer download 5ko than an image of 5MoStargateur
@the8472 I'm not sure which part I should post but here is the last part of the output: ![wsl-error.png](postimg.cc/hJDpCq2j)thesdev

5 Answers

5
votes

Apparently, you need to close Visual Studio Code and run the command directly at the WSL prompt. The underlying issue is among the most-encountered WSL bugs:

I wouldn't be surprised if virus scanners could trigger this as well, not just Visual Studio Code.

1
votes

It seems that adding sudo to the start of the command does the trick.

1
votes

After several failed installations with the same error, I had to nuke my .rustup directory. I then ran the Rust installer with sudo. I recommend also temporarily turning off your antivirus protection, as that seems to cause issues.

The entire sequence of commands:

$ sudo rm -rf ./home/<your_username>/.rustup
$ curl 'https://sh.rustup.rs' -sSf > rustinstall.sh
$ sudo ./rustinstall.sh -y
1
votes

Potential solution - disable your real-time antivirus protection during install

I had a very similar issue:

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)

I read this thread - Installing rust-docs component on Windows 10 is very slow about an issue with the unpacking of the documentation on windows. They mention the anti-virus contributes to issues with speed.

I turned off my anti-virus real-time protection and ran the install script again, this time with no issues.

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!

0
votes

For anyone on WSL 2 try this:

export RUSTUP_IO_THREADS=1
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh