CodeJail Install Failing

116 views
Skip to first unread message

Cecily Hunt

unread,
May 22, 2015, 5:47:21 PM5/22/15
to edx-code
Hi all,

I'm trying to install CodeJail so that I can use it as part of an external grader that I'm building. I followed the instructions on the CodeJail github page (https://github.com/edx/codejail), but when I run the first test described under the "Using CodeJail" section, I get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "codejail/safe_exec.py", line 151, in safe_exec
    extra_files=extra_files,
  File "codejail/jail_code.py", line 237, in jail_code
    realtime=LIMITS["REALTIME"], rlimits=create_rlimits(),
  File "codejail/subproc.py", line 42, in run_subprocess
    stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Any ideas what might be going wrong?

Thanks,
Cecily

Cecily Hunt
MOOC Assistant Project Director
Harvey Mudd College

rahul pyd

unread,
Aug 14, 2015, 1:22:19 PM8/14/15
to General Open edX discussion
Hi Cecily,

Are you get past this error. I got the same errors messages after following the documentation at codejail official repository.

Regards, 
Rahul

rahul pyd

unread,
Aug 14, 2015, 2:15:42 PM8/14/15
to edx-...@googlegroups.com
Hi Cecily,

Did you get past this error. I got the same error messages after following the documentation at codejail official repository.

Regards, 
Rahul

--
You received this message because you are subscribed to a topic in the Google Groups "General Open edX discussion" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/edx-code/6958f4c0-ea96-4ba7-a1a2-29dc7a5931d8%40googlegroups.com.

Cecily Hunt

unread,
Aug 14, 2015, 6:28:37 PM8/14/15
to edx-code
Hi Rahul,

I wasn't able to find a fix, and so I didn't end up using CodeJail.

Cecily

Ned Batchelder

unread,
Aug 16, 2015, 7:28:41 AM8/16/15
to edx-...@googlegroups.com
Rahul (and Cecily),

How are you running Open edX?  If you are running Python in a virtualenv, then CodeJail tries to automatically find another virtualenv based on the first one.  

For example, in a devstack:

$ which python
/edx/app/edxapp/venvs/edxapp/bin/python
$ ls -l /edx/app/edxapp/venvs
total 8
drwxr-xr-x 10 edxapp  edxapp  4096 Aug 15 12:05 edxapp/
drwxr-xr-x  8 sandbox sandbox 4096 Aug 15 11:51 edxapp-sandbox/

The error you are getting is likely because there isn't a second virtualenv to run the sandboxed Python code.

--Ned.

--
You received this message because you are subscribed to the Google Groups "General Open edX discussion" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/edx-code/CAG261Ua94M94WaWPvOsc917vrHtn4aA-fW8eUuZohix_bfA47Q%40mail.gmail.com.

rahul pyd

unread,
Aug 17, 2015, 3:36:48 AM8/17/15
to edx-...@googlegroups.com
Hi Ned,

I am not trying to integrate Codejail with Open edX at this point -- but it is on the cards. I have been following the documentation for the project and see if I am able to set it up correctly as a *stand-alone* system.


Here is the setup I got:

(myproj)rhlpyd@nyc:~$ which python
/home/rhlpyd/aop-projects/codejail-test/myproj/bin/python

(myproj)rhlpyd@nyc:~$ ls -l aop-projects/codejail-test/
total 12
drwxrwxr-x 4 rhlpyd  rhlpyd  4096 Aug 14 13:02 codejail
drwxrwxr-x 7 rhlpyd  rhlpyd  4096 Aug 14 22:01 myproj
drwxrwxr-x 6 sandbox sandbox 4096 Aug 17 12:13 myproj-sandbox


rhlpyd@nyc:~$ sudo less /etc/sudoers.d/01-sandbox

rhlpyd ALL=(sandbox) SETENV:NOPASSWD:/home/rhlpyd/aop-projects/codejail-test/myproj-sandbox/bin/python
rhlpyd ALL=(sandbox) SETENV:NOPASSWD:/usr/bin/find
rhlpyd ALL=(ALL) NOPASSWD:/usr/bin/pkill


rhlpyd@nyc:~$ less /etc/apparmor.d/home.rhlpyd.aop-projects.codejail-test.myproj-sandbox.bin.python

#include <tunables/global>

/home/rhlpyd/aop-projects/codejail-test/myproj-sandbox/bin/python {
    #include <abstractions/base>
    #include <abstractions/python>

    /home/rhlpyd/aop-projects/codejail-test/myproj-sandbox/** mr,
    # If you have code that the sandbox must be able to access, add lines
    # pointing to those directories:
    
    /home/rhlpyd/aop-projects/codejail-test/myproj-sandbox/lib/python2.7/site-packages/** r,

    /tmp/codejail-*/ rix,
    /tmp/codejail-*/** wrix,
}



--
Rahul



rahul pyd

unread,
Aug 17, 2015, 4:15:20 AM8/17/15
to edx-...@googlegroups.com
Adding to my last mail, the following are the commands I ran in 'myproj' env  that led to the error messages.

import codejail.jail_code
codejail.jail_code.configure('python', '/home/rhlpyd/aop-projects/codejail-test/myproj-sandbox/bin/python')
import codejail.safe_exec
codejail.safe_exec.safe_exec("import os\nos.system('ls /etc')", {})


--
Rahul
Reply all
Reply to author
Forward
0 new messages