Saving sws files in VirtualBox lab situation

282 views
Skip to first unread message

kcrisman

unread,
Jul 18, 2012, 3:11:54 PM7/18/12
to sage-s...@googlegroups.com
Here's a question about the VirtualBox solution for Volker or others.

How possible is the following lab scenario?

1. Student chooses a computer from a (nightly wiped) lab
2. Student logs on to computer
3. Student open a VirtualBox Sage that is already installed (on the propagated image in the lab), which automatically starts Sage (no " power on Sage-x.y.z by selecting it and clicking 'Start'." as on the SageAppliance wiki page)
4. Student puts in a flash drive, and easily surfs to their flash drive on the "Upload" page of the server (because "enable shared folders" instructions have been done ahead of time somehow)
5. Student works on their worksheet
6. Student downloads worksheet as sws, again to their flash drive (currently I don't see a way to choose where to download them, they just do to the default place)
7. Student ejects zip drive
8. Student leaves for dinner or checks FB or does whatever students do nowadays

In particular, I'm wondering whether

* having Sage open as soon as one open the VirtualBox, not having to choose it
* having the shared folder enabling done ahead of time, possibly universally
* having the files be easy to find

is possible.  /media/sf_<volume name>/filename seems forbidding...

Thanks, and my apologies if these questions are obvious from the SageAppliance documentation or ask.sagemath answers; I felt like this was subtly different, but maybe it's not.  What I'm hoping is that a little lab admin wizardry could make the VirtualBox solution nearly like having other programs to double-click.  Maybe there could even be a script that opened the VirtualBox with Sage at exactly 9:55 for a 10:00 class...

Thanks,
- kcrisman

Volker Braun

unread,
Jul 18, 2012, 3:40:41 PM7/18/12
to sage-s...@googlegroups.com
You can just run

   VBoxManage startvm "Sage-5.0"

from a script and it'll fire up that Virtual Machine.

Are the lab computers really scrubbed without any permanent storage for the students? This seems rather user-unfriendly. I've broken too many flash drives ;-)

You could run the gui user in the VM guest in a shared folder, and set up VirtualBox host to take the USB stick as the shared folder. But then you can't open the VM without the USB stick plugged, thats a pretty bad usability wart imho. We certainly can't make that the default in the VM that we offer on sagemath.org

I'm currently looking into writing some small gui to set up the VM and set up shared folders / save worksheets but its not there yet. 

What would really be useful would be a plugin architecture for the notebook that allows one to add  extra links to the sagenb pages and flask/python code as a backend. Then one could for example make an optional "cloud backup" spkg that would uploads everything to Google drive, say.

kcrisman

unread,
Jul 18, 2012, 11:05:33 PM7/18/12
to sage-s...@googlegroups.com


On Wednesday, July 18, 2012 3:40:41 PM UTC-4, Volker Braun wrote:
You can just run

   VBoxManage startvm "Sage-5.0"

from a script and it'll fire up that Virtual Machine.


Thanks.

I assume that it's not possible to have Sage start with just the one click from a pre-installed VM, at this time?  (Assuming we don't use Emil's solution of the self-installing Linux partition!)

Here's one user's comments:
++
1)  Fire up Virtual Box (only one click if there's an icon on the desktop, which I THINK we can have happen for everyone).
2)  Fire up Sage inside Virtual Box (only one click, I think).
3)  Be told that the mouse doesn't work anymore (even though it demonstrably does), and have to click "okay".
3)  Wait a LONG time (about 1.5 minutes) while lots of scary stuff is printed on the screen, including "Booting 'Fedora Linux", etc.  It's actually worse when there is a blank, black wondow, and nothing else is happening.  During that endless 90 seconds, I had to click "okay" three separate times when being told again that "mouse pointer integration" was not supported.
4)  now we have a normal Sage notebook screen (see attached screenshot1), whew.

++
Fine for personal use, but not so great for a lab.
 
Are the lab computers really scrubbed without any permanent storage for the students? This seems rather user-unfriendly. I've broken too many flash drives ;-)


I think it's more a security issue.  Students download all KINDS of stuff onto computers.  I'm sure others on this list would know more.
 
You could run the gui user in the VM guest in a shared folder, and set up VirtualBox host to take the USB stick as the shared folder. But then you can't open the VM without the USB stick plugged, thats a pretty bad usability wart imho. We certainly can't make that the default in the VM that we offer on sagemath.org


So you are saying that people currently would have to save their sws to this shared folder, then resave it/move it from there to somewhere else (like a USB drive) in the Windows file manager?  A little annoying.

 
I'm currently looking into writing some small gui to set up the VM and set up shared folders / save worksheets but its not there yet. 

Would be awesome, but does sound hard.

Thanks for the details! 

Dima Pasechnik

unread,
Jul 19, 2012, 4:59:07 AM7/19/12
to sage-s...@googlegroups.com
Maybe the VM can be built to contain Grive, a Linux client for Google Drive, and then students can save the stuff there, without fiddling with flash drives crap...

Volker Braun

unread,
Jul 19, 2012, 8:44:42 AM7/19/12
to sage-s...@googlegroups.com
This was what I was thinking, too, but we need a gui to run in the web browser to set up credentials. Which is why I'd really like a plugin system for the notebook. If the grive instructions include "log into the console and paste in some url that you copy from the web browser" then we might just as well tell people to use scp.

kcrisman

unread,
Jul 19, 2012, 9:37:34 AM7/19/12
to sage-s...@googlegroups.com


On Thursday, July 19, 2012 8:44:42 AM UTC-4, Volker Braun wrote:
This was what I was thinking, too, but we need a gui to run in the web browser to set up credentials. Which is why I'd really like a plugin system for the notebook. If the grive instructions include "log into the console and paste in some url that you copy from the web browser" then we might just as well tell people to use scp.



On Thursday, July 19, 2012 4:59:07 AM UTC-4, Dima Pasechnik wrote:
Maybe the VM can be built to contain Grive, a Linux client for Google Drive, and then students can save the stuff there, without fiddling with flash drives crap...



Perhaps, but of course different places/people will have different comfortability levels using the cloud, especially with Google.  And when one's not connected to the 'Net... 

Volker Braun

unread,
Jul 19, 2012, 10:00:38 AM7/19/12
to sage-s...@googlegroups.com
On Wednesday, July 18, 2012 11:05:33 PM UTC-4, kcrisman wrote:
I assume that it's not possible to have Sage start with just the one click from a pre-installed VM, at this time?

It should work. I haven't seen the pop-up dialogs that your user reports, it might be due to a version mismatch of VirtualBox. What is he using?

The boot-up time can be improved upon by starting from a saved machine snapshot instead of booting the whole VM. This also gets rid of intermittent black screens while booting etc.

I've taught Sage-based labs and just told people to run a script that rsync'ed a Sage install once to the local disc and then ran it from there. Of course you need lab computers with a real OS ;-)

So you are saying that people currently would have to save their sws to this shared folder, then resave it/move it from there to somewhere else (like a USB drive) in the Windows file manager?  

Or use the host web browser, connect to http://localhost:8000 and interact with the Sage server though that. Assuming that their Windows box networking isn't crippled by virus/antivirus/spambot/firewall software.



 

emil

unread,
Jul 20, 2012, 2:39:30 PM7/20/12
to sage-s...@googlegroups.com


On Thursday, July 19, 2012 5:05:33 AM UTC+2, kcrisman wrote:


On Wednesday, July 18, 2012 3:40:41 PM UTC-4, Volker Braun wrote:
You can just run

   VBoxManage startvm "Sage-5.0"

from a script and it'll fire up that Virtual Machine.


Thanks.

I assume that it's not possible to have Sage start with just the one click from a pre-installed VM, at this time?  (Assuming we don't use Emil's solution of the self-installing Linux partition!)

I am not into the details of building VMs and integrating them into Windows atm, but I think this would be possible with a similar command to Volkers "VBoxManage startvm". There is also the command "VBoxSDL", which will start the VM window without the VBox control window, and "VBoxHeadless", which will start the VM in the "background".

There could be a windows batch script that starts a sage vm (CLI only, running the server) in "headless mode", shows an appropriate message, waits for it to start up and then opens the windows default browser with the sage notebook. 

The mentioned "self installing Linux Partition" is unrelated to this topic, because this "Windows exe installer" of the Live CD OS would require the user to reboot the machine and startup Linux ( For completeness: it is not a linux partition but an automated "frugal install to NTFS", where the linux OS is inside a single file on the Windows partition (similar to the popular Ubuntu - WUBI install).

About the long startup time:
In reality it is not really necessary to have that, because lots of the time consuming stuff during bootup is not necessary when starting a linux in a fixed virtual environment. E.g. the whole hardware detection stuff could be minimized. Of course this would mean to use a customized boot script inside the initrd of the vm ...

greetings
emil

Dima Pasechnik

unread,
Jul 20, 2012, 2:46:06 PM7/20/12
to sage-s...@googlegroups.com
as this is about present day students, I cannot imagine them feeling any discomfort with the cloud...
And even if they do, creating a google account to store these files can be sold as a learning experience :)
 

kcrisman

unread,
Jul 20, 2012, 2:59:52 PM7/20/12
to sage-s...@googlegroups.com

Perhaps, but of course different places/people will have different comfortability levels using the cloud, especially with Google.  And when one's not connected to the 'Net... 

as this is about present day students, I cannot imagine them feeling any discomfort with the cloud...
And even if they do, creating a google account to store these files can be sold as a learning experience :)
 

Well, I'm not holding my breath.  But it's true that having a class cloud account for such things might be useful, even using DropBox or something... hmm. 

GaryMak

unread,
Apr 6, 2013, 7:10:20 AM4/6/13
to sage-s...@googlegroups.com
OK ... this is a very sad day ... I am finally going to have to admit publicly now that I cannot even follow the instructions at Section4 of http://wiki.sagemath.org/SageAppliance in order to get my VM to be able to see python scripts I download from the kind people in this GoogleGroup ... I attribute this to being born in the 1960's, and never having looked at a computer from the mid-eighties until recently ... but whatever the reason, typing this: (having put the file in the folder named "(dropbox/etcetcetc)/Auxiliary_files", restarted the machine etc etc)

load "/media/sf_Auxiliary_files/set_of_tuple_of_finite_field.py"

gets me this:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_5.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("bG9hZCAiL21lZGlhL3NmX0F1eGlsaWFyeV9maWxlcy9zZXRfb2ZfdHVwbGVfb2ZfZmluaXRlX2ZpZWxkLnB5Ig=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmp3BK76S/___code___.py", line 2, in <module>
    exec compile(u'sage.misc.preparser.load(sage.misc.preparser.base64.b64decode("Ii9tZWRpYS9zZl9BdXhpbGlhcnlfZmlsZXMvc2V0X29mX3R1cGxlX29mX2Zpbml0ZV9maWVsZC5weSI="),globals(),False)
  File "", line 1, in <module>
    
  File "/home/sage/sage-5.7/local/lib/python2.7/site-packages/sage/misc/preparser.py", line 1802, in load
    raise IOError('did not find file %r to load or attach' % filename)
IOError: did not find file '/media/sf_Auxiliary_files/set_of_tuple_of_finite_field.py' to load or attach

I assume it's not the usual windows-versus-Mac forward-slash-v-backslash nonsense, since you guys seem to have taken care of that in your parsers ...

In return for forcing someone out of pity to answer such an obviously (to you guys) dopy question, I hereby promise to re-write that help page slightly (once I know the answer) in terms even I can follow ...

thanks, as always ....

Volker Braun

unread,
Apr 6, 2013, 7:20:37 AM4/6/13
to sage-s...@googlegroups.com
Some of the docs are out of date (sorry, feel free to update the wiki as necessary) but the shared folder section should work. And does work for me. Whats the output of 

os.system('ls /media')
os.system('ls /media/sf_Auxiliary_files')

on your machine? You should get a list of files...

GaryMak

unread,
Apr 6, 2013, 10:50:50 AM4/6/13
to sage-s...@googlegroups.com
Hi - sorry for delay - thanks - I must have done something wrong - I get:

sf_Auxiliary_files
ls: cannot access /media/sf_Auxiliary_files: No such file or directory
512

GaryMak

unread,
Apr 6, 2013, 11:53:59 AM4/6/13
to sage-s...@googlegroups.com
slightly more helpfully: if I do each separately I get
sf_Auxiliary_files
0
and:
ls: cannot access /media/sf_Auxiliary_files: No such file or directory
512

Volker Braun

unread,
Apr 6, 2013, 12:16:44 PM4/6/13
to sage-s...@googlegroups.com
Strange, you do see the sf_Auxiliary_files but somehow it can't be accessed. It should have worked. Are you using a reasonably recent VirtualBox version (try Help->Check for updates)? To check permissions, what is the output of 

os.system('ls -alZ /media')

Finally, what is your host OS?

Also, I just re-read your original email and it said something about dropbox. Is the folder that you want to share a dropbox folder? That might be a problem for VirtualBox (I haven't tried, but possible). Can you try with a "normal" folder in your filesystem?

Gary McConnell

unread,
Apr 6, 2013, 1:00:16 PM4/6/13
to sage-s...@googlegroups.com
hi
I installed an upgrade of VM around about the time of Sage 5.8 release ...

the response to os.system('ls -alZ /media') is:
ls: cannot access /media/sf_Auxiliary_files: No such file or directory
drwxr-xr-x. root root system_u:object_r:mnt_t:s0       .
dr-xr-xr-x. root root system_u:object_r:root_t:s0      ..
?---------  ?    ?                                    
sf_Auxiliary_files
256

the host OS is "Windows 7 Home Premium" (2009)

and trying a non-Dropbox folder yields the same problems with your original things (os.system('ls /media') etc); only now there is an extra line to os.system('ls -alZ /media'), viz:

drwxr-xr-x. root root   system_u:object_r:mnt_t:s0       .
dr-xr-xr-x. root root   system_u:object_r:root_t:s0      ..
drwxrwx---. root vboxsf system_u:object_r:mnt_t:s0      
sf_Auxiliary_files
0

ie something has changed ...

Volker, I really appreciate the time you are putting into this but please don't worry any further - I'll wait a week or two until I'm "back with my Macs" and then hopefully do it the easy way ....

Thanks a lot

Kind regards

Gary


--
You received this message because you are subscribed to a topic in the Google Groups "sage-support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-support/Qz7PnD21X8o/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to sage-support...@googlegroups.com.
To post to this group, send email to sage-s...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Volker Braun

unread,
Apr 6, 2013, 2:45:30 PM4/6/13
to sage-s...@googlegroups.com, garym...@googlemail.com
Thats it, with the non-Dropbox folder everything is as expected. You should be able to load files from there.

It seems that the Dropbox filesystem is incompatible with VirtualBox shared folders. I'll add a note to the wiki to that extend.

GaryMak

unread,
Apr 7, 2013, 1:36:35 PM4/7/13
to sage-s...@googlegroups.com, garym...@googlemail.com
Hi Volker
just so you know, I just installed the latest VM version and it has the same problem
best regards
Gary
Reply all
Reply to author
Forward
0 new messages