VirtualBox

From openSUSE

This article is under review!
The contents are currently being evaluated and edited by User: Mirokado. Others should not make major changes in the meantime. Thanks for the cooperation.
VirtualBox:
VirtualBox Installation - VirtualBox USB Support - Virtualbox Network Bridging
Geeko VirtualBox is a virtualization software package developed by Sun Microsystems (originally created by the German company Innotek GmbH):
  • supports 32-bit guest systems (and 64-bit guest systems if the host has suitable hardware support) - guest operating systems
  • runs on 32-bit or 64-bit Intel and AMD CPUs (the host system)

There are two editions - see editions for more details:

  • Open source edition named VirtualBox OSE
  • Closed source edition, distributed as a binary file, with some extra functionality

Tested on openSUSE Recommended articles Related articles

Contents


VirtualBox running an openSUSE session (openSUSE 10.3 illustrated)

Installation

Please see the VirtualBox installation page for more details about:

  • installation from openSUSE repositories (OSE edition)
  • installation from VirtualBox home page (OSE and binary editions)
  • post-installation actions

USB support


Network bridging


Guest Additions

A newly-created virtual machine can be used as-is, but for full integration with the host system it is necessary to install the Guest Additions. These offer the following:

  • seamless switching of focus between host and guest as the mouse cursor moves
  • better support for alternative host window (guest screen) sizes
  • support for shared folders

Details of the installation will depend on the guest system. Please see the Guest Additions section of the VirtualBox manual.

Guest Additions in an openSUSE guest

The following are prerequisites in the guest system for Guest Additions installation:

  • packages required for building kernel modules are installed
    • Base Development pattern (for C, C++, make)
    • kernel-source and kernel-syms packages

To install:

  • start the virtual machine and from menu Devices chose Install Guest Additions ...
  • acknowledge the resulting dialogs to download the Guest Additions software if necessary and mount the image
  • now in the guest system, run the installer as root (path depends on software version and architecture):
# /media/iso-image/VBoxLinuxAdditions-x86.run
  • the resulting output includes kernel "done" messages and instructions if a problem was encountered
  • restart the guest system and the Guest Additions should be active

Shared folders

Once Guest Additions are installed, it is possible to share folders between host and guests:

  • Start the virtual machine and from menu Devices choose Shared Folders ...
  • Click on the icon Add new shared folder at the top right of the dialog
  • In the window Shared folders choose which folders should be available in the guest

Details of adding shared folders in the guest will depend on the guest system. Please see the Shared Folders section of the VirtualBox manual.

Shared folders in an openSUSE guest

  • Now in the guest console as root type:
    # mount -t vboxsf host_folder_name guest_mount_point
    where host_folder_name is "Folder Name" from the Shared folders dialog and guest_mount_point is the folder in the guest where the shared data will appear.
  • You can also add the mount definition to /etc/fstab in the guest - for example:
installation         /mnt/installation    vboxsf     rw                    1 2
work                 /mnt/work            vboxsf     uid=fred,gid=users    1 2

Mount compatible disk

With the vdfuse command it is possible to mount a VirtualBox disk image on the host and use that to mount the embedded partitions.

Install the vdfuse package from the Virtualization:VirtualBox repository.

Alternatively you can follow the vfuse build instructions to use the latest version from VirtualBox.

With vfuse installed, as root mount the vdi disk and then each partition:

# vdfuse -f yourimage.vdi /mnt/vdi # mount -o loop /mnt/vdi/Partition1 /mnt/vdi-partition1

Copying virtual machines and disks

To copy a virtual machine, including its attached virtual disk(s), you export the machine and can then import it to the same or another host system. See the First steps, importing and exporting virtual machines section in the VirtualBox manual.

To copy a virtual disk, use the VirtualBox utility clonehd - see the Virtual storage, Cloning disk images section of the VirtualBox manual.

In either case the newly-created virtual disks have unique UUIDs. Depending on how the guest system is configured, it may be necessary to change it to recognise the new disk. For a linux guest system you may wish to modify /etc/fstab in the original system to use generic references to the disks - in this example the original /dev/disk/by-id entries are replaced:

/dev/sda1            swap                 swap       defaults              0 0
/dev/sda2            /                    ext3       acl,user_xattr        1 1
/dev/sda3            /home                ext3       acl,user_xattr        1 2

Similarly, the Mac addresses of network devices will be different on a newly-imported virtual machine, which may require some adjustment to the guest system. For an openSUSE guest, it will probably be necessary to edit (for example) the definition of eth0. Please read the man page for the ifup command. For current systems it is necessary to edit /etc/udev/rules.d/70-persistent-net.rules as root - in a newly-booted imported guest system update the Mac address in the eth0 definition (you can see this in the Devices --> Network Adapters dialog of the guest machine's window) and remove any spurious new entry with the same Mac address.


Manuals