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 is from VS Code. Trying it in the Ubuntu application results in the same errors.
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.
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
It seems that adding sudo to the start of the command does the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With