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.

  • 1
    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
  • 12
    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
  • 2
    VirtualMachine-ception :D You have the danger of losing track of how many levels deep in virtual machines you are. That moment when you realise you just corrupted your physical hard disk instead of one of the nested virtual ones you were meant to be testing on :P – developerbmw May 19 '15 at 10:38
up vote 63 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.

  • 2
    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
  • 7
    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.

  • 1
    This should prove the viability of this. vinf.net/2010/02/25/… – Mike Soule Jul 19 '11 at 22:55
  • 1
    @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: google.co.uk/… – paradroid Jul 19 '11 at 23:17
  • 2
    You know that the term "inception" doesn't refer to the [thing within a thing] concept, right? – ekillaby Aug 16 '13 at 22:51
  • 7
    @countfloortiles: It's a reference to the film, of course. – paradroid Aug 17 '13 at 14:03
  • 1
    @paradroid you should have named "CompCeption" or "VirtuaCeption". – Mohd Abdul Mujib 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.

  • So were you able to run Vagrant on Ubuntu guest inside Windows host? – wisbucky Mar 21 '15 at 1:55
  • 2
    @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
  • 2
    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: vagrantup.com/docs/docker. The Vagrant box you're using will have to support that, though. – Brendan Jan 22 '16 at 13:16
  • @Brendan, unless you have to run specific 64bit programs, then using the docker container compared to running 32bit virtual box, is performance wise the same or is it? – serup Nov 22 '16 at 23:52

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.

  • 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 as 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
  • Regarding Windows virtualization... it seems to be possible, but (as of June 2016) only works with HyperV-on-HyperV, with "Windows Insider" OS builds, and on Intel hardware. From msdn.microsoft.com/en-us/virtualization/hyperv_on_windows/… – Mark Sep 13 '16 at 20:20

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.

  • 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
  • 1
    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

Detailed description of this process is on this page: https://wiki.openstack.org/wiki/XenServer/VirtualBox

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.

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, which are lightweight Operating Systems, so it should be possible.

Yes, it is possible, given that your computer is powerful enough to handle it.

On my machine (i7 4770S, 16GB RAM) I managed to get a VM-ception-ness level of 4.5 (the last one crashes half of the time).

I used VMware Player 12, because VirtualBox didn't like emulating VM-x, and it was reaaaally slower. Right now, I'm trying to make W2K work on XP, but VMware can't install, VirtualBox produces BSODs so I'm trying using QEMU.

See this screenshot (one of the most beautiful screenshots I've ever seen):

enter image description here

  • What new information does this answer provide? – Ramhound Nov 3 '16 at 0:50

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.