Robotics StackExchange | Archived questions

add the workspace to your ROS permission denied

hello I have a problem to add the workspace in the ROS environment.

I am following the tutorial and when I have to add the workspace in the ROS environment

$ . ~/catkin_ws/devel/setup.bash

I get the following:

bash: /home/jonatan/catkin_ws/devel/setup.bash: permission denied

What should I do to solve it?


Edit:

BEFORE:

jonatan@jonatan-TECRA-S4:~/catkin_ws2/devel$ ls -l

total 40

- rwxr-xr-x 1 jonatan jonatan   506 mar 16 13:13 env.sh

- drwxrwxr-x 3 jonatan jonatan  4096 mar 16 12:46 etc
- drwxrwxr-x 3 jonatan jonatan  4096 mar 16 13:03 lib
- rw-r--r-- 1 jonatan jonatan   260 mar 16 13:13 setup.bash
- rw-r--r-- 1 jonatan jonatan  2384 mar 16 13:13 setup.sh
- rwxr-xr-x 1 jonatan jonatan 12274 mar 16 13:13 _setup_util.py
- rw-r--r-- 1 jonatan jonatan   250 mar 16 13:13 setup.zsh
- drwxrwxr-x 3 jonatan jonatan  4096 mar 16 13:03 share

AFTER:

jonatan@jonatan-TECRA-S4:~/catkin_ws2$ rm -r devel

jonatan@jonatan-TECRA-S4:~/catkin_ws2$ rm -r build

jonatan@jonatan-TECRA-S4:~/catkin_ws2$ catkin_make

jonatan@jonatan-TECRA-S4:~/catkin_ws2$ ls -l

total 12

drwxrwxr-x 8 jonatan jonatan 4096 mar 16 13:55 build

drwxrwxr-x 5 jonatan jonatan 4096 mar 16 13:55 devel

drwxrwxr-x 3 jonatan jonatan 4096 mar 16 13:00 src

jonatan@jonatan-TECRA-S4:~/catkin_ws2$ ~/catkin_ws2/devel/setup.bash

bash: /home/jonatan/catkin_ws2/devel/setup.bash: permission denied

*(NOTE: catkinws = catkinws2)

Asked by JLL on 2015-03-04 06:35:41 UTC

Comments

It seems broken. What did you do to create this?

Asked by dornhege on 2015-03-04 07:09:33 UTC

@JLL: please only update your original question with new information. Don't post answers with new information. I've merged your answer into your question this time.

Asked by gvdhoorn on 2015-03-16 08:31:35 UTC

@JLL: without the dot (ie: . /path/to/setup.bash), bash will not source setup.bash, but try to execute it. Is the missing dot a typo? Could you please try sourcing with source /path/to/setup.bash?

Asked by gvdhoorn on 2015-03-16 08:32:48 UTC

This would explain the error. Without +x the setup.bash is not executable (which it doesn't need to be, actually it should not be!)

Asked by dornhege on 2015-03-16 08:36:09 UTC

Answers

Update for your comment/ added info:

The command:

jonatan@jonatan-TECRA-S4:~/catkin_ws2$ ~/catkin_ws2/devel/setup.bash

won't work. Try using

jonatan@jonatan-TECRA-S4:~/catkin_ws2$ source ~/catkin_ws2/devel/setup.bash

or

jonatan@jonatan-TECRA-S4:~/catkin_ws2$ . ~/catkin_ws2/devel/setup.bash

I. e. you must not try to execute the script but source it so the environment variables set in their will persist once its execution is done.

Asked by Wolf on 2015-03-04 08:31:02 UTC

Comments

The odd thing is that the source command points to catkin_ws/desa, so I guess there was some overlaying going on or similar. In any case I'd recommend the first solution. The executable flag isn't just "lost", so I'd assume something more is broken.

Asked by dornhege on 2015-03-04 09:02:09 UTC

Also: setup.bash is sourced, not executed. So it doesn't need the exec bit. It also doesn't have it on my installation.

Asked by gvdhoorn on 2015-03-04 09:25:38 UTC

I've done the solutions you've recommended to me but I get the same

I need a solution please!

Asked by JLL on 2015-03-16 07:18:55 UTC

Please post the exact commands you entered and outputs and give the output of ls -l before and after.

Asked by dornhege on 2015-03-16 07:30:34 UTC

maybe add the output of groups to see which permissions your user has

Asked by Wolf on 2015-03-16 07:41:05 UTC

The command: [..] won't ever work. [..]

@Wolf: I think you missed the dot in front of the the quoted command. Sourcing a file using a dot is perfectly legal (see here fi).

Asked by gvdhoorn on 2015-03-16 08:28:23 UTC

But you need the dot (or source) The command of JLL up there just enters the file name. This fails with permission denied if the file has no exec flag but even if it has an exec flag and you run it like this it won't change your environment. Either . or source is needed.

Asked by Wolf on 2015-03-16 09:05:22 UTC

The first quote from @JLL does include the dot:

$ . ~/catkin_ws/devel/setup.bash

You're right that the one in the edit doesn't include it.

Asked by gvdhoorn on 2015-03-16 09:21:15 UTC

@Wolf: missing the point.

now I do not see either denial but also no output

How do I know this right?

Asked by JLL on 2015-03-16 10:03:20 UTC

env | grep ROS

should give your some environment variables point your workspace / ros installation and some of their sub folders

Asked by Wolf on 2015-03-16 10:13:19 UTC

@Wolf sorry I'm new to ROS How do I can see the environment variables ?

Asked by JLL on 2015-03-16 10:51:58 UTC