Page 1 of 1

virtualbox inside of a usb-bootable ubuntu...stuck

Posted: 26. Mar 2014, 20:00
by bigbad
Any help would be greatly appreciated - while I have been using virtualbox for years, it has mostly just been for simply creating new vms on my local computer - I have not tried to mess with bootable USBs running virtualbox before....

Anyways, long story short here is what I am trying to do, have tried, and where I am stuck:

What I want: I configured ubuntu on a physical machine to the way I want it, this includes a vm running in virtualbox inside the ubuntu host. So far so good. I then created an image of this working system. My goal is to be able to make the whole system boot off of a usb stick that can be given to non-technical people and they can plug it in and it will 'just work'.

first attempt: I dd'ed the .iso I created to an 8gb usb stick. I was able to boot to this stick no problem and performance was decent - the only problem is that when I try to start the VM it starts throwing errors like rc=VERR_DISK_FULL. I don't know much about the internal workings of virtualbox or virtualization in general, but I am assuming that it needs some space to write to that isn't available.

second attempt: Thinking that maybe if I made it so that the usb has persistence enabled that would solve the problem. I used the ubuntu startup disk utility and re-wrote my .iso to the usb stick but selected the option to allow writable space. When I went to boot this it took FOREVER to boot...I went home after an hour of waiting, sometime between then and the next morning it actually finished booting, no idea when. I was actually able to get the vm to boot at this point, but again the performance was absolutely pathetic - this doesn't seem like a working option.

third attempt: I tried the same as the second attempt but allowed for less space (1.5 gb instead of 4 gb) to be writable - the boot was slow (not as slow but still quite sluggish) and when attempting to boot the vm I am back to getting the VERR_DISK_FULL error.

If the vm needs space to write to during boot (I could be way off here) is there a way it can use the disk in the physical machine that the usb stick is plugged into? That space isn't being utilized and there is no reason why it can't be used if that is somehow an option. When I open the file manager I can see that disk and all the files on it and it shows up as /dev/sda1 when running `df -k`.

In an ideal world, the contents of the usb stick would be locked so that a user couldn't do too much damage to it and it would always reboot back into the same state - that way nobody could accidentally (or purposefully) add or remove software that would persist on the usb stick through a reboot.

Any advice on how I can get this usb stick to boot to ubuntu and be able to run a virtualbox machine without being so slow as to render it useless would be GREATLY appreciated - I am a little out of my element trying to figure this out and google hasn't been much help because every search I do gives me results about using virtualbox to boot the usb stick OS instead of running virtualbox from within the booted usb OS.

thanks!

Re: virtualbox inside of a usb-bootable ubuntu...stuck

Posted: 26. Mar 2014, 20:22
by loukingjr
you didn't mention what guest you wanted to run along with Ubuntu but it seems to me 8 GB is not enough.

Re: virtualbox inside of a usb-bootable ubuntu...stuck

Posted: 26. Mar 2014, 20:28
by bigbad
The guest will be Windows XP (don't worry, it is licensed), although (could be way wrong here) I would imagine that the same problem would occur for any guest OS, unless there is some drastic difference in how they boot up inside virtualbox.

Re: virtualbox inside of a usb-bootable ubuntu...stuck

Posted: 26. Mar 2014, 20:41
by loukingjr
bigbad wrote:The guest will be Windows XP (don't worry, it is licensed), although (could be way wrong here) I would imagine that the same problem would occur for any guest OS, unless there is some drastic difference in how they boot up inside virtualbox.
Even if you get things working on a larger USB stick, just because you have a license for XP that doesn't mean you can distribute it to others.

Re: virtualbox inside of a usb-bootable ubuntu...stuck

Posted: 26. Mar 2014, 20:46
by bigbad
maybe I am misunderstanding the licensing rules, but if I have - lets say - 7 XP licenses for my company, I can make 7 of these usb sticks for use within my company without breaking any rules/laws - none of this will be used by anybody outside of the company.

Re: virtualbox inside of a usb-bootable ubuntu...stuck

Posted: 27. Mar 2014, 12:14
by socratis
As far as I know, there is no VM in a read-only medium. Even if you create an immutable .vdi, which means it is reset every time you reboot your VM, there is a need for a differencing image, typically next to where the VM is located.

You're trying to create a live-USB stick, theoretically read-only. But you want to run VBox which needs write access at some point or another. If you could create a read-only distribution, where the /opt and /home reside in a read-write partition so that you can install VBox and your VMs, maybe that's the way to go.