Sun VirtualBox Notes

Russell Bateman
January 2013
last update:

The last time I installed VirtualBox, I did it on Mint 13.

    $ sudo bash
    $ cd /etc/apt/sources.list.d/
    $ vim oracle_vbox.list
        Insert "deb http://download.virtualbox.org/virtualbox/debian precise contrib" in this file!

Download contents of http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc to ~/Downloads.

    $ apt-key add /home/russ/Downloads/oracle_vbox.asc
    $ apt-get update
    $ apt-get install virtualbox-4.2


Experience setting up VirtualBox for a Windows VM

It's been about three years since I wrote an article on using Sun VirtualBox and I thought I'd update it here. I had trouble installing Windows 7 Professional 64-bit and also Windows XP (which I was trying to install as a last resort). For the trouble pictures, not exhaustive, see the set of four at the end of this page.

I had trouble with...

  • Getting Windows 7 install to admit I did have virtualization enabled in my BIOS; see the first image in the second set below.
  • Getting VirtualBox to find my CD-ROM drive; see first image of first set below.

Found CD drive...

Here's the layout summary for the new VM...

Here we are beginning the Windows 7 Installation...

...the installation continuing successfully.




Starting to launch the Windows installation: let's tell a lie and say that virtualization isn't enabled...


Installation starting, though doomed to failure...
What did I do differently when Windows installation actually started? Not sure, however, I carefully scrutinized the images above and ensure the settings were identical to the last time this worked.

The nastygram coming as a shock...

Window XP installation: my last-ditch effort. This may still be a CD problem...


Attempt to install Windows XP

This fails even after doing the CD as shown above (and below, which also describes what I did for Windows 7, but in greater detail):

Here's a Windows XP VM set up...

Having clicked on Storage in the last image, I click on the first little disk icon...

...which confirms I'm going to configure a CD; I choose to leave it empty...

...then I select it...

...click on the disk icon and choose my CD drive...

...and make it passthrough...

But, the final result is identical to the original one, i.e.: FATAL: No bootable medium found! System halted.


Getting Guest Additions to install

This is way more frustrating than it was a few years ago when I had so much success with VB.

The problem is that my Windows guest VM comes up with no outside window around it. It's in this window (see Conquering Sun VirtualBox for Dummies like Me) that the Devices menu appears to let you install the guest additions.

The moral of this story is not to go horsing around optimizing your guest OS window at least until you've at least installed the Guest Additions. The second time I installed, I was careful and did not have to do anything other than grab the menu at the top of the guest window Devices -> Install Guest Additions....

Instead, I had to download the guest additions ISO (see here) and then go through my (unlaunched) VM's Settings -> Storage > Controller: IDE, etc. to mount the ISO (that I downloaded) as a CD.

Then, I launched the Windows VM and opened the (now showing CD) in Windows File Explorer. It would not AUTORUN. Duh. And double-clicking AUTORUN only opend the file in NotePad. Double duh. So, to get it to install, I double-clicked VBoxWindowAdditions-amd64. It took a while to launch.

What's the mess here? Somewhere along the way, I either naively got rid of the outside VB window around my launched Windows guest VM or VM just sucks. I googled heavily, found others complaining also and no one offered a solution except to repeat "install guest additions by pressing HOST + D". One respondant even said, "...read the documentation. I can't improve on it." I was never able to get the VirtualBox window (parent) of my Windows 7 guest VM back which would have made installing guest additions easier.


Shared-folder joy

As soon as I got the guest additions installed on Windows, however, I immediately saw what I was looking for: a working, shared-folder relationship with my Lucid host. The first illustration is the VM settings for my Windows guest showing where I thought I'd be sharing a mount point. The second is what I see in Windows File Explorer, i.e.: an ISO I had intended to share (for purposes unrelated to this discussion). The third shows you where this is on my Lucid host.








Supplementary notes

I tried installing Ubuntu Precise Server on Linux Mint 13 under VirtualBox. A sore problem with getting help on this topic is understanding when respondees are talking about something to do or happening on the guest OS as compared to the OS hosting VirtualBox.

This went well, but I could not:

  1. Install Guest Additions.
  2. Use Ctrl key on guest.

More installing Guest Additions

Per https://forums.virtualbox.org/viewtopic.php?f=3&t=15679, I did this:

  1. apt-get install dkms build-essential linux-headers-generic
  2. thinking that this would allow the (Guest window) Devices -> Install Guest Additions... to work. It did not.

Ultimately, I was able to install the Guest Additions, but I did not note how. As I remember, I used the advanced packaging tool.

The best way to avoid trouble is not to jack with any of the settings, but just dismiss the alerts each time you start up.


Mounting host's optical drive (CD, DVD, etc.) in VM

How to mount what's in the host's CD, DVD, Bluray, etc. drive in the running virtual machine (VM):

  1. Open VirtualBox manager dialog (main window that lists all the VMs) if not open.

  2. Select the running VM.

  3. Click Settings (will be for this VM), then Storage.

  4. Click Controller: IDE → Empty; you should see something like this:

  5. Click to mark Live CD/DVD if not checked.

  6. Click disk icon (choose a virtual disk...) and choose the drive in the host running VirtualBox you wish to mount in the VM.

  7. Click OK.

At this point, you should hear the drive begin to whir, then see it mount on the VM's desktop.


I hid the VirtualBox menu in the VM and can't get it back

To save screen real estate, I hide menu bars, but now I don't know how to get it back.

  1. Open VirtualBox (main) dialog box.
  2. Select (running) virtual machine (VM) whose menu you want back.
  3. Click on Settings → User Interface.
  4. Click the Enable Menu Bar checkbox.

Look at the VM in the host; the menu should have reappeared.


Installing VM from ISO: no bootable medium found

Be sure that, under Settings → System for the VM, you do not mindlessly uncheck Optical thinking you don't need it because you will need it in support of the ISO during installation.


Installing guest additions on a headless-server VM

On a headless, Linux-server VM, installing VirtualBox Guest Additions isn't too straightforward. These commands are all run as root.

  1. In the top menu of the guest VM window, click Devices → Insert Guest Additions CD Image. This puts the (virtual) CD at your VM's disposal.
  2. Mount this CD. Before you can do that, you'll need to create a mount point if it's not already there (see first three commands). If you've done this before, it will still be there, but you'll have to (re)mount it—it doesn't survive reboots:
    # cd /media
    # mkdir cdrom
    # chmod 770 cdrom (or chmod u+rwx,g+rwx cdrom)
    # mount /dev/cdrom /media/cdrom
    mount: /media/cdrom: WARNING: device write-protected, mounted read-only.
    
  3. Install dependencies via the advanced packaging tool:
    # apt-get install -y dkms build-essential linux-headers-generic linux-headers-$(uname -r)
    
    If you've got trouble with your package manager (maybe a PPA that's hiding), you might get errors doing this, but they should not be fatal to the overall objective.
  4. Next, install the Guest Additions package:
    # cd /media/cdrom
    # ./VBoxLinuxAdditions.run
    

Mounting a shared folder on a headless-server VM

To mount the host's (shared) folder (VirtualBox Guest Additions must be present, installed and mounted). The mounted folder was designated in the VirtualBox GUI Settings → Shared Folders configuration. For instance, maybe you're running VirtualBox on Windows and sharing your Documents folder. Here's how to mount that on a headless, Linux server. These commands are all run as root.

  1. Create a mount point under /media.
    # cd /media
    # mkdir sf_Documents
    # chmod 770 Documents
    
  2. Fix up the vboxadd user to belong to group vboxsf:
    # adduser vboxadd vboxsf
    # groups vboxadd
    vboxadd : daemon vboxsf
    
  3. Mount the shared volume:
    # mount -t vboxsf Documents /media/sf_Documents
    /sbin/mount.vboxsf: mounting failed with the error: Protocol error
    
    This seems always to happen when the guest is headless. Fighting it for hours results in it working, but there appears no rhyme or reason for it to have failed in the first place and to begin working in the second. The last time I got it to work, this was the configuration:
    VirtualBox → Settings → Shared Folders → Name/Folder:
    dev/C:\Users\rbateman\dev
    # mount -t vboxsf dev /media/sf_dev
    

Enabling Intel VT-X on HP EliteDesk 800 American Megatrends, Inc. BIOS

Without Intell VT-X (or AMD-V), VirtualBox (nor VMware Workstation) can support 64-bit guest OSes.

I once got an HP EliteDesk 800 with i7 that came with VT-X disabled which I did not know until I ran VirtualBox to install a new VM ("ERROR: VT-X is not available"). I went into the BIOS, but could not find where to enable it and thought that this wasn't an available feature. Later, I found on an HP support site how to do this:

  1. Press Esc as the computer boots up to gain entry to the BIOS.
  2. Choose Computer Setup.
  3. Use the right-arrow key to reach the Security menu (!).
  4. Use the down-arrow to reach System Security.
  5. Enable VT-X.