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

--writable option for execute/run not working in spython #138

Closed
JayjeetAtGithub opened this issue Jun 26, 2019 · 6 comments · Fixed by #139
Closed

--writable option for execute/run not working in spython #138

JayjeetAtGithub opened this issue Jun 26, 2019 · 6 comments · Fixed by #139

Comments

@JayjeetAtGithub
Copy link

Expected Behavior

I have a sandbox debian/ built from debian.sif.

>>> from spython.main import Client as c
>>> c.execute('debian', 'touch /file', writable=True, sudo=True)
{'message': "touch: cannot touch '/file': Read-only file system\n", 'return_code': 1}

but on doing the same natively from terminal,

sudo singularity exec --writable debian touch /file

it works and the file gets created.

Actual Behavior

>>> c.execute('debian', 'touch /file', writable=True, sudo=True)

This step should work perfectly same like when done natively.

Steps to Reproduce

sudo singularity build --sandbox debian/ docker://debian:buster-slim

Then do the above mentioned steps.

Context

  • Operating System: Ubuntu 16.04
  • singularity version: 3.2.0
  • spython version: 0.0.71
  • python version: 3.7

Failure Logs

{'message': "touch: cannot touch '/file': Read-only file system\n", 'return_code': 1}

[14]+  Stopped                 python
@vsoch
Copy link
Member

vsoch commented Jun 26, 2019

Hey this definitely looks like a bug - is it okay if I fix it tomorrow morning (it's getting late on the east coast). Also - you wanted another argument added to the command (could you share that here too?) I'll do both at the same time.

@JayjeetAtGithub
Copy link
Author

Sure .Thanks a lot @vsoch. I wanted the --writable-tmpfs option that is present in run and exec commands of 3.2.0. This would help me create a non persistent r/w temp fs, to be used during runtime.

@vsoch
Copy link
Member

vsoch commented Jun 27, 2019

Did you do something special with overlaw for the first? I'm getting the same thing for the singularity on the command line and spython execute:

$ sudo singularity exec --writable busybox.sif touch /file
WARNING: While attempting to set up SIFOverlay: no SIF writable overlay partition found
touch: /file: Read-only file system

@vsoch
Copy link
Member

vsoch commented Jun 27, 2019

Ah ok, building the sandbox works without that message, I'll use that to debug.

@vsoch
Copy link
Member

vsoch commented Jun 27, 2019

Build:

client.build('docker://debian:buster-slim', 'debian', sandbox=True, sudo=True) 

successful build of a sandbox:

ls debian                                                                                               
bin/   dev/          etc/   lib/    media/  opt/   root/  sbin/         srv/  tmp/  var/
boot/  environment@  home/  lib64/  mnt/    proc/  run/   singularity@  sys/  usr/

Now issue touch command, two examples show getting just result, and getting return code too.

$ client.execute('debian', 'touch /file', writable=True, sudo=True)                                       
 []

$ client.execute('debian', 'touch /file', writable=True, sudo=True, return_result=True)                   
$ {'message': [], 'return_code': 0}

and each of shell, exec, and run has added an options list (optional) where you can add --writable-tmpfs:

client.execute('debian', 'touch /tmp/file',  options=['--writable-tmpfs'])

I'll open a PR for you to test shortly!

@JayjeetAtGithub
Copy link
Author

Thanks ! I am checking it locally.

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

Successfully merging a pull request may close this issue.

2 participants