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

rosdep run as root #45

Closed
dominiquehunziker opened this issue Dec 17, 2012 · 4 comments
Closed

rosdep run as root #45

dominiquehunziker opened this issue Dec 17, 2012 · 4 comments

Comments

@dominiquehunziker
Copy link

Hi,

I think there is a problem when rosdep is run as root, because root has no command sudo.

Here is the full error message:
executing command [sudo apt-get install libjson-glib-dev]

ERROR: Rosdep experienced an internal error: [Errno 2] No such file or directory
Please go to the rosdep page [1] and file a bug report with the stack trace below.
[1] : http://www.ros.org/wiki/rosdep

Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/rosdep2/main.py", line 116, in rosdep_main
exit_code = _rosdep_main(args)
File "/usr/lib/pymodules/python2.7/rosdep2/main.py", line 257, in _rosdep_main
return _package_args_handler(command, parser, options, args)
File "/usr/lib/pymodules/python2.7/rosdep2/main.py", line 338, in _package_args_handler
return command_handlers[command](lookup, packages, options)
File "/usr/lib/pymodules/python2.7/rosdep2/main.py", line 494, in command_install
installer.install(uninstalled, *_install_options)
File "/usr/lib/pymodules/python2.7/rosdep2/installers.py", line 477, in install
verbose=verbose)
File "/usr/lib/pymodules/python2.7/rosdep2/installers.py", line 526, in install_resolved
result = subprocess.call(sub_command)
File "/usr/lib/python2.7/subprocess.py", line 493, in call
return Popen(_popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 679, in init
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

@tfoote
Copy link
Member

tfoote commented Feb 4, 2013

What os are you running? On my machine I can run sudo apt-get install as root.

@dominiquehunziker
Copy link
Author

I've tried to run rosdep in a linux container (lxc) running ubuntu 12.04 created using debootstrap (in a host machine running also 12.04). The problem is that my container filesystem does not have the package 'sudo' installed; therefore, the command sudo is not available. (Problem was easily fixed by installing sudo.) However, because I run the container as root I don't really need sudo to elevate my privileges.

So, I see two possible solutions here:

  1. add 'sudo' as a dependency
  2. add some kind of check of privileges, maybe something similar to

cmd = 'apt-get install ' + pkg

if os.getuid() != 0:
cmd = 'sudo ' + cmd

@jonbinney
Copy link

Looks like rosdep now has a --as-root option to handle this case, so maybe this can be closed now?

@tfoote
Copy link
Member

tfoote commented Sep 27, 2016

This has been more fully documented in #473 and that's open to track improving the error message.

@tfoote tfoote closed this as completed Sep 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants