Setup of Virtualbox on Linux

This article is a collection of helpful tips for using VirtualBox on linux. It discusses basic setup information and common problems that people have including getting USB cards to work, COM errors, permission problems, problems after upgrading kernels, and helpful command line tips. For those not familiar with VirtualBox it is a free virtualization program from Sun Microsystems available for many platforms that, on linux, will allow you to run windows and other linux distributions on one computer. This often helpful for apps like quicken and quickbooks that do not have decent linux counterparts (the last windows app for many people), and for testing websites with windows without having to do dual booting or using a different computer.

* Basic Installation Information

* Getting USB Cards to Work With VirtualBox on Linux

* VirtualBox Fails to Start After Kernel Upgrade

* Failed to Open VirtualBox COM Object Critical Error

* Slow Printing With Windows Guest

* Command Line Tips

Basic Installation Information

Installation is fairly simple on most platforms (linux, osx, windows, etc.). Go to the VirtualBox Downloads page and choose what you need. The install should go smoothly.

Getting USB Cards to Work With VirtualBox on Linux

One problem that many people have on linux is getting the USB cards recognized in VirtualBox. Starting the program as root will often help and if that works for you that is probably a fine solution. To fix it for your user account (or other users) you would do the following (adapt for whichever distribution you have – this is for red hat/fedora, but should apply to all):

1. Add a “USB” Group – Under the System Menu, go under Administration, and then choose Users and Groups. Click to add a new group and call it “usb”, then add yourself and/or any users you want to run VirtualBox to that group – also make note of the group #, you will need it for the next command.

2. Now go to a command line and edit /etc/fstab and add the following: sudo nano /etc/fstab add the following line to the end none /sys/bus/usb/drivers usbfs devgid=502,devmode=664 0 0 save, then do sudo mount -a (or just restart)

3. Insert your usb card and make sure it works within linux

4. Then start VirtualBox (Under Applications/System Tools)

5. Under the Machine Menu, choose settings and then click on the USB item on the left

6. Check the appropriate box to enable the USB controller

7. You should now be able to mount the usb device when you start your image (windows or otherwise).

8. If you want that particular usb card permanent, then within the usb tab (from above) click on the second item on the right “Add Filter From Device” – choose the name of the device and then this will automatically be mounted within your image if it is available each time.

VirtualBox Fails to Start After Kernel Upgrade

After a kernel upgrade VirtualBox will often fail to start. The fix is usually fairly straightforward and consists of typing the following two commands from the command line:
sudo yum install kernel-devel

sudo /etc/init.d/vboxdrv setup

Failed to Open VirtualBox COM Object – Critical Error

This error “Failed to Create the VirtualBox COM Object” can come about for many reasons. When you are running on linux this is usually a permissions issue that often comes out from having run VirtualBox as superuser a time or two. To fix it you can do the following commands from the terminal (also running the VirtualBox from the command line will tell you which file(s) are causing the problem).
cd ~

sudo chown -R myusername:mygroup ~/.Virtualbox


cd /tmp sudo -R /tmp/.vbox-yourusername-ipc

Slow Printing With Windows Guest

The default setup for running a windows guest is to use NAT for networking. This generally means that communication from your guest computer to your host is fairly slow. This often effects printing speeds, making them painfully slow. Previously you fixed this by doing a fairly complicated setup of bridges. As of the 2.1.x branches, however, you can simply select HFI for the networking type in the network setup screen for your host (within virtualbox). This will remedy the issue in most cases.

Command Line Tips

VirtualBox has a number of helpful command line tools which are particularly helpful if you are running headless servers. For the general user, however, setting up scripts to start a particular image instead of starting the program and the starting the image may be helpful. To accomplish this you can do the following:
From a terminal:

cd ~ nano

In this file add:

#!/bin/sh /usr/bin/VBoxManage startvm "imagename"

Close the file and make it executable:

chmod 755

Then if you want to do a launcher for it you can right click on the top bar in gnome and select “add to panel”, then choose “custom application launcher”, under command tell it /home/yourusername/

You may also like...