ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Permission denied /opt/ros/electric/stacks/nxt/learning_nxt

asked 2012-06-25 07:35:20 -0600

Nezteb gravatar image

updated 2014-01-28 17:12:49 -0600

ngrennan gravatar image

Using Ubuntu 10.04 Lucid and ROS Electric. I had successfully installed the NXT packages for ROS and tested them with my brick. Everything seemed to be going well. I'm trying to do the NXT tutorials:

Entered: roscd nxt

Brought me to: /opt/ros/electric/stacks/nxt

Entered: roscreate-pkg learning_nxt rospy nxt_ros


Traceback (most recent call last):
  File "/opt/ros/electric/ros/bin/roscreate-pkg", line 35, in <module>
  File "/opt/ros/electric/ros/tools/roscreate/src/roscreate/", line 125, in roscreatepkg_main
    create_package(package, author_name(), depends, uses_roscpp=uses_roscpp, uses_rospy=uses_rospy)
  File "/opt/ros/electric/ros/tools/roscreate/src/roscreate/", line 63, in create_package
  File "/usr/lib/python2.6/", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/opt/ros/electric/stacks/nxt/learning_nxt'

Before this I had been using roscreate-pkg just fine with the regular ROS tutorials. Now that I'm trying to use it with the NXT packages, it seems to not work.

EDIT 1: In reply to Lorenz, thank you. That is one thing that has confused me about the differences between Fuerte and Electric. In the installing Electric tutorial page, overlays aren't mentioned and I feel like my bashrc isn't setup the way it should be, even though I followed the isntructions verbatim from the install and configuration tutorials. The last three lines of my bashrc are currently (before applying Lorenz's update):

source /opt/ros/electric/setup.bash
export ROS_PACKAGE_PATH=~/ros_workspace:/opt/ros/electric/stacks
export ROS_WORKSPACE=~/ros_workspace

I also don't understand why roscreate-pkg works fine when I use it without NXT in mind.

EDIT 1.1: I ran all of Lorenz's suggested commands verbatim. After trying to run the command: rosws set ~/ros_overlay/sandbox

I get this:

     Add element: 
 {'other': {'local-name': '/home/noah/ros_overlay/sandbox'}}
Continue(y/n): y
Overwriting /home/noah/ros_workspace/.rosinstall
Traceback (most recent call last):
  File "/usr/local/bin/rosws", line 66, in <module>
  File "/usr/local/lib/python2.6/dist-packages/rosinstall/", line 519, in rosws_main
    return ws_commands[command](workspace, args)
  File "/usr/local/lib/python2.6/dist-packages/rosinstall/", line 318, in cmd_set
    shutil.move(os.path.join(config.get_base_path(), self.config_filename), "%s.bak"%os.path.join(config.get_base_path(), self.config_filename))
  File "/usr/lib/python2.6/", line 264, in move
    copy2(src, real_dst)
  File "/usr/lib/python2.6/", line 99, in copy2
    copyfile(src, dst)
  File "/usr/lib/python2.6/", line 52, in copyfile
    fsrc = open(src, 'rb')
IOError: [Errno 2] No such file or directory: '/home/noah/ros_workspace/.rosinstall'

Notice the last line.

EDIT 1.2: All of the commands ran fine up to: rosws set ~/ros_overlay/sandbox

The output of the following command is below: ls -l ~/ros_workspace

drwxr-xr-x 11 noah noah 4096 2012-06-25 09:18 beginner_tutorials

I found the .rosinstall in the ~/ros_overlay instead of ~/ros_workspace

Is there a way to ... (more)

edit retag flag offensive close merge delete


That's interesting. The rosws init should actually create the .rosinstall file in ~/ros_workspace. Did you get any errors while executing rosws init? After executing it, what's the output of ls -l ~/ros_workspace?

Lorenz gravatar image Lorenz  ( 2012-06-25 08:12:03 -0600 )edit

re EDIT 1: Your .bashrc had a workspace setup correctly (for electric). The reason for the error is that you tried to create a package in the installed nxt stack instead of your home workspace. This is always bad and independent of electric or fuerte.

dornhege gravatar image dornhege  ( 2012-06-25 08:20:23 -0600 )edit

As I said at the end of my question, you should call roscreate in ~/ros_overlay/sandbox. Ignore what the NXT tutorial or any other tutorial says about where to create packages :) and always use your sandbox dir. The NXT tutorial probably assumes an installation from source.

Lorenz gravatar image Lorenz  ( 2012-06-25 22:34:25 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2012-06-25 07:45:29 -0600

Lorenz gravatar image

updated 2012-06-25 22:34:58 -0600

You should never try to edit, create or change files in /opt/ros/.... Instead, create a overlay in your home directory. To create an overlay for electric, just execute the following commands:

sudo apt-get install python-pip
sudo pip install -U rosinstall
rosws init ~/ros_overlay /opt/ros/electric
mkdir ~/ros_overlay/sandbox
source ~/ros_overlay/setup.bash
rosws set ~/ros_overlay/sandbox

Now open your ~/.bashrc and change the line

source /opt/ros/electric/setup.bash


source ~/ros_overlay/setup.bash

Now close and re-open your terminal and execute the command roscreate-pkg in ~/ros_workspace/sandbox.

edit flag offensive delete link more


Ah. Sorry. I screwed up the source line. Edited my question to fix it. Of course you should source the setup.bash in ros_overlay, not in ros_workspace.

Lorenz gravatar image Lorenz  ( 2012-06-25 22:30:24 -0600 )edit

There was another mistake in the commands above. I forgot that you have to source setup.bash before calling rosws set, instead your ROS_WORKSPACE variable is not set correctly. Sorry for that.

Lorenz gravatar image Lorenz  ( 2012-06-25 22:35:50 -0600 )edit

Question Tools

1 follower


Asked: 2012-06-25 07:35:20 -0600

Seen: 1,924 times

Last updated: Jun 25 '12