1

I have installed rust by curl https://sh.rustup.rs -sSf | sh and followed instructions thereof. Installation was successful and the PATH was added to the .bash_profile as follows:

export PATH=$HOME/.cargo/bin:$PATH

echo ing $PATH shows variable has been set properly, as follows:

rust@rusty:~$ echo $PATH
/home/rust/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/games

I am mounting /home as a separate partition and mounting through /etc/fstab as follows

# Mounting home partition
/dev/sda4                 /home                 ext4      rw,async,users      0 0

I initially had noexec as one of the options. But, removing that did not bring any change in the outcome.

I doubting that my default /home partition permissions but don't have any other linux running box to verify.

total 20
drwx------  2 root     root     16384 Jan 18 08:38 lost+found
drwxr-xr-x 22 rust     rust     4096  Jan 19 19:45 rust

Is this permissions correct?

If someone could shed some light on what I am missing to notice/doing wrong and how to troubleshoot and fix the issue would be much appreciated.

Realized after the comment from @kusalananda

EDIT-1

rust@rusty:~$ cargo
bash: /home/rust/.cargo/bin/cargo: Permission denied

It supposed to prompt me with the help documentation of cargo but fails saying the above.

EDIT-2 Added the permissions of .cargo and .cargo/bin

rust@rusty:~$ ls -l .cargo/
total 8
drwxr-xr-x 2 rust rust 4096 Jan 19 18:45 bin
-rw-r--r-- 1 rust rust   37 Jan 19 18:58 env
rust@rusty:~$ ls -l .cargo/bin/
total 108560
-rwxr-xr-x 10 rust rust 11116056 Jan 19 18:45 cargo
-rwxr-xr-x 10 rust rust 11116056 Jan 19 18:45 cargo-clippy
-rwxr-xr-x 10 rust rust 11116056 Jan 19 18:45 cargo-fmt
-rwxr-xr-x 10 rust rust 11116056 Jan 19 18:45 rls
-rwxr-xr-x 10 rust rust 11116056 Jan 19 18:45 rustc
-rwxr-xr-x 10 rust rust 11116056 Jan 19 18:45 rustdoc
-rwxr-xr-x 10 rust rust 11116056 Jan 19 18:45 rustfmt
-rwxr-xr-x 10 rust rust 11116056 Jan 19 18:45 rust-gdb
-rwxr-xr-x 10 rust rust 11116056 Jan 19 18:45 rust-lldb
-rwxr-xr-x 10 rust rust 11116056 Jan 19 18:45 rustup

EDIT-3:

>> curl https://sh.rustup.rs -sSf | 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.

It will add the cargo, rustc, rustup and other commands to Cargo's bin 
directory, located at:

  /home/rusty/.cargo/bin

This path will then be added to your PATH environment variable by modifying the
profile files located at:

  /home/rusty/.profile
  /home/rusty/.bash_profile

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
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1

info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2019-01-17, rust version 1.32.0 (9fda7c223 2019-01-16)
info: downloading component 'rustc'
 79.5 MiB /  79.5 MiB (100 %) 883.2 KiB/s ETA:   0 s                
info: downloading component 'rust-std'
 54.3 MiB /  54.3 MiB (100 %) 611.2 KiB/s ETA:   0 s                
info: downloading component 'cargo'
  4.4 MiB /   4.4 MiB (100 %) 761.4 KiB/s ETA:   0 s                
info: downloading component 'rust-docs'
  8.5 MiB /   8.5 MiB (100 %) 553.6 KiB/s ETA:   0 s                
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'cargo'
info: installing component 'rust-docs'
info: default toolchain set to 'stable'

  stable installed - (error reading rustc version)


Rust is installed now. Great!

To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH 
environment variable. Next time you log in this will be done automatically.

To configure your current shell run source $HOME/.cargo/env
  • You are not actually saying what prompts a "Permission denied" error. Also, did you re-mount /home after changing /etc/fstab? – Kusalananda Jan 19 at 15:00
  • @Kusalananda. Yes. I did remount and even rebooted once to be sure. – RussellB Jan 19 at 15:10
  • The permissions on /home/rust looks ok. The allow for anyone to access the directory and read files therein. What about /home/rust/bin and the cargo binary itself? – Kusalananda Jan 19 at 15:13
  • Thank you @Kusalananda. I have added the permissions of .cargo and .cargo/bin. My impression is that they're o.k. Please correct me, if otherwise. – RussellB Jan 19 at 15:28
0

The issue was the /etc/fstab entry that I had. It worked after I changed the way I was mounting. Here is my new fstab entry:

/dev/sda4            /home/rusty            ext4            defaults            0  2

I changed the owner & group of /home/rusty to be rusty and it worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.