Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use rosdep init with local user #495

Closed
mxsrc opened this issue Jan 11, 2017 · 8 comments · Fixed by #911
Closed

Can't use rosdep init with local user #495

mxsrc opened this issue Jan 11, 2017 · 8 comments · Fixed by #911

Comments

@mxsrc
Copy link

mxsrc commented Jan 11, 2017

Currently it is not possible to setup ros as a non-priviledged user, because '''rosdep init''' will always write to /etc/ros. rospkg provides a function '''get_etc_ros_dir''' that by default uses /etc/ros but will use the contents of the environment variable ROS_ETC_DIR if it is set. However, this call is never executed and its default is used instead.

mxsrc added a commit to mxsrc/rosdep that referenced this issue Jan 11, 2017
- Use rodpkg.get_etc_ros_dir to get the configuration directory path
- Adapt documentation to include instructions for overriding the
default value
@tfoote
Copy link
Member

tfoote commented Jan 11, 2017

I can reproduce:

tfoote@snowman:~ Last: [0] (0s Seconds)
$ ROS_ETC_DIR=/tmp/etc rosdep init
ERROR: default sources list file already exists:
	/etc/ros/rosdep/sources.list.d/20-default.list
Please delete if you wish to re-initialize
tfoote@snowman:~ Last: [1] (0s Seconds)
$ ROSDEP_SOURCE_PATH=/tmp/etc/rosdep rosdep init
ERROR: default sources list file already exists:
	/etc/ros/rosdep/sources.list.d/20-default.list
Please delete if you wish to re-initialize

t looks to be a problem here: https://github.com/ros-infrastructure/rosdep/blob/master/src/rosdep2/sources_list.py#L99-L104 since it's usually invoked with sudo it can't get the environment.

But if you're trying to change where it is using the environment variable to run as non-privleged that won't work.

Note that we generally strongly recommend using a system wide installation of rosdep otherwise different users can end up with conflicting definitions. And generally when you're using rosdep to install things you need sudo anyway. Usually the problem is the other way around like #473

@wjwwood wjwwood added this to the Untargeted milestone Jul 28, 2017
@allenh1
Copy link
Contributor

allenh1 commented Sep 3, 2017

@tfoote I think I'll take a look into this one

@allenh1
Copy link
Contributor

allenh1 commented Sep 27, 2017

Ok, PR is up.

@cottsay
Copy link
Member

cottsay commented Nov 28, 2018

Looks like that PR was reverted, but ROSDEP_SOURCE_PATH appears to work for me:

$ sudo rosdep init
Wrote /etc/ros/rosdep/sources.list.d/20-default.list
Recommended: please run

	rosdep update

$ ROSDEP_SOURCE_PATH=/tmp/asdf rosdep init
Wrote /tmp/asdf/20-default.list
Recommended: please run

	rosdep update

$ rosdep --version
0.13.0

@karnikram

This comment has been minimized.

@dirk-thomas

This comment has been minimized.

@codebot
Copy link

codebot commented Jan 17, 2023

This is an ancient ticket; I'm just following up with my experience just now, in case it helps anyone. The error message will always print Permission denied: '/etc/ros' but that error message is not correct if ROSDEP_SOURCE_PATH is specified. It will also print that (misleading) message if the directory specified by ROSDEP_SOURCE_PATH does not exist.

If you're using ROSDEP_SOURCE_PATH then just make sure the path specified by the env var exists, and then rosdep will happily use it.

@tfoote
Copy link
Member

tfoote commented Feb 14, 2023

I've confirmed that ROSDEP_SOURCE_PATH is working now for usage as a non-root user. As this is not the recommended usage I'm going to close this as working now.

The logic to set the source path trims any directory that does not exist.

sdirs.remove(p)

As such if the new directory doesn't exist it fall back to the default one. Which leads to the permission denied. For the init capability it should not prune in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants