Installing virtualbox plus GUI ubuntu 16.04

Problem

Had virtual box installed and was using it from the command line. The process of creating a new virtual machine using this approach proved difficult. Tools like vagrant make this process easier but I needed to share this image with a non vagrant user.

Solution

Installed the default version of virtualbox that comes with ubuntu 16.04.

When I tried installing the latest version of virtual box, I would get the following error when starting a newly defined image:


Failed to open a session for the virtual machine bandago.

The virtual machine 'vmImage' has terminated unexpectedly during startup with exit code 1 (0x1).

Result Code: NS_ERROR_FAILURE (0x80004005)
Component: MachineWrap
Interface: IMachine {85cd948e-a71f-4289-281e-0ca7ad48cd89}

The solution maybe to after installing virtualbox, additionally installing the following packages:

(I never got to test this though)

vde2

virtualbox-guest-additions-iso

virtualbox-qt

Solution

Install virtualbox and the above packages:


imela@whiscardz ~ $ sudo apt-get install virtualbox virtualbox-guest-additions-iso virtualbox-qt
Reading package lists... Done
Building dependency tree
Reading state information... Done
virtualbox is already the newest version (5.1.38-dfsg-0ubuntu1.16.04.2).
The following NEW packages will be installed:
virtualbox-guest-additions-iso virtualbox-qt
0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
Need to get 47.4 MB of archives.
After this operation, 87.4 MB of additional disk space will be used.
Do you want to continue? [Y/n]

Note: After defining a new vm, when it’s time to link the ISO, double click on the vm definition and then select the iso.

References

Creating a Virtual Machine

Installing Oracle VM VirtualBox and Extension Packs

Oracle Linux_Downloads

How to Install VirtualBox 5.2 on Ubuntu 16.04 LTS

Exporting and Importing Virtual Box Images

Problem

Needed to save a virtual box image to be shared with someone else

Solution

Using vboxmanage command line to export the image and then test importing the image.

Steps

  • First list the virtual box images available

imela@whiscardz$ vboxmanage list vms
"test_default_1549514247520_18667" {6e29d56a-6531-4274-9d91-c6719e9fdaf3}
  • Then export the image you want to a file

imela@whiscardz$ vboxmanage export test_default_1549514247520_18667 -o test_default_1549514247520_18667.ova

  • Then copy it to the machine that you want to import the image.
  • Finally import the image.

imela@whiscardz2$ vboxmanage import test_default_1549514247520_18667.ova
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

Potential Issues

When I tried exporting to a file name other than the name of the image, it failed and threw the error below (it could be the extention):


imela@whiscardz2$ vboxmanage export test_default_1549514247520_18667 --output otherFileName.ovf
0%...
Progress state: VBOX_E_IPRT_ERROR
VBoxManage: error: Appliance write failed
VBoxManage: error: RTVfsFsStrmAdd failed for 'otherFileName.ovf' (VERR_ALREADY_EXISTS)
VBoxManage: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component ApplianceWrap, interface IAppliance
VBoxManage: error: Context: "RTEXITCODE handleExportAppliance(HandlerArg*)" at line 1263 of file VBoxManageAppliance.cpp

References

How to export and import VirtualBox VM images?

VBoxManage registervm/unregistervm

Export to OVF

VBoxManage export

VBoxManage import