From ArchWiki
Jump to navigation Jump to search

Template:I18n links start Template:I18n entry Template:I18n links end

What is VirtualBox

VirtualBox is a virtual pc emulator like vmware. It has many of the features vmware has, as well as some of its own.


VirtualBox has two editions: VirtualBox-ose and VirtualBox (Personal Use and Evaluation License (PUEL)


This is the open source version of VirtualBox that can be found in the community repository. It lacks some features like sharing folders between the host and the guest machine and USB support.

VirtualBox (PUEL)

This is the free for personal use version of VirtualBox it can be found in AUR, or you can download it from the Download section at VirtualBox's site The extra features are:

  • Remote Display Protocol (RDP) Server

This component implements a complete RDP server on top of the virtual hardware and allows users to connect to a virtual machine remotely using any RDP compatible client.

  • USB support

VirtualBox implements a virtual USB controller and supports passing through USB 1.1 and USB 2.0 devices to virtual machines.

  • USB over RDP

This is a combination of the RDP server and USB support allowing users to make USB devices available to virtual machines running remotely.

  • Shared Folders

With the use of Shared Folders, users can share directories on their host system with guest systems.

  • iSCSI initiator

VirtualBox contains a builtin iSCSI initiator making it possible to use iSCSI targets as virtual disks without the guest requiring support for iSCSI.


Now to install VirtualBox. There are two options: Installing the OSE version or the PUEL version.

Install VirtualBox OSE

To install VirtualBox OSE, you need to have the community repository uncommented in /etc/pacman.conf

# Add your preferred servers here, they will be used first
#Include = /etc/pacman.d/community


# Add your preferred servers here, they will be used first
Include = /etc/pacman.d/community

Now use pacman to install VirtualBox OSE:

pacman -Sy virtualbox-ose

(NOTE: The program generates desktop entry that can be located in applications -> system tools -> VirtualBox OSE)

This will select by default virtualbox-ose and virtualbox-modules packages. Then you need to add yourself to the virtualbox group:

gpasswd -a USERNAME vboxusers

(Note: You need to logout/login in order this change to take effect)

Then add vboxdrv to the modules section in /etc/rc.conf in order to make that module load when the pc boots. If you want to manually load the module type as root:

modprobe vboxdrv

Install VirtualBox PUEL

This is done easily since we have a nice pkgbuild in AUR done by piie.

Download the PKGBUILD, issue makepkg and then as root:

pacman -U NAME OF THE PACKAGE.pkg.tar.gz

(NOTE: The program generates desktop entry that can be located in applications -> system tools -> Innotek VirtualBox)

After the install add yourself to the virtualbox users group:

gpasswd -a USERNAME vboxusers

(Note: You need to logout/login in order this change to take effect)

Add vboxdrv to the MODULES array in /etc/rc.conf

Anytime your kernel version changes due to upgrade, recompile, etc., you will need to rebuild the virtualbox kernel module using "vbox_build_module". This binary will be located in one of the following locations: /sbin, /bin, or /usr/bin and must be executed with superuser priveleges. After rebuilding the module, don't forget to load it with: modprobe vboxdrv.


After we have installed VirtualBox on our system and added ourselves in the vboxusers group we can start configuring our system in order to make all the features of VirtualBox available to us.Create a new virtual machine using the wizard provided by the GUI and then click settings in order to edit the virtual machine settings.

Getting network in the guest machine to work

First let's get network working in the guest machine. Click the network tab. The not attached option means you'll have "Network cable unplugged or similar error in the guest computer.

Using NAT network

This is the simplest way to get network. Select NAT network and it should be ready to use. The NAT IP address on the first card is, on the second and so on...

Using host interface networking

This way is a bit harder, but it allows you to see the VirtualMachine as a "real" computer on your local network. You need to get bridge-utils

pacman -Sy bridge-utils
        • EDIT by Sp1d3rmxn ***

You also need to have the TUN module rc.conf add "tun" (without the quotes) to your MODULES section. For testing this out right now without rebooting you can load the module from the command line by "modprobe tun".

Then you MUST set these permissions otherwise you'll never get VBox to init the interface. The command is "chmod 666 /dev/net/tun" (without the quotes).

Now proceed with the rest as it's written below.

      • End of edit ****
        • EDIT by Dharivs ***

As said by Sp1d3rmxn, we must set these permissions, so we can set them in /etc/udev/rules.d/60-vboxdrv.rules, which must look like:

KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660" KERNEL=="tun", OWNER="root", GROUP="vboxusers", MODE="0660"

      • End of edit ****

1. Create a new bridge with this command:

brctl addbr br0

2. If you are not using DHCP, run ifconfig and note down the network configuration of your existing network interface (e.g. eth0), which we will need to copy to the bridge in a minute.

(NOTE: You will need this settings so make sure you don't lose them!!!!)

3. Switch your physical network adapter to "promiscuous" mode so that it will accept Ethernet frames for MAC addresses other than its own (replace eth0 with your network interface):

ifconfig eth0 promisc 

(NOTE: You will lose network connectivity on eth0 at this point.)

4. Add your network adapter to the bridge:

brctl addif br0 eth0

5. Transfer the network configuration previously used with your physical ethernet adapter to the new bridge. If you are using DHCP, this should work:

dhclient br0
      • EDIT by Sp1d3rmxn

use "dhcpcd -t 30 -h yourhostname br0 &" instead of the above

      • End of edit

Otherwise, run ifconfig br0 x.x.x.x netmask x.x.x.x and use the values that you noted down previously.

6. To create a permanent host interface called vbox0 (all host interfaces created in this way must be called vbox followed by a number) and add it to the network bridge created above, use the following command:

VBoxAddIF vbox0 vboxuser br0

Replace vboxuser with the name of the user who is supposed to be able to use the new interface.

(NOTE: VboxAddIF is located in /opt/VirtualBox-VERSION OF VIRTUALBOX/VBoxAddIF)

Alternatively, you can setup VirtualBox networking through your /etc/rc.conf to enable a bridged connection.

Getting USB to work in the guest machine

(Only available in the PUEL edition)

First in order to make usb available for use to the virtual machine you must add this line to your /etc/fstab

none			/proc/bus/usb	usbfs	devgid=85,devmode=664 	0	0

85 is is the id of the group which should be allowed to access USB-devices. Change it to the id of your vboxusers group. You can get the id by running

grep vboxusers /etc/group

If you don't mind a security hole change devmode from 664 to 666.

Then you need to reboot in order for the changes to take effect. After that click the USB tab in the settings of the virtual machine and select which devices are available to your pc on boot. If you wish your virtual machine to use device that you have just plugged in (assuming the virtual machine has booted already), go to the VirtualMachine screen go to devices -> USB Devises -> and select the device you wish to plug in the virtual pc.

Installing Guest Additions

The Guest Additions make the shared folders feature available, as well as better video (not 3D) and mouse drivers. You will have mouse integration, thus no need to release the mouse after using it in the guest and one can also enable a bidirectional clipboard.

After you booted the virtual machine, go to menu Devices->Install Guest Additions... Once you've clicked it, VirtualBox loads an ISO into the current CD-ROM, so you won't see anything happen yet ;)

Then do the following as root :

# mount /mnt/cdrom
# sh /mnt/cdrom/

It will build and install the kernel modules, install the Xorg drivers and create init scripts. It will most probably print out errors about init scripts and run levels and what not. Ignore them. You will find rc.vboxadd and rc.vboxvfs in /etc/rc.d (it also creates /etc/rc.d/rc.local which you can delete). To have the Guest Additions loaded at boot time, just add those to the DAEMONS array in /etc/rc.conf eg.

DAEMONS=(syslog-ng network netfs crond alsa rc.vboxadd rc.vboxvfs)

Note: if the "Installing the Virtualbox Guest Additions..." message is followed by multiple "Unable to determine your Linux distribution" errors, the rc.vboxadd and rc.vboxvfs files will not be not created. The workaround is to create the /etc/rc.d/rc.local file, and repeat the VBoxLinuxAdditions command.

# touch /etc/rc.d/rc.local
# sh /mnt/cdrom/
# rm /etc/rc.d/rc.local

Note: this is already fixed in the upcoming 1.5.4 version - Virtualbox installer now correctly handles Arch's config hierarchy.

Sharing folders between the host and the guest

(Only available in the PUEL edition)

In the settings of the virtual machine go to shared folders tab and add the folders you want to share.

  • NOTE: You need to install Guest Additions in order to use this feature.

Then to use the shared folders in a Windows guest, use the following command:

net use x: \\vboxsvr\sharename

While vboxsvr is a fixed name, replace "x:" with the drive letter that you want to use for the share, and sharename with the share name specified with VBoxManage.

In a Linux guest, use the following command:

mount -t vboxsf [-o OPTIONS] sharename mountpoint

Replace sharename with the share name specified with VBoxManage, and mountpoint with the path where you want the share to be mounted (e.g. /mnt/share). The usual mount rules apply, that is, create this directory first if it does not exist yet.

Beyond the standard options supplied by the mount command, the following are available: iocharset CHARSET to set the character set used for I/O operations (utf8 by default) and convertcp CHARSET to specify the character set used for the shared folder name (utf8 by default).

Getting audio to work in the guest machine

In the machine settings go to the audio tab and select alsa driver.

Setting up the RAM and Video Memory for the virtual PC

You can change the default values by going to settings -> general.

Setting up CDROM for the Virtual PC

You can change the default values by going to settings -> CD/DVD-ROM.

Check mount cd/dvd drive and select one of the following options.

Rebuilding vboxdrv module

After upgrading the kernel, this might be needed for VirtualBox to continue working. Run the following command as root to acheive this: