Categories
Linux VirtualBox

Enable Nested Virtualization for Ubuntu using VirtualBox on Windows

< 1 min read

There are many reasons you may want to enable nested virtualization. In my case, I want to install Minikube for running a single-node Kubernetes cluster in a virtual machine. For the example below, my host machine is running Windows 10 and VirtualBox 6.1. The guest OS has Ubuntu 20.04 installed.

Open a PowerShell prompt and change directories to your VirtualBox install folder. Note: the below path assumes VirtualBox is installed in the default location.

cd "C:\Program Files\Oracle\VirtualBox"

Run the below command which uses the VirtualBox CLI tools to enable nested virtualization. In the below example, the name of my VM is “Ubuntu Go”.

VBoxManage modifyvm "Ubuntu Go" --nested-hw-virt on

Nested virtualization should now be enabled and no longer greyed out in the VM settings.

Run the below command on your Linux guest to confirm virtualization is now supported:

grep -E --color 'vmx|svm' /proc/cpuinfo
Categories
Linux VirtualBox

Mounting VirtualBox Shared Folder in Ubuntu

2 min read

This how to guides you through the steps to setup a shared folder with your host OS and Ubuntu guest.

Prerequisites

There are a couple of prerequisites for this guide:

  • A folder for sharing created on the host
  • Guest Additions installed on guest

My host is Windows and I have created a folder C:\Shared.

Right click on your VM and go to Settings… or inside your running VM go to Devices > Shared Folders > Shared Folder Settings…

Add a new shared folder. At the Add Share window, choose your Folder Path. In Folder Name, type “Shared”. Uncheck Read-only and Auto-mount, check Make Permanent.

Open a terminal session in your VM. Create a “Shared” directory in your home.

mkdir ~/Shared

Mount the shared folder from the host to your ~/Shared guest directory.

sudo mount -t vboxsf Shared ~/Shared

You should now be able to access the share in your VM.

The mount created is just temporary. To make it permanent follow the below steps.

Add the following line to /etc/fstab – be sure to replace michael with your username.

Shared	/home/michael/Shared	vboxsf	defaults	0	0

Add the following line to /etc/modules.

vboxsf

Reboot the VM and verify your share on the guest is still linked with the host.