Virtulal box on Freenas ?

Status
Not open for further replies.

wookie

Dabbler
Joined
Mar 23, 2012
Messages
11
@wookie, stop taking this so personal.
It is OK I am not taking it personal. ;)

This is a thread on Virtualbox on FreeNAS?, not on what FreeNAS should be for people.

But it's breaking FreeNAS's primary purpose and there are other projects better suited for this very purpose.
Well I know it does not break the NAS. The NAS stuff was working happily along with my VM, even though my VM was not fully working with networking yet.
I know this because I tried it, and I offered a way for you to try it too, so you could come to your own conclusions, about the possibilities of installing virtualbox in the FreeNAS plugin jail. @see Hacking thread

This "achievement" lead me to believe that a PBI of virtualbox is not possible.
I could be wrong but I know loading kernel modules in jails cannot be done from within the jail, this is why I am sharing my achievement.
I want the possibilities to be considered.

I am also suggesting that if virtualbox was available as an option it would still not break its primary purpose as a NAS if you decided not to use virtualbox.
It would not take resources away from you other than a small embed filesize overhead if it was to exist.
If you decide to use it I would assume the user is knowing what they are doing for themselves, how much resources etc...
FreeNAS should not expect to support the users in their VM's. I don't think this is an issue anyway.

So I really don't think adding virtualbox to FreeNAS breaks anything with the "primary" purpose of FreeNAS, it just creates another whole heap of choices of what people can do with their hardware, running FreeNAS on the metal.

I think that is cool, so do others, this thread is about how to achieve that.
There maybe other systems out there, I am trying with FreeNAS because I like FreeNAS as a base system.

I hope I have offered a step forward. Can you contribute?
 

seer_tenedos

Dabbler
Joined
Sep 12, 2011
Messages
25
I have to say a working VirtualBox with networking is something i would like to see how ever it is done. I am just a home use not a company needing a pure NAS but i still want a great NAS that is easy to use and has ZFS. My NAS runs 24/7 so been able to run tasks on it that do not run in freenas would be great. In my case i have the extra CPU grunt needed and while i only have 8gb of ram i could easily add an extra 16-24gb if that was an issue. Don't get me wrong i love the jails and the plugin system and i think that is the ideal way for adding most things to freenas and if you could install a working freenas in a jail it would be prefect and my ideal solution.

As to why i would want virtualbox it is quite simple really, i develop different applications and systems for different environments and been able to have those environments on for a number of days at a time while i test would be ideal. They hardly do any processing or need much ram but the fact they run stable for a long period of time is an important test. I also have a few things i need to test on linux and windows and yes a separate box on 24/7 for this would be a better idea there is a cost overhead in both the box itself and power. Power prices here in Aus are becoming a joke. I have sucessfully run VM's that i require in about 256-512 ram each with virtually no effect to the host cpu wise.

All that said i like the idea of been able to add virtualbox but it should not be there by default. Maybe it could be a slightly different build or someone can fix the jail so it will work there?
 

wookie

Dabbler
Joined
Mar 23, 2012
Messages
11
The next steps

From what I understand is that the PBI plugins themselves install themselves in the plugin jail.
The plugins therefore are jailed. (correct me if I am wrong)

Applications in FreeBSD jails cannot change kernel settings of the host system from within the jail.

From: http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/jails-tuning.html
The root inside a jail may not load or unload devfs(8) rulesets, set firewall rules, or do many other administrative tasks which require modifications of in-kernel data, such as setting the securelevel of the kernel.

So I think this makes Virtualbox in a *magic* PBI plugin a show stopper because we need the kernel modules installed.
It is not going to work as a plugin. (correct me if I am wrong)

If I am correct we will need a build.
If we make a build we can see what the overhead truly means for the embedded system.
I honestly don't know. I have not tried it. It will be interesting to see what it is.
We will only know if we try. This is obviously the next step.

Once we have virtualbox available it would be nice to be able to control the VM's.
phpvirtualbox is the obvious choice? (correct me if I am wrong)

I do think we could still use the PBI plugin container to say install phpvirtualbox, this will give us a web gui to easily create and control VM's. This is another step.

phpvirtualbox uses the soap service provided by vboxwebsrv to control the VM's. This service needs to probably be started and stopped from the FreeNAS build. Having an on/off switch for this service from within the FreeNAS webgui would be desirable. This is another step.

I think that breaks the problem down into manageable chunks.
What do you think?
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
One possibility would be to have a GUI option in FreeNAS for adding kernel modules you need inside the jail, that way you'd might still be able to accomplish what you want with virtualbox inside the jail. It just depends on what you are trying to do inside the jail.

Can you give any specific example of something that won't work from inside the jail that *could* work if the modules or whatever were set outside the jail?
 

seer_tenedos

Dabbler
Joined
Sep 12, 2011
Messages
25
If we make a build we can see what the overhead truly means for the embedded system.
I honestly don't know. I have not tried it. It will be interesting to see what it is.
We will only know if we try. This is obviously the next step.

Once we have virtualbox available it would be nice to be able to control the VM's.
phpvirtualbox is the obvious choice? (correct me if I am wrong)

I do think we could still use the PBI plugin container to say install phpvirtualbox, this will give us a web gui to easily create and control VM's. This is another step.

phpvirtualbox uses the soap service provided by vboxwebsrv to control the VM's. This service needs to probably be started and stopped from the FreeNAS build. Having an on/off switch for this service from within the FreeNAS webgui would be desirable. This is another step.

I think that breaks the problem down into manageable chunks.
What do you think?

Seems about right to me. phpvirtualbox is by far the best way to manage a headless VirtualBox that i have found and is what i use even when running it on my desktop pc.
 

aaronb

Cadet
Joined
Jul 8, 2011
Messages
8
VirtualBox drivers...

Referencing:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/virtualization-host.html

It would appear that there are 2 basic kernel drivers that have to be loaded for Virtualbox to function.

The first is vboxdrv - won't even start without this loaded.
The second is vboxnetflt - the networking components for the guest.

There are some other parts like USB drivers that, while they may be nice, probably aren't that important for basic hosting functionality.

As far as I have read, neither of these drivers are loadable in the jail, so virtualbox as a jail won't work without them running in the host kernel. However, everything else I have read states that once they are running, jailed virtualbox works fine.
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Thanks Aaronb,

It shouldn't be that hard to add those drivers into /boot/kernel and then load them from the FreeNAS GUI. Then it may still be possible to run virtualbox from the plugin jail. With the FreeNAS jail it's not like you don't have access to the base system to add drivers or tweak sysctl.conf settings that may be need to run virtualbox in a jail. It's worth testing out before starting a campaign to add it to the core build of FreeNAS.
 

wookie

Dabbler
Joined
Mar 23, 2012
Messages
11
Can you give any specific example of something that won't work from inside the jail that *could* work if the modules or whatever were set outside the jail?

The specific example is so far virtualbox, you can set the vboxdrv.ko outside the jail this works, however the network drivers (vboxnetflt.ko and vboxnetadp.ko, ) cannot be loaded from outside because of a dependency conflict requiredof the host for netgraph. vboxnetadp.ko is dependent on vboxnetflt.ko. I am not sure if there are any others. That is as much as I know at the moment. I have not pursued it further.
 

wookie

Dabbler
Joined
Mar 23, 2012
Messages
11
Once the drivers are installed and working you need to expose the drivers to the jail; some devfs rules for the jail?
 

Onichan

Cadet
Joined
Jan 6, 2012
Messages
9
Has any progress been made on this? I too would love to have VirtualBox running on FreeNAS and really is the only thing it is missing for me.
 

Onichan

Cadet
Joined
Jan 6, 2012
Messages
9
Thanks for the update. Thought that was almost 6 months ago and I have already setup NAS4Free which supports VirtualBox. I do hope this gets implemented though to give the option of using FreeNAS if needed.
 
Status
Not open for further replies.
Top