Difference between revisions of "VirtualBox"

From ArchWiki
Jump to: navigation, search
(Installing on host)
(dropping unneeded info)
Line 68: Line 68:
''vboxdrv'' and ''vboxnetflt'' should be in the MODULES=() section of your /etc/rc.conf
''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
==Arch Linux guests==
==Arch Linux guests==

Revision as of 14:04, 2 November 2011

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 (website: virtualbox.org; Wikipedia: VirtualBox) is a virtual PC emulator like VMware. 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 QT GUI interface, as well as headless and SDL command line tools for managing and running virtual machines. It includes guest additions for some guest operating systems, which integrate functions of the guest and host systems, including sharing files, the clipboard, video acceleration and a “seamless” window integration mode.

This article is about basic usage of VirtualBox, including running the Virtual Box software within an Arch host, and running an Arch guest inside a Virtual Box virtual machine. For information about special features, applications and other how-tos, 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 and virtualbox-source (which contain the modules and their respective source code 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

Guest additions disc

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 the guest additions onto guest systems.

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 kernel modules

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

Ensure that a version of linux-headers is installed corresponding to the running kernel, 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

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.

Guest additions package

# pacman -S virtualbox-archlinux-additions

Kernel modules

Manually load the Virtual Box modules with

# 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.

Synchronise guest date with host

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

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

See also

External links