如何在权限被拒绝时进行 rustup 更新?
How to rustup update when permission is denied?
当我运行rustup update
时,我得到以下错误:
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
error: could not create temp file /home/abc/.rustup/tmp/mbbafo7rtfs5aazi_file
info: checking for self-updates
stable-x86_64-unknown-linux-gnu update failed - rustc 1.52.1 (9bc8c42bb 2021-05-09)
info: cleaning up downloads & tmp directories
thread 'main' panicked at 'Unable to clean up /home/abc/.rustup/downloads: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', src/utils/utils.rs:642:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
然后,我尝试 运行 sudo rustup update
并得到以下结果:
sudo: rustup: command not found
ls -l /home/abc/.rustup/
的输出是:
total 28
drwxr-xr-x 2 root root 4096 May 31 14:06 downloads
-rw-r--r-- 1 root root 102 May 31 14:06 settings.toml
drwxr-xr-x 2 root root 4096 May 31 14:06 tmp
drwxr-xr-x 3 root root 4096 May 31 14:06 toolchains
drwxr-xr-x 2 root root 4096 May 31 14:06 update-hashes
您似乎使用 root
帐户安装了 Rust 工具链。这可以通过更改 .rustup
.
的用户和组权限来解决
sudo chown -R abc:abc /home/abc/.rustup
rustup update
如果您的 /home/abc/.cargo
也归 root
所有,您可能也想修复它。
当我运行rustup update
时,我得到以下错误:
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
error: could not create temp file /home/abc/.rustup/tmp/mbbafo7rtfs5aazi_file
info: checking for self-updates
stable-x86_64-unknown-linux-gnu update failed - rustc 1.52.1 (9bc8c42bb 2021-05-09)
info: cleaning up downloads & tmp directories
thread 'main' panicked at 'Unable to clean up /home/abc/.rustup/downloads: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', src/utils/utils.rs:642:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
然后,我尝试 运行 sudo rustup update
并得到以下结果:
sudo: rustup: command not found
ls -l /home/abc/.rustup/
的输出是:
total 28
drwxr-xr-x 2 root root 4096 May 31 14:06 downloads
-rw-r--r-- 1 root root 102 May 31 14:06 settings.toml
drwxr-xr-x 2 root root 4096 May 31 14:06 tmp
drwxr-xr-x 3 root root 4096 May 31 14:06 toolchains
drwxr-xr-x 2 root root 4096 May 31 14:06 update-hashes
您似乎使用 root
帐户安装了 Rust 工具链。这可以通过更改 .rustup
.
sudo chown -R abc:abc /home/abc/.rustup
rustup update
如果您的 /home/abc/.cargo
也归 root
所有,您可能也想修复它。