Skip to content

(cargo) requires root permissions and writes to /usr/local/lib/? #2451

@killerswan

Description

@killerswan

Why does cargo write to /usr/local/, requiring root permission even for a user-level or local package install? After #1756 I thought it would build and install in ./ by default, and with -g in ~/, and with -G in /usr/local/, but here we are:

$ cargo install rustx
rust: upcall fail 'can't make_dir /usr/local/lib/cargo/sources', /code/rust/src/cargo/cargo.rs:176
rust: domain main @0x1382e80 root task failed
rust: upcall fail 'killed', /code/rust/src/libcore/task.rs:454
$ cargo -g install rustx
rust: upcall fail 'can't make_dir /usr/local/lib/cargo/sources', /code/rust/src/cargo/cargo.rs:176
rust: domain main @0x15dde80 root task failed
rust: upcall fail 'killed', /code/rust/src/libcore/task.rs:454

Furthermore, once I use sudo:

$ sudo cargo install rustx
info: Installing with git from https://github.com/killerswan/rustx...
Cloning into '/code/temp/.cargo/work/69TAjwAxxJkM7WQn'...
remote: Counting objects: 45, done.
remote: Compressing objects: 100% (28/28), done.
remote: Total 45 (delta 17), reused 42 (delta 14)
Unpacking objects: 100% (45/45), done.
warning: Copying /code/temp/.cargo/work/69TAjwAxxJkM7WQn/build/rustt to /code/temp/.cargo/bin failed
warning: Copying /code/temp/.cargo/work/69TAjwAxxJkM7WQn/build/rustx to /code/temp/.cargo/bin failed
warning: Copying /code/temp/.cargo/work/69TAjwAxxJkM7WQn/build/_rustx to /code/temp/.cargo/bin failed
$ ls -alR
.:
total 12
drwxrwxr-x  3 kevin kevin 4096 May 26 07:51 .
drwxr-xr-x 17 kevin kevin 4096 May 26 07:37 ..
drwx------  6 kevin kevin 4096 May 26 07:51 .cargo

./.cargo:
total 24
drwx------ 6 kevin kevin 4096 May 26 07:51 .
drwxrwxr-x 3 kevin kevin 4096 May 26 07:51 ..
drwx------ 2 root  root  4096 May 26 07:51 bin
drwx------ 2 root  root  4096 May 26 07:51 gpg
drwx------ 2 root  root  4096 May 26 07:51 lib
drwx------ 3 root  root  4096 May 26 07:51 work
ls: cannot open directory ./.cargo/bin: Permission denied
ls: cannot open directory ./.cargo/gpg: Permission denied
ls: cannot open directory ./.cargo/lib: Permission denied
ls: cannot open directory ./.cargo/work: Permission denied

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions