-
Notifications
You must be signed in to change notification settings - Fork 74
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
Installation OSError: [Errno 2] No such file or directory #29
Comments
Moving on I'm trying to build an xserver grader test using https://github.com/antoviaque/xserver-grader. After install and test it I changed master/graders/grade.py to import logging
import codejail.jail_code
import codejail.safe_exec
log = logging.getLogger(__name__)
def grade(grader_path, grader_config, student_response, sandbox):
"""Handle code grader submitions"""
errors = []
codejail.jail_code.configure(
command='python',
bin_path='/edx/app/edxapp/venvs/edxapp-sandbox/bin/python',
user='sandbox')
try:
codejail.safe_exec.safe_exec(student_response, {})
except Exception, e:
errors.append(e)
results = {
'correct': False,
'score': 1,
'tests': [],
'errors': errors
}
return results But when this code runs after a POST submit from (open demo course) code grader I got:
and
the
|
@morenopc Code-Jail does not work without a user. The jailed code is run as a user that has limited capabilities. The one that is automatically created by the edx configuration scripts is 'sandbox' ati it has to be in your settings for XServer as you already discovered. |
Thanks @feanil. Can you tell me what is wrong with my configure files (#17 (comment)) that I'm keep getting the "sudo: no tty present and no askpass program specified" error using 'sandbox' user? The sandbox user is already able to act like sudo inside my devstack server.
|
I looks like your sudoers config isn't correct for the code jail user and you are being prompted for a password. |
Right @e0d. Can you see where this bug is based on my config files #17 (comment)? |
What is the value of settings.DO_SANDBOXING? See settings.py for context. |
env.json
The xserver settings.py is the same of the repository. |
Also what are the settings in /etc/sudoers.d/ for the sandbox user. It should be set to not prompt for password when you try to sudo from the edxapp user to the sandbox user. |
/etc/sudoers.d/
/etc/sudoers.d/01-sandbox
/etc/sudoers.d/95-sandbox
|
@morenopc the 95-sandbox file you're showing here has a truncated filename:
Does it really end with "pyth", or is that a copy-paste problem? |
Hi @nedbat. Right, I saw this today too and fixed it. Today I also granted root permission for 'xserver', 'edxapp' and 'sandbox' users in order to check why it keeps asking for sudo password but it didn't work. Let me show you:
but edxapp@precise64:~/edx-platform$ ./manage.py lms shell --settings=dev_pt_br
Python 2.7.3 (default, Feb 27 2014, 19:58:35)
Type "copyright", "credits" or "license" for more information.
IPython 2.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import codejail.jail_code
In [2]: import codejail.safe_exec
In [3]: codejail.jail_code.configure('python', '/edx/app/edxapp/venvs/edxapp-sandbox/bin/python', 'sandbox')
In [4]: codejail.safe_exec.safe_exec('1+1', {})
---------------------------------------------------------------------------
SafeExecException Traceback (most recent call last)
/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/commands/shell.pyc in <module>()
----> 1 codejail.safe_exec.safe_exec('1+1', {})
/edx/app/edxapp/venvs/edxapp/src/codejail/codejail/safe_exec.pyc in safe_exec(code, globals_dict, files, python_path, slug)
139 if res.status != 0:
140 raise SafeExecException(
--> 141 "Couldn't execute jailed code: %s" % res.stderr
142 )
143 globals_dict.update(json.loads(res.stdout))
SafeExecException: Couldn't execute jailed code: sudo: no tty present and no askpass program specified
Sorry, try again.
sudo: no tty present and no askpass program specified
Sorry, try again.
sudo: no tty present and no askpass program specified
Sorry, try again.
sudo: 3 incorrect password attempts |
Hi,
I'm trying to follow the installation guide but when I tried to run the using codejail code on xserver devstack vangrat server:
I got (OSError: [Errno 2] No such file or directory) error:
Debugging codejail I found that
if user is None
atdef configure(command, bin_path, user=None):
master/codejail/jail_code.py#L26The commands
cmd
atsubproc = subprocess.Popen
master/codejail/jail_code.py#L219 is['TMPDIR=tmp', '/edx/app/xserver/venvs/xserver/bin/python', '-E', '-B', 'jailed_code']
. Because'TMPDIR=tmp'
is the first parameter tosubprocess.Popen
subprocess returnOSError: [Errno 2] No such file or directory
.Otherwise if I add an user (sandbox) it seems to work:
cmd
atsubproc = subprocess.Popen
master/codejail/jail_code.py#L219 is['sudo', '-u', 'sandbox', 'TMPDIR=tmp', '/edx/app/xserver/venvs/xserver-sandbox/bin/python', '-E', '-B', 'jailed_code']
Is codejail work without an user?
The text was updated successfully, but these errors were encountered: