Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to, say, run VirtualBox on Windows 7 with a Linux guest, and inside that Linux machine run Bochs?

The reason is that I'm interested in starting OS development, and I've found that all the tutorials and stuff are much easier to follow on *nix machines. I tried using Cygwin, but I think it's adding another layer of complexity and not necessarily making things easier.

share|improve this question
Dual booting is Linux and Windows is relatively easy to do, and the end result runs much more quickly. The only real downside being you have to reboot to switch OSes. – lyallcooper Jul 19 '11 at 20:44
@AUAnonymous: I know that, but I want to keep running Windows. – Javier Jul 19 '11 at 20:58
It's just always an option if you don't manage to get the VMs working or if they don't work too well. – lyallcooper Jul 19 '11 at 21:11
While you could do a great deal of work with this sort of setup, I strongly urge you to investigate Simics if you are going to be writing a serious kernel. The insight and debugging alone are priceless, however it is rather expensive. – Tim Post Jul 20 '11 at 3:11
I'm going to argue that this question is poorly titled. Bochs isn't virtualization software in the same sense as VirtualBox and VMWare. It is an emulator. It offers no CPU virtualization. The distinction here is not merely pedantic. You can expect an emulator like bochs to work inside a VM with fairly high confidence. Running a true virtualization software "nested" in a VM is a much trickier problem. For example, this feature was only implemented in VMWare as of Fusion 4. – superbatfish May 22 '13 at 22:03
up vote 48 down vote accepted

Long story short: yes.

Each virtual machine is technically "independent" of one another, and with VirtualBox, you could easily do this, since it is supported on both Windows and Linux host operating systems (emulated or not). You could simply use Windows as your "base-host" OS, run Linux in a VM, and then use that operating system as the new base-host for Bochs.

Do note that your only limitation here is your hardware. Depending on the requirements of your development, you may require more memory, or an upgrade to a 64-bit "base-host" operating system. That being said, if you choose your Linux distros wisely, any modern system should be capable of arbitrary nesting like this.

You will see improved performance if you enable x86 virtualization support on your computer (if your motherboard and CPU support it), and AFAIK, you can "pass through" this feature to multiple nested virtual machines. If we have n virtual machines nested in eachother, this is supported so long as the 1st to the n-1th nested guest OS has support for x86 virtualization (the base host must also support it). Do note that there are still some security issues to be aware of if you do this, so take the appropriate precautions.

share|improve this answer
It seems it actually works. After all, if I needed speed I wouldn't be using Bochs in the first place. While not the most upvoted, I feel your answer is the more complete and to the point, so I'll accept it. – Javier Jul 20 '11 at 4:16
Is it just me, or doesn't this answer seem to be about running multiple virtual machines, not nested ones? – Thomas Padron-McCarthy Jul 20 '11 at 6:41
@Thomas Padron-McCarthy, I was talking about nested ones. I modified the answer to be more explicit with this regard. – Breakthrough Jul 20 '11 at 10:21
Bochs is not the best test-case for this general question, since it is an emulator, not a VM. (See my comment on the OP.) – superbatfish May 22 '13 at 22:06

I sometimes run a whole VMware vSphere virtual infrastructure within VMware Workstation, along with virtual Cisco routers and switches and EMC Celerra Virtualized Storage Appliance, for self-learning and testing purposes.

I call it 'Inception Computing', and it can get pretty confusing. It is however somewhat cheaper than using the real gear.

share|improve this answer
This should prove the viability of this.… – Mike Soule Jul 19 '11 at 22:55
@Mike: Your link details running ESXi within ESX, but I have used some of the links, like TechHead, which is one of the main sites which got me into virtualisation in the first place. There is a lot of information on running a vSphere infrastructure within VMware Workstation as well:… – paradroid Jul 19 '11 at 23:17
You know that the term "inception" doesn't refer to the [thing within a thing] concept, right? – countfloortiles Aug 16 '13 at 22:51
@countfloortiles: It's a reference to the film, of course. – paradroid Aug 17 '13 at 14:03
@paradroid you should have named "CompCeption" or "VirtuaCeption". – 9kSoft Nov 5 '14 at 4:15

To anyone who reads this question, sees the accepted answer, and thinks this will apply to VirtualBox as well, please see comment from @superbatfish on the original question. He makes a good point about the difference between virtualization and emulation.

Specifically, "hardware assisted VM" will not be available in the "top-level" guest OS (that is, at the time of this writing, VirtualBox doesn't provide hardware VM in guest OSes). With VirtualBox, this means you can only create 32-bit "nested guest" OSes, even if the top-level guest is 64 bit and your "real" host has hardware VM.

May not be a showstopper for you, but it's worth noting. I needed this in order to run Vagrant on an Ubuntu guest inside Windows, for Chef cookbook testing.

share|improve this answer
So were you able to run Vagrant on Ubuntu guest inside Windows host? – wisbucky Mar 21 '15 at 1:55
@wisbucky yes, I could run it in 32-bit mode, but not 64-bit. Since all my production systems are 64-bit, it wasn't a perfect test but still worked well enough. – Toby J Mar 21 '15 at 17:02
Unless I'm mistaken you could now run 64-bit Vagrant boxes within the Ubuntu VM by using the Docker provider for Vagrant, since containers don't rely on hardware virtualisation: The Vagrant box you're using will have to support that, though. – Brendan Jan 22 at 13:16

Linux-KVM has some support for nested virtual machines. I've asked on the KVM IRC channel and have gotten the following information (but don't take my word, try it yourself):

  • AMD CPUs should work well, guests with Xen and Hyper-V are known to work,
  • Intel CPUs need the latest KVM Git source code, and only guests with KVM work

I haven't tried this myself yet. A search for "KVM nested" should give you enough info to try it yourself.

EDIT: KVM will run on a Linux host only. I haven't gotten any reliable info on Windows virtualization software concerning proper nested VM support. By 'proper' I mean that the hypervisor exposes virtualization extensions to the guest. You can always run a nested VM using a pure software hypervisor (e.g. dynamic translation), but that will be noticably slower.

EDIT: Bochs, which you mentioned, is a software-only hypervisor. This means that it will always be slow, and it's irrelevent if the hypervisor on the host exposes virtualization extensions to the guest (like KVM does). Most other virtualization softare (KVM, VirtualBox, VMWare) however can make use of those extensions and will perform much better if they are available.

share|improve this answer
To your second edit: So if I'm just going to be running Bochs (and I don't care too much if it's slow), do I need to worry about the KVM thing? – Javier Jul 19 '11 at 20:08
If you're running Bochs inside the virtual machine, it will be ass slow as if you ran it on hardware (assuming your hardware has virtualization extensions, i.e. AMD-v or VT-x and they are enabled in BIOS; otherwise it will be even slower, as will everything in the VM). – Ambroz Bizjak Jul 19 '11 at 22:15

Its possible, but not very feasible, especially for development. You should probably look at running Linux as your native OS, or getting a second box to host the VMs on.

share|improve this answer
I understand that it's likely to be complicated, but what exactly do you mean by "not very feasible"? – Javier Jul 19 '11 at 17:58
I would bet that @peelman means: "It is too slow for practical purposes." I haven't tried it myself. – CarlF Jul 19 '11 at 21:06
@carlf precisely. – peelman Jul 20 '11 at 4:11

Yes, you can run a virtual machine in a virtual machine. What I did was get a Windows 7 Ultimate x64 computer, run the same OS on the virtual machine, then run a 32 bit version (it couldn't handle 64 bit on the 3rd layer) on the 3rd layer. It was pretty laggy but i managed to get to the new york times on internet explorer with it. This may be difficult if you don't have a powerful computer, but you're running Linux and Bochs, so it should be possible.

share|improve this answer

Detailed description of this process is on this page:

In VirtualBox machine network cards you have to set allow all in Promiscuous Mode and several other options and you can have os inside vm e.g. Xenserver inside vm e.g. VirtualBox.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .