You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Installation OSError: [Errno 2] No such file or directory #29
The commands cmd at subproc = subprocess.Popenmaster/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 to subprocess.Popen subprocess return OSError: [Errno 2] No such file or directory.
Otherwise if I add an user (sandbox) it seems to work:
But when this code runs after a POST submit from (open demo course) code grader I got:
vagrant@precise64:/edx/app$ less /edx/var/log/supervisor/xservertderr.log
2014-10-17 18:45:24 [17287] [INFO] Worker exiting (pid: 17287)
2014-10-17 18:45:24 [17286] [INFO] Worker exiting (pid: 17286)
2014-10-17 18:45:24 [21168] [INFO] Handling signal: term
2014-10-17 18:45:24 [21168] [INFO] Shutting down: Master
2014-10-17 18:45:27 [7337] [INFO] Starting gunicorn 0.17.4
2014-10-17 18:45:27 [7337] [INFO] Listening at: http://127.0.0.1:8050 (7337)
2014-10-17 18:45:27 [7337] [INFO] Using worker: sync
2014-10-17 18:45:27 [7344] [INFO] Booting worker with pid: 7344
2014-10-17 18:45:27 [7347] [INFO] Booting worker with pid: 7347
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
and
vagrant@precise64:/edx/app$ less /edx/var/log/supervisor/xservertdout.log
2014-10-17 18:45:24,829 INFO 17287 [gunicorn.error] glogging.py:213 - Worker exiting (pid: 17287)
2014-10-17 18:45:24,829 INFO 17286 [gunicorn.error] glogging.py:213 - Worker exiting (pid: 17286)
2014-10-17 18:45:24,833 INFO 21168 [gunicorn.error] glogging.py:213 - Handling signal: term
2014-10-17 18:45:24,835 INFO 21168 [gunicorn.error] glogging.py:213 - Shutting down: Master
Opening env.json file
2014-10-17 18:45:27,335 INFO 7337 [gunicorn.error] glogging.py:213 - Starting gunicorn 0.17.4
2014-10-17 18:45:27,336 INFO 7337 [gunicorn.error] glogging.py:213 - Listening at: http://127.0.0.1:8050 (7337)
2014-10-17 18:45:27,337 INFO 7337 [gunicorn.error] glogging.py:213 - Using worker: sync
2014-10-17 18:45:27,339 INFO 7344 [gunicorn.error] glogging.py:213 - Booting worker with pid: 7344
2014-10-17 18:45:27,366 INFO 7347 [gunicorn.error] glogging.py:213 - Booting worker with pid: 7347
2014-10-17 18:47:08,367 INFO 7347 [xserver.pyxserver_wsgi] pyxserver_wsgi.py:179 - Starting application
2014-10-17 18:47:08,368 INFO 7347 [grade] grade.py:13 - /edx/var/xserver/data/content-test-xserver/graders/graders/grade_bisect.py - {u'grader': u'gra
ders/grade_bisect.py'} - 27 - <module 'sandbox.sandbox' from '/edx/app/xserver/xserver/sandbox/sandbox.py'>
2014-10-17 18:47:08,390 ERROR 7347 [xserver.pyxserver_wsgi] pyxserver_wsgi.py:191 - Error processing request: {"xqueue_files": "{}", "xqueue_body": "{\"student_info\": \"{\\\"anonymous_student_id\\\": \\\"a87ff679a2f3e71d9181a67b7542122c\\\", \\\"submission_time\\\": \\\"20141017184708\\\"}\", \"grader_payload\": \"\\n{\\\"grader\\\": \\\"graders/grade_bisect.py\\\"}\\n\", \"student_response\": \"27\"}"}
Traceback (most recent call last):
File "/edx/app/xserver/xserver/pyxserver_wsgi.py", line 189, in post_wrapper
return do_POST(data)
File "/edx/app/xserver/xserver/pyxserver_wsgi.py", line 169, in do_POST
'msg': render_results(results) }
File "/edx/app/xserver/xserver/pyxserver_wsgi.py", line 120, in render_results
errors = format_errors(results['errors'])
File "/edx/app/xserver/xserver/pyxserver_wsgi.py", line 79, in format_errors
error_list = [esc(e) for e in errors or []]
File "/usr/lib/python2.7/cgi.py", line 1035, in escape
s = s.replace("&", "&") # Must be done first!
AttributeError: 'SafeExecException' object has no attribute 'replace'
the SafeExecException is
[SafeExecException("Couldn't execute jailed code: sudo: no tty present and no askpass program specified\nSorry, try again.\nsudo: no tty present and no askpass program specified\nSorry, try again.\nsudo: no tty present and no askpass program specified\nSorry, try again.\nsudo: 3 incorrect password attempts\n",)]
@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.
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.
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:
vagrant@precise64:/edx/app$ sudo -u xserver bash
bash: /home/vagrant/share_x11: Permission denied
xserver@precise64:/edx/app$ sudo -l
Matching Defaults entries for xserver on this host:
env_reset, exempt_group=admin, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin, env_keep+=SSH_AUTH_SOCK,
env_keep+=DISPLAY
User xserver may run the following commands on this host:
(sandbox) SETENV: NOPASSWD: /edx/app/xserver/venvs/xserver-sandbox/bin/python
(sandbox) SETENV: NOPASSWD: /usr/bin/find
(sandbox) SETENV: NOPASSWD: /bin/rm /tmp/codejail-*/tmp
(ALL) NOPASSWD: /bin/kill
(ALL) NOPASSWD: /usr/bin/pkill
(ALL) NOPASSWD: ALL
(ALL : ALL) ALL
xserver@precise64:/edx/app$
vagrant@precise64:/edx/app$ sudo -u edxapp bash
bash: /home/vagrant/share_x11: Permission denied
edxapp@precise64:/edx/app$
edxapp@precise64:/edx/app$
edxapp@precise64:/edx/app$ sudo -l
Matching Defaults entries for edxapp on this host:
env_reset, exempt_group=admin, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin, env_keep+=SSH_AUTH_SOCK,
env_keep+=DISPLAY
User edxapp may run the following commands on this host:
(sandbox) SETENV: NOPASSWD: /edx/app/edxapp/venvs/edxapp-sandbox/bin/python
(sandbox) SETENV: NOPASSWD: /bin/rm /tmp/codejail-*/tmp
(sandbox) SETENV: NOPASSWD: /usr/bin/find
(ALL) NOPASSWD: /bin/kill
(ALL) NOPASSWD: /usr/bin/pkill
(ALL) NOPASSWD: ALL
(ALL : ALL) ALL
edxapp@precise64:/edx/app$
vagrant@precise64:/edx/app$ sudo -u sandbox bash
bash: /home/vagrant/share_x11: Permission denied
sandbox@precise64:/edx/app$ sudo -l
Matching Defaults entries for sandbox on this host:
env_reset, exempt_group=admin, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin, env_keep+=SSH_AUTH_SOCK,
env_keep+=DISPLAY
User sandbox may run the following commands on this host:
(ALL) NOPASSWD: ALL
(ALL : ALL) ALL
sandbox@precise64:/edx/app$
Activity
morenopc commentedon Oct 17, 2014
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
But when this code runs after a POST submit from (open demo course) code grader I got:
and
the
SafeExecExceptionisfeanil commentedon Oct 20, 2014
@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.
morenopc commentedon Oct 21, 2014
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.
e0d commentedon Oct 21, 2014
I looks like your sudoers config isn't correct for the code jail user and you are being prompted for a password.
morenopc commentedon Oct 21, 2014
Right @e0d. Can you see where this bug is based on my config files #17 (comment)?
e0d commentedon Oct 21, 2014
What is the value of settings.DO_SANDBOXING? See settings.py for context.
morenopc commentedon Oct 21, 2014
env.json
The xserver settings.py is the same of the repository.
feanil commentedon Oct 21, 2014
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.
morenopc commentedon Oct 21, 2014
/etc/sudoers.d/
/etc/sudoers.d/01-sandbox
/etc/sudoers.d/95-sandbox
nedbat commentedon Oct 21, 2014
@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?
morenopc commentedon Oct 21, 2014
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