VirtualBox PPA for Ubuntu

virtualbox_compI had been downloading and installing VirtualBox on my system. Today I found that there is an official PPA for VirtualBox with packages for many Ubuntu releases. Now I can safely stop watching out for newer releases of VirtualBox and depend on Synaptic to update me when one is available.

Follow the steps below to add the PPA to your system. The examples are for Ubuntu Trusty Tahr (14.04). Remember to replace the trusty to the correct Ubuntu distribution in the first command.

  • Add the PPA to your sources
    $ sudo sh -c 'echo "deb trusty contrib" >> /etc/apt/sources.list.d/virtualbox.list'
  • Import the key
    $ wget -q -O- | sudo apt-key add -
  • Update your repository
    $ sudo apt-get update
  • Install virtualbox
    $ sudo apt-get install virtualbox-4.3

Boot from USB on VirtualBox

virtualbox_compOne way to boot from USB on VirtualBox is to use the Plop boot manager. However, VirtualBox provides a CLI option to generate a vmdk disk to boot from USB flash drive. Here are the steps on Ubuntu:

  1. Check the device node of your USB using fdisk:
    $ sudo fdisk -lu
    //let's say it is /dev/sdc
  2. Generate VM disk linking to the USB:
    $ sudo VBoxManage internalcommands createrawvmdk -filename ~/VirtualBox\ VMs/usb.vmdk -rawdisk /dev/sdc
  3. Create a new VM (or use existing) and attach the usb.vmdk file as a disk (use choose existing disk option).
    NOTE: You need to be root or sudoer.
  4. Change the disk to IDE Primary Master. Note that you might need to change the type of other existing disks.
  5. Boot the VM.

If you want to remove and re-attach the vmdk or add it to a new VM you may hit the following error:

Virtual Box UUID {1a2b.........} does not match the value {d009...} 
stored in the media registry ('/home/username/.VirtualBox/VirtualBox.xml')

One workaround is to rename usb.vmdk to something else and use it again.

The correct way to remove the disk is:

$ sudo VBoxManage list hdds
UUID: d009cc0c-6608-4718-98d5-f3a1bd087296
Parent UUID: base
State: inaccessible
Type: normal (base)
Location: /home/username/VirtualBox VMs/usb.vmdk
Storage format: VMDK
Capacity: 0 MBytes
$ sudo VBoxManage closemedium disk d009cc0c-6608-4718-98d5-f3a1bd087296

Speed up Windows guest network on VirtualBox

virtualbox_compI had been using VMware Player for years to run my VMs on Ubuntu and publishing patches to build VMware on the latest Linux kernels. Recently I got interested in Oracle’s VirtualBox and tried installing Windows on it.

When I fired a VirtualBox Windows VM (unfortunately I need to use one due to unavoidable reasons) for the first time I noticed network delays. I was attending a remote call and the voices were choppy and broken on a high-speed network connection. I looked around for options to boost the speed. I noticed that by default VirtualBox set PCnet-FAST III as my network adapter. I googled and it seemed that the adapter needs to be changed after all. The options are Intel PRO 1000 or Paravirtualized Network (virtio-net) adapters.

Both the alternative classes of adapters need additional drivers installed on Windows. The driver should be installed on Windows after you enable the adapter so download them to the VM in order to install them. Here are the download links:

I am seeing faster network performance with these drivers indeed.

If you ever need to recompile the VirtualBox kernel drivers:

$ sudo /etc/init.d/vboxdrv setup

To install a VirtualBox extension pack:

$ sudo VBoxManage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-4.3.12-93733.vbox-extpack
//--replace is needed if you already have an earlier version installed

Vagrant: custom virtual environment

vagrant_compPreconfigured virtual machines always come in handy and save the pain and time of manually setting them up from scratch. Vagrant is a community based service that works like a repository of preconfigured virtual machines of diverse configuration. Need an Ubuntu 14.04 server with LAMP or a Red Hat server with chef configuration? Vagrant has those! Vagrant supports both VMware and VirtualBox VMs.

Whether you are a developer or a system administrator, Vagrant is always at your beck and call to create an isolated development environment or a dedicated server.

Here’s how easy it is to use Vagrant. It is multiplatform and supports Linux, Windows and Mac. Download Vagrant from its website (link below) and install it on you machine. You need to have either VMware or VirtualBox installed on your box to install VMs from Vagrant.

Initialize and start a 32-bit Precise VM:

$ vagrant init hashicorp/precise32
$ vagrant up

In case you are wondering how to get the container for precise32, you can search VMs and use the container that matches your needs. There are a number of criteria to filter the results. Find more community provided boxes (standard templates) here.

Vagrant is very flexible and has many options. Vagrant docs is the best place to get started.

Webpage: Vagrant

RemoteBox: remotely manage VirtualBox VMs

RemoteBox enables you to administer a VirtualBox installation and its guest virtual machines remotely. In other words, it closely resembles the VMware ESX client in functionality.

RemoteBox is the VMware ESX client for VirtualBox.

The best part is that you can install VirtualBox and multiple guests on a powerful remote server and use them from your local machine as if they are installed locally on your desktop or laptop. RemoteBox uses SOAP APIs exposed by VirtualBox to achieve this functionality. It also uses the RDP protocol to show the guest VM desktops. It’s features include:

  • Create and edit guests. Configure processor, display, input devices, audio, I/O ports, and shared folders.
  • Set the guest BIOS configuration including the BIOS image.
  • Set advanced options such as HPET, Page Fusion, Large Pages, CPU Hotplugging, CPU Throttling etc.
  • Attach USB devices and set USB device filters. Provision and attach storage including hard disks, CDs/DVDs and floppy disks.
  • Configure networking including host only networks with DHCP servers.
  • Supports guest snapshots.
  • Access the same guest from multiple machines.
  • Guests run in headless mode. View and interact with the guest’s display via RDP, including sound and clipboard.
  • GTK based interface that closely resembles the GUI of VirtualBox.
  • Multiplatform. Runs on Linux, Solaris, Mac OS X and various modern flavours of BSD.

To install RemoteBox on Ubuntu:

//Set up GetDeb repos
$ wget
$ sudo dpkg -i getdeb-repository_0.1-1~getdeb1_all.deb
$ wget -q -O- | sudo apt-key add -
//Install RemoteBox
$ sudo apt-get update
$ sudo apt-get install remotebox

Webpage: RemoteBox

VirtualBox Indicator

While we are at it, Ubuntu has a handy indicator to launch a specific VirtualBox VM named Virtualbox Indicator. It’s real handy when you have many of them. To install, run:

$ sudo add-apt-repository ppa:thebernmeister/ppa
$ sudo apt-get update
$ sudo apt-get install indicator-virtual-box

VirtualBoxes: get, run free OS images on VirtualBox

virtualbox_compVirtualBoxes is a repository of free VirtualBox (OVA) images of operating systems. The list of available images includes the major ones like Ubuntu, SuSE, Fedora and Archlinux among many other lesser known distros. Once you install VirtualBox on your system it becomes very easy to run or test any OS if you can just download the image from somewhere and start it with VirtualBox. This helps you avoid the installation of the OS from an installation media or ISO. Default installs come pre-configured to fetch other packages from their repositories.

Note that the repository contains images of free OS-es only.

Webpage: VirtualBoxes

Similar service: osboxes