VirtualBox

VirtualBox is a software that allows the user to run a guest operating system inside of a host operating system, without having to reboot.

Terminology
Host operating system - the computer you are actually working on. (i.e. Gentoo Linux)

Guest operating system - the operating system you want to install or have installed within the VirtualBox emulation environment. (i.e. You want to use MS Windows from within your Gentoo Linux box.)

VirtualBox Guest Additions - drivers for the Guest Operating system. These drivers provide smoother operation with the Host operating system compared to the standard drivers installed by the Guest operating system.

Installation
You can choose between a source based package and a binary package. The binary version is available so 64bit no-multilib users can use VirtualBox, too. The binary package contains some extensions which are not available in the source package. To get identical functionality with the source package, emerge it with the extensions USE flag being enabled.

The qt4 USE flag controls installation of the graphical user interface (GUI) which is enabled by default.

Or

Windows Guests
Enable the additions USE flag when installing VirtualBox on the host system to get the ISO image which contains all necessary Windows guest drivers.

Linux Guests
If you want to run Gentoo as a guest system simply run the following command in the Gentoo guest system:

To enable the shared clipboard, display resizing, seamless mode and drag&drop make sure that the user running the X.org session belongs to the "vboxguest" group.

If you want to install other Linux distributions as guest system please refer either to the distribution's documentation on how to install the drivers needed by VirtualBox or consult the official VirtualBox documentation.

Running
Users will not be able to run and use VirtualBox if they are not a member of the "vboxguest" group.

Changes will not take effect until the user re-logins.

Load the required driver module from :

Optional modules:

Load the modules upon boot. If you are using OpenRC, edit :

If you are using systemd:

Usage
There are many options which can influence behavior and performance of your virtual machines. If you don't know what these options are doing, leave them to their defaults. You can even make your virtual machines unbootable when setting wrong options.

Here's a list of options that are safe to use:
 * Host I/O cache can safely be enabled for all virtual storage controllers.
 * In case your host system's CPU supports hardware virtualization, enable the 'VT-x/AMD-V' option. It can drastically increase performance of your virtual machines.

Performance problems; Microsoft Windows Guest

 * Do not enable APIC for Microsoft Windows guests! VirtualBox also has a bad habit of enabling this option at it's own will. The fix is to select the System Processor Driver (i.e. ACPI Uniprocessor PC) and manually upgrade (change) to the Advanced Configuration and Power Interface (ACPI) PC. Shutdown (not reboot), restart VirtualBox and ensure APIC is off, then boot the guest. As usual, always make a backup before playing with Windows.
 * Using a SATA controller, it is necessary to choose the right driver version from Intel's SATA drivers. Using a wrong version will cause performance problems along with blue screen errors! Refer to this post for a list of working SATA drivers.
 * Slow performance using SATA driver? Only use the SATA controller interface for the hard disk. Remove any CDROMs from the SATA controller and place them onto a IDE Controller.
 * When installing the VirtualBox Guest Additions into your Windows operating system, do not select to enable Direct3D (experimental) option as this will cause resizing problems and other anomalies. Also, you need to install the Guest Additions from Safe Mode.
 * Don't use the ICH9 chipset with Windows. It's still considered experimental. It can cause temporary freezes of the whole VM when used with Windows7. See this post for more informations.

Performance problems; Linux Guest

 * When running Gentoo as a guest system make sure you start the virtualbox-guest-additions init script during bootup.

Kernel driver not installed


This may occur after building a new kernel and causes an error message:


 * Kernel driver not installed (rc=-1908)


 * The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing


 * '/etc/init.d/vboxdrv setup'


 * as root. If it is available in your distribution, you should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary.

Solution: Rebuild the VirtualBox kernel modules with

You may need to restart your computer to validate the change.

External resources

 * vboxweb_rb - Web-based administration utility (Ruby)