How to run a VirtualBox Linux nested inside a VirtualBox Windows running on Linux so you can ShareX a Linux desktop

Yes, you could use Wine, but for diehards, here's this. I used Linux Mint and Windows Ameliorated, but the same basic steps should work for other flavors.

You're going to want a good amount of RAM, disk space, and a fast CPU. I used 12Gb RAM for the outer VirtualBox and 8Gb RAM for the innermost, where I usually get by with around 4Gb for all kinds of virtual machines. You want the extra RAM so you never encounter swapping. I recommend something like 100 Gb hard drive for the outer, and 50 Gb for the inner. However, depending on your needs, you may want more or less than this. Note that you can't use less than 15.5 Gb for Linux Mint or it will refuse to install.

Here's how to do it:

1. Start in Linux. Use VirtualBox to create a new Windows virtual machine. Make a snapshot when you're done installing in case you bork things later, so you can return to the fresh install state as needed.

2. Once that is up and running, install ShareX as usual.

3. Stop the VM and use VBoxManage to run the following command in your base host, modifying the new VM. The toggle for this feature is disabled in the VirtualBox UI, but it works fine from the command line:

VBoxManage modifyvm <virtual machine name> --nested-hw-virt on

4. Start it up again. Disable any Windows hypervisors which will conflict with the VirtualBox you're about to install. Open a PowerShell session with elevated permissions. Run the following command:

Remove-WindowsFeature Hyper-V

5. If this doesn't work (it didn't work on Ameliorated Windows), run this instead:

DISM /Online /Disable-Feature:Microsoft-Hyper-V
PowerShell Disable-WindowsOptionalFeature -Online `
-FeatureName Microsoft-Hyper-V-Hypervisor -All
bcdedit /set hypervisorlaunchtype off

6. Reboot Windows to start from a blank slate. Use VirtualBox to create a new Linux virtual machine.

Note: When trying to install Linux Mint straight from the ISO, I encountered freezing issues (locked up the guest and host, had to hard-reboot the whole machine). This happened while installing, repeatedly. So I finally downloaded a complete VirtualBox LinuxMint image from osboxes.org, and used that instead, sidestepping the installation issue. However, I encountered the freezing issues before I discovered running the command in step #4 above. So you may be able to get through a normal installation just fine, but I haven't personally tested that yet.

7. Once the innermost VirtualBox is running (or even just installed), stop it and run this command again, but this time from within Windows:

C:\Program Files\Oracle\VirtualBox\VBoxManage modifyvm <virtual machine name> --nested-hw-virt on

Dunno why that worked for a machine that won't be nesting another, but doing that eliminated a few more random freezing issues and it all worked reliably after that.

Some resources I used:

Tips to launch VirtualBox nested virtualization

What are the credentials for virtual-machine image?

Here's a screenshot of Linux running Windows (with ShareX) running Linux:

Add a comment

Fields followed by * are mandatory

HTML code is displayed as text and web addresses are automatically converted.

Page top