Note that any time your kernel version changes (due to upgrade, recompile, etc.) you must also rebuild the VirtualBox kernel module by running '''vbox_build_module''' as root. This binary will be located in one of the following locations: <tt>/sbin</tt>, <tt>/bin</tt>, or <tt>/usr/bin</tt>. After rebuilding the module, don't forget to load it with: <tt>modprobe vboxdrv</tt>

Note that any time your kernel version changes (due to upgrade, recompile, etc.) you must also rebuild the VirtualBox kernel module by running '''vbox_build_module''' as root. This binary will be located in one of the following locations: <tt>/sbin</tt>, <tt>/bin</tt>, or <tt>/usr/bin</tt>. After rebuilding the module, don't forget to load it with: <tt>modprobe vboxdrv</tt>

Module Rebuilds

Note that any time your kernel version changes (due to upgrade, recompile, etc.) you must also rebuild the VirtualBox kernel module by running vbox_build_module as root. This binary will be located in one of the following locations: /sbin, /bin, or /usr/bin. After rebuilding the module, don't forget to load it with: modprobe vboxdrv

Install required QT libraries

Currently, VirtualBox relies on qt3 for its graphical interface. If you require a GUI, ensure you have qt3 installed:

# pacman -S qt3

Configuration

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.

Keyboard and mouse between the host and the guest

To capture the keyboard and mouse, click the mouse inside the Virtual Machine display.
To uncapture, "Ctrl-Alt Delete".

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 10.0.2.0, 10.0.3.0 on the second and so on...

lo="lo 127.0.0.1"
eth0="eth0 up" # If you have more interfaces in the previous file, more lines like "if_number="if_number up" here.
br0="dhcp" # Maybe you have some static configuration... I use DHCP.
INTERFACES=(lo eth0 br0)

/etc/vbox/interfaces (you can set up more interfaces if you want. Sky is the limit!):

vbox0 your_user br0 # Be sure that your user is in the vboxusers group.

Reboot and enjoy!

NOTE: Remember to set up your virtual machine with proper network configuration.

NOTE: If you have any issue, make sure that you have the bridge-utils package installed.

Using host interface networking (generic)

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 -S bridge-utils uml_utilities

EDIT by Sp1d3rmxn

You also need to have the TUN module loaded...in 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.

EDIT by Dharivs

As said by Sp1d3rmxn, we must set these permissions, but, instead of using the

command, we can set them in /etc/udev/rules.d/60-vboxdrv.rules, which will set them

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 0.0.0.0 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)

(NOTE): If you get this errormessage (while doing VBoxAddIF vbox0 vboxuser br0): /usr/bin/VBoxAddIF: line 242: /var/run/VirtualBox/vboxnet: No such file or directory, you can create a symlink this way:

# ln -s /etc/rc.d/vboxnet /var/run/VirtualBox/vboxnet

Then run the commmand once more. Everything should now be OK.

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.

Remount /proc/bus/usb:

mount -o remount /proc/bus/usb/

Restart Virtualbox and 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 Devices -> 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 /media/cdrom
# sh /media/cdrom/VBoxLinuxAdditions.run

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)

Sharing folders between the host and the guest

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.

In a Windows guest, starting with VirtualBox 1.5.0, shared folders are browseable and are therefore visible in Windows Explorer. Open Windows Explorer and look for it under:

My Networking Places --> Entire Network --> VirtualBox Shared Folders

Alternatively, on the Windows command line, you can also use the following:

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.

Note: If no CDROM drive is detected, make sure the HAL daemon is running. To start it, run the following command as root:

# /etc/rc.d/hal start

Rebuilding vboxdrv module

For Virtualbox >= 1.6.0 use ABS for rebuild vboxdrv module or you can wait the maintainer update it :)