I got curious today and I am trying to install Rust on a Ubuntu 22.04 laptop but I got the following error:
~$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installer
Welcome to Rust!
This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.
Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:
/home/myusername/.rustup
This can be modified with the RUSTUP_HOME environment variable.
The Cargo home directory is located at:
/home/myusername/.cargo
This can be modified with the CARGO_HOME environment variable.
The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:
/home/myusername/.cargo/bin
This path will then be added to your PATH environment variable by
modifying the profile files located at:
/home/lobianco/.profile
/home/lobianco/.bashrc
You can uninstall at any time with rustup self uninstall and
these changes will be reverted.
Current installation options:
default host triple: x86_64-unknown-linux-gnu
default toolchain: stable (default)
profile: default
modify PATH variable: yes
1) Proceed with standard installation (default - just press enter)
2) Customize installation
3) Cancel installation
>1
info: profile set to 'default'
info: default host triple is x86_64-unknown-linux-gnu
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2024-09-05, rust version 1.81.0 (eeb90cda1 2024-09-04)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
8.9 MiB / 15.9 MiB ( 56 %) 5.8 MiB/s in 1s ETA: 1s
info: rolling back changes
error: failed to extract package: Operation not permitted (os error 1)
I have plenty of space and I have already trying removing ~/.cargo and ~/.rustup folders...
You don't need to install as root. This indicates a problem with ownership or mode of something. Unfortunately it isn't telling you what it is trying to do when failing (it really should, could be worth filing a bug about that).
I would check that your home directory is owned by you and the user has rwx permissions. Also check your .bashrc/.profile etc that it tries to write PATH to (should be mode rw for the user).
You could also write a find command to find any files with wrong owner (or missing read/write/execute) in your home dir, I would write out such a one liner for you, but I'm on my phone at the moment.
Could also be some weirdness with some temporary directory it is downloading to before unpacking (/tmp? Not sure what it uses).
Unfortunatly it doesn't tell me where it is getting issues....
EDIT: I have tried the installation script with the option not to update the ENV variables, but same error
EDIT2: If I choose the nighly build, minimal, no env var, it installs correctly (but I am just starting, that's not the solution I want)
EDIT3: The issue is not in the stable/nightly nor in the variables, it is in the default or minimal installation. If I choose minimal, it installs, if I choose "default" it gives me the error.
So, if I choose minimal, what I then need to install to get back a default installation ?
That is truly weird. It a really shouldn't be doing that. Could there be some weirdness with SELinux or anti-malware software going on? Much less common on Linux than on Windows, but in a corporate environment you might have something like that.
Another random idea: weird file system? Such as a FUSE based home dir encryption or such (as opposed to normal block device based full disk encryption).
One idea would be to run strace on rustup to see what the last failing syscall is. You likely need to redirect to a file and sift through, since it apparently does a bunch of cleanup after, so the issue won't be at the very end.
I have a pretty standard ext4 fs..
Indeed it could have been an antivirus they made me to install, "WithSecure" (ex f-secure).. I removed it, and the command then it worked...