- 1 What is VirtualBox
- 2 Installation
- 3 Configuration
- 3.1 Getting network in the guest machine to work
- 3.2 Getting USB to work in the guest machine
- 3.3 Installing Guest Additions
- 3.4 Sharing folders between the host and the guest
- 3.5 Getting audio to work in the guest machine
- 3.6 Setting up the RAM and Video Memory for the virtual PC
- 3.7 Setting up CDROM for the Virtual PC
- 3.8 Rebuilding vboxdrv module
- 3.9 Converting from VMware images
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 USB support and a RDP server.
- 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.
- 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 use pacman to install VirtualBox OSE:
# pacman -S 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
VirtualBox PUEL is available from the AUR.
Due to license restrictions, you must download the installer from Sun's website (see links below) and place it into the same directory as the PKGBUILD:
Download the remaining files from the AUR page, run makepkg, and then as root:
# pacman -U PACKAGE-NAME.pkg.tar.gz
(NOTE: The program generates a desktop entry located in applications -> system tools -> Innotek VirtualBox)
After the install add yourself to the vboxusers 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
Any time your kernel version changes due to upgrade, recompile, etc., you must also rebuild the virtualbox kernel module running "vbox_build_module". This binary will be located in one of the following locations: /sbin, /bin, or /usr/bin and must be executed as root. After rebuilding the module, don't forget to load it with: modprobe vboxdrv.
Install required QT libraries
Currently VirtualBox relies on qt3 to function. Ensure you have qt3 installed (it is not a dependency for some reason) by doing:
# pacman -S qt3
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 10.0.2.0, 10.0.3.0 on the second and so on...
Using host interface networking (the Arch way)
You are going to just edit these files and reboot:
Ready? Let's go!
bridge_br0="eth0" # Put any interfaces you need. BRIDGE_INTERFACES=(br0)
/etc/rc.conf (in your NETWORKING section, it must look like this):
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
- 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
- on boot:
KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660" KERNEL=="tun", OWNER="root", GROUP="vboxusers", MODE="0660"
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 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:
- 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.
(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" (without the "") 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.
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 :)
Converting from VMware images
# pacman -S qemu $ qemu-img convert image.vmdk image.bin $ VBoxManage convertdd image.bin image.vdi
This may not be needed anymore with recent virtualbox versions (to be confirmed)