From ArchWiki
Revision as of 19:06, 28 October 2011 by BlackEagle (talk | contribs) (Installing on host)
Jump to: navigation, search

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.

Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어

External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

VirtualBox is a virtual PC emulator like VMware. It has many of the features VMware has, as well as some of its own. It is in constant development and new features are implemented all the time. e.g. version 2.2 introduced OpenGL 3D acceleration support for Linux and Solaris guests. It has a nice GUI interface (Qt and/or SDL) or command line tools for managing virtual machines. Headless operation is also supported.

This article is about basic usage of VirtualBox with Arch, For information about other systems and additional features, see VirtualBox Extras.

Installing on host

The Template:Package Official package is the basic GPL licensed VirtualBox suite, found in the [community] repository.

Install the basic package:

# pacman -S virtualbox

as from virtualbox 4.1.4-3 and higher this will also install virtualbox-modules (which contain the modules for the stock archlinux kernel)

Optionally install QT (package: Template:Package Official) in order to use the graphical manager (VirtualBox command). This is not required for the simpler SDL-only GUI (VBoxSDL command) nor the VBoxHeadless command.

# pacman -S qt

Basic setup

Add the desired username to the vboxusers group. Everything may work fine without this step but shared folders and possibly some other optional stuff require it to work. The new group does not automatically apply to existing sessions; the user has to log in again or start a new environment with a command like "newgrp" or "sudo -u username -s".

# gpasswd -a USERNAME vboxusers

Virtual Box running on Linux uses its own kernel modules, including a mandatory one called vboxdrv. Lastly, the vboxdrv module must be loaded before virtual machines can run. It can be automatically loaded when Arch Linux starts up, or it can be loaded manually when necessary.

To load the VirtualBox driver at startup, edit Template:Filename and add Template:Codeline to the Template:Codeline array:

MODULES=(... vboxdrv)

To load the module manually:

# modprobe vboxdrv

To start the VirtualBox graphical manager:

# VirtualBox

For people running a custom linux kernel there is the possibility to build the modules for your specific version

The Arch Linux package includes a script called vboxbuild which builds Virtual Box's kernel modules, instead of the /etc/init.d/vboxdrv script mentioned in the manual.

To build the kernel modules, with root permissions:

# vboxbuild


The virtualbox package also suggests installing virtualbox-additions on the host (Arch Linux) running Virtual Box. It is a disc image that can be used to install additions onto guest systems.


Test booting a live disc

Click the 'New' button to create a new virtual environment. Name it appropriately and select Operating System type and version. Select base memory size (note: most operating systems will need at least 512MB to function properly). Create a new hard disk image (a hard disk image is a file that will contain the operating system's filesystem and files).

When the new image has been created, click 'Settings', then CD/DVD-ROM, check 'Mount CD/DVD Drive' then select an ISO image.


Rebuild the vboxdrv module

Note that any time your kernel version changes (due to an upgrade, recompile, etc.) you must also rebuild the VirtualBox kernel modules.

Ensure that linux-headers is still installed, and run the following command:

# vboxbuild

This will build the VirtualBox kernel modules for the currently running kernel; if you have just upgraded your kernel package, reboot before trying to rebuild your kernel modules.

To have vbox* modules built automatically from now on, put this line in rc.local: Template:File

This will check if vbox* modules need to be rebuilt on startup and invoke vboxbuild as necessary.

After rebuilding the module, do not forget to load it with

# modprobe vboxdrv

vboxdrv and vboxnetflt should be in the MODULES=() section of your /etc/rc.conf

If you are using an old virtualbox_bin package built from AUR, run:

# vbox_build_module

If you need to rebuild the Virtual Box Additions in a guest installation of Arch Linux, use this command:

# rc.d setup rc.vboxadd

Guest additions

The Guest Additions make the shared folders feature available, improve video card acceleration support, and enable bi-directional clipboard between the guest and host. Mouse integration is another feature, taking away the need of releasing the mouse after using it in the guest.

Arch Linux guests

Installing Arch under VirtualBox is straightforward, and additions should be installed through pacman (not through "Install Guest Additions" in VirtualBox, or a mounted ISO.) Follow these instructions after doing a basic install of the X-window system found on the Beginners' Guide.

Install the required package:

# pacman -Syu virtualbox-archlinux-additions

Load vbox modules:

# modprobe -a vboxguest vboxsf vboxvideo

Auto-start modules

To autostart these modules each time you boot, you can add the three modules above to the MODULES array in /etc/rc.conf.

MODULES(... vboxguest vboxsf vboxvideo)

Enable VboxClient-all:

The VBoxClient contain these services(/usr/bin/VBoxClient-all) (copy/paste...) :

 --clipboard        start the shared clipboard service
 --display          start the display management service
 --checkhostversion start the host version notifier service
 --seamless         start the seamless windows service

So you can Enable VBoxClient-all to start all these services.

If you are running something that launches /etc/xdg/autostart/vboxclient.desktop, such as GNOME, then you should be ready to go. If you use .xinitrc to launch things instead, you must add

VBoxClient-all &

to your .xinitrc before launching your WM.

You should now be all set, and all guest additions should work properly.

Sync between host date and guest:

To keep sync date add the following to the guest /etc/rc.conf in DAEMONS entry:

DAEMONS=(... vbox-service ...)

See also

External links