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

usb_cam node "permission denied" when launched by robot_upstart

asked 2016-05-03 13:49:23 -0500

luketheduke gravatar image

updated 2016-05-03 14:15:39 -0500

gvdhoorn gravatar image

When I launch usb_cam from a launch file with robot_upstart on boot, the node fails saying:

[usb_cam-4] process has died [pid 3136, exit code 1, cmd /opt/ros/indigo/lib/usb_cam/usb_cam_node __name:=usb_cam __log:=/home/ubuntu/.ros/log/68608950-115a-11e6-805a-544a16bf53a7/usb_cam-4.log].
log file: /home/ubuntu/.ros/log/68608950-115a-11e6-805a-544a16bf53a7/usb_cam-4*.log

When I look at that log it says:

[ WARN] [1462299217.838001270]: Shutdown request received.
[ WARN] [1462299217.874595145]: Reason given for shutdown: [new node registered with same name]
[ WARN] [1462299240.126186614]: Shutdown request received.
[ WARN] [1462299240.141871614]: Reason given for shutdown: [new node registered with same name]
[ WARN] [1462299353.880653169]: Shutdown request received.
[ WARN] [1462299353.909079127]: Reason given for shutdown: [new node registered with same name]

When I launch the node using rosrun, it works perfectly. What could be causing this issue? I am running ROS Indigo on a Beaglebone Black and Ubuntu 14.04.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
3

answered 2016-05-03 14:20:13 -0500

gvdhoorn gravatar image

updated 2016-05-03 14:21:06 -0500

When I launch the node using rosrun, it works perfectly. What could be causing this issue?

Have you read the note about permissions in the installation documentation? From the robot_upstart 0.2.0 documentation » The install script - permissions:

It’s important to understand how permissions work robot_upstart:

  1. The upstart job invokes its jobname-start bash script as root.

  2. The script sets up environment variables, and then uses setuidgid to execute roslaunch as an unprivileged user. This is by default the user who ran the install script, but it can also be specified explicitly via a flag.

  3. The roslaunch which executes does not have its user’s group memberships. This means that it will not have access to serial ports with the dialout group, or locations in /var/log owned by root, etc. Any filesystem resources needed by your ROS nodes should be chowned to the same unprivileged user which will run ROS, or should set to world readable/writeable, for example using udev.

So jobname-start starts out as user root, but then quickly drops all privileges and continues as a regular user (that is not a member of the dialout or any other group). There may be some more configuration required.

edit flag offensive delete link more

Comments

Thanks for your help!

luketheduke gravatar image luketheduke  ( 2016-05-03 15:00:08 -0500 )edit

Though, how would I make the serial and video available on the robot then?

luketheduke gravatar image luketheduke  ( 2016-05-03 15:10:07 -0500 )edit

Wouldn't this come down to figuring out which user is actually used by robot_upstart, and then making that user a member of the dialout or video group? That is essentially what bullet point nr 3 states, right?

gvdhoorn gravatar image gvdhoorn  ( 2016-05-04 03:53:56 -0500 )edit

From the way I read it, no. At least to me, it seems to say that if user X is a member of dialout and robot_upstart uses that user, it will not have access to the dialout group, even though the user is part of it. Am I wrong, or is there a way to get around this?

luketheduke gravatar image luketheduke  ( 2016-05-04 10:40:57 -0500 )edit

You're right:

[..] should be chowned to the same unprivileged user which will run ROS, or should set to world readable/writeable, for example using udev. [..]

I guess that is one approach, use udev to chown the device files (or make them world readable/writable).

gvdhoorn gravatar image gvdhoorn  ( 2016-05-04 10:59:05 -0500 )edit
1

answered 2016-05-03 14:20:03 -0500

John Hoare gravatar image

updated 2016-05-03 14:21:18 -0500

It's likely that your user is not a part of the video group and so it does not have permission to open the video device.

http://ubuntuforums.org/showthread.ph...

Edit: I haven't used robot_upstart but perhaps it launches ROS as a different user than the one you are logging in with and it is not in the video group.

edit flag offensive delete link more

Comments

Thanks for your help!

luketheduke gravatar image luketheduke  ( 2016-05-03 15:00:00 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-05-03 13:49:23 -0500

Seen: 1,455 times

Last updated: May 03 '16