VirtualBox on Linux Mint 21.1

Last edited on 2023-02-19 Tagged under  #virtualization   #mint   #linux 

VirtualBox enables a Linux user to host multiple guest operating systems as virtual machines. Useful for experimenting with different Linux distros and configurations!

In this HOWTO I install VirtualBox on a Linux Mint HOST and create a Linux Mint GUEST virtual machine.

Note: Another virtualization setup that I actually prefer is a combo of KVM + QEMU + libvirt. But sometimes developers offer pre-configured VirtualBox images of their projects, making use of VirtualBox a useful shortcut.

1. BIOS support

Confirm that virtualization support is enabled in your system BIOS. If so, the following commands will return some output:

  • for an Intel processor ...
$ grep --color vmx /proc/cpuinfo
  • for an AMD processor ...
$ grep --color svm /proc/cpuinfo

If there is no output, the processor might still be capable of virtualization, but the option is disabled. Check in the BIOS and enable it if available.

2. Install Virtualbox on HOST

Kernel modules for VirtualBox are built via Dynamic Kernel Module Support (DKMS). After installing VirtualBox below, the vbox modules should be auto-built and -loaded.

Install dkms and linux-headers ...

$ sudo apt update && sudo apt install dkms linux-headers-generic

Install VirtualBox ...

$ sudo apt install virtualbox virtualbox-qt virtualbox-guest-additions-iso virtualbox-dkms

Reload the current shell and confirm the new group has been added to the user's assigned groups ...

$ su - $USER
$ id

Or restart the machine.

3. Launch Virtualbox

Run ...

$ VirtualBox

Note: With the current release of VirtualBox, I immediately ran into the issue of it using a difficult-to-view colour scheme: light grey foreground text on a white background. Unlike other QT apps, VirtualBox is not respecting my system's GTK dark theme.

(Sort of) Fix: Start VirtualBox with a usable colour scheme (black text foreground/white background) ...

$ VirtualBox -style Fusion %U

4. Create GUEST

Default Machine Folder where Virtual Machine (VM) images are stored is ~/Virtualbox VMs. This can be modified in File->Preferences->General.

See the User Manual for creating a GUEST virtual machine. I download a Linux Mint install image ISO to create a new Mint GUEST.

5. Guest additions

Guest Additions is an ISO image file included in the VirtualBox package, and is installed inside the virtual machine GUEST after the operating system is installed. It enables extra features such as the ability to tweak display settings and add a shared folder between HOST and GUEST.

Launch the new Linux Mint GUEST.

Open a terminal on GUEST, refresh package listings, and install build packages ...

$ sudo apt update && sudo apt install dkms linux-headers-generic

In the Linux Mint GUEST window, load Devices->Insert Guest Additions CD Image ... and click Run.

Guest Additions

Assign your USERNAME to the vboxsf group ...

$ sudo adduser USERNAME vboxsf

Reboot GUEST.

6. Display

With the GUEST powered off, tweak display settings by going to Machine->Settings->Display to add more video memory and enable 3D acceleration.

Display settings

Display and resolution can be changed when running a graphical environment.

7. Shared folder

Create a shared folder on HOST. Make it accessible to GUEST virtual machines by going to Machine->Settings->Shared Folders. Click on Adds new shared folder, set the Folder Path, and select Auto-Mount.

Shared folder settings

8. SSH from HOST to GUEST

Host-only networking with Virtualbox was a big help getting this properly configured.

I want to SSH from my HOST to GUEST. Default configuration supplies GUEST with a NAT interface for internet access but no HOST<->GUEST connectivity.

A solution for local access is creating a host-only adapter.

8.1 On the HOST

In the Tools sidebar, click the Menu icon and select Network. Click Create and a new host-only network card - vboxnet0 - is configured with default address and DHCP Server enabled.

8.2 On the GUEST

Select the GUEST virtual machine and in Machine->Settings->Network click on Adapter 2, click on Enable Network Adapter and Attached to Host-only Adapter, and select vboxnet0.

Host-only Adapter settings

Start the GUEST.

Install the SSH server ...

$ sudo apt install openssh-server                                                         

Confirm the new interface has been created ...

$ ip a

There should now be 2 ethernet interfaces: enp0s3 and enp0s8 (actual numbers may differ). Host-only adapter interface is assigned an address (example: and GUEST can now be accessed via SSH from the HOST.

Thanks for reading! Read other posts?

» Next: #2. Open Lunar

« Previous: #1. Libre Space