VirtualBox/Gast-Erweiterung
VirtualBox-Gast-Erweiterung verbessern sie Integration in das Host-System
Beschreibung
Im vorherigen Kapitel wurden die ersten Schritte mit Oracle VM VirtualBox und die Installation von Betriebssystemen in einer virtuellen Maschine behandelt.
- Für jeden ernsthaften und interaktiven Einsatz machen die Oracle VM VirtualBox Guest Additions Ihr Leben viel einfacher, indem sie eine engere Integration zwischen Host und Gast ermöglichen und die interaktive Leistung von Gastsystemen verbessern.
- Dieses Kapitel beschreibt die Guest Additions im Detail.
- Funktionen
- Bessere Mauszeigerintegration
- Ordnerfreigaben vom Host zum Gast
- Grafikkartentreiber
- Nahtloser Fenstermodus ("seamless windows")
- Zeitsynchronisation
- Gemeinsame Zwischenablage (Copy & Paste)
- Drag'n'Drop
- Automatisierte Windows-Anmeldungen mittels VBoxGINA
Wie in Abschnitt 1.2, „Einige Terminologie“ , sind die Gasterweiterungen so konzipiert, dass sie in einer virtuellen Maschine installiert werden , nachdem das Gastbetriebssystem installiert wurde.
- Sie bestehen aus Gerätetreibern und Systemanwendungen, die das Gastbetriebssystem für bessere Leistung und Benutzerfreundlichkeit optimieren.
- Siehe Abschnitt 3.1, „Unterstützte Gastbetriebssysteme“ für Einzelheiten darüber, welche Gastbetriebssysteme mit Gasterweiterungen von Oracle VM VirtualBox vollständig unterstützt werden.
Die Oracle VM VirtualBox Guest Additions für alle unterstützten Gastbetriebssysteme werden als einzelne CD-ROM-Image-Datei mit dem Namen VBoxGuestAdditions.iso bereitgestellt
.
- Diese Image-Datei befindet sich im Installationsverzeichnis von Oracle VM VirtualBox.
- Um die Guest Additions für eine bestimmte VM zu installieren, mounten Sie diese ISO-Datei in Ihrer VM als virtuelle CD-ROM und installieren von dort aus.
Die Gasterweiterungen bieten die folgenden Funktionen:
- Mauszeiger-Integration
beschriebenen Einschränkungen für die Mausunterstützung zu überwinden Abschnitt 1.8.2, „Erfassen und Freigeben von Tastatur und Maus“ , bietet Ihnen diese Funktion nahtlose Mausunterstützung.
- Sie haben nur noch einen Mauszeiger und es ist nicht mehr erforderlich, die Host-Taste zu drücken, befreien die Maus von der Erfassung durch das Gastbetriebssystem
- Damit dies funktioniert, wird im Gast ein spezieller Maustreiber installiert, der mit dem physischen Maustreiber auf Ihrem Host kommuniziert und den Mauszeiger des Gasts entsprechend bewegt.
- Geteilte Ordner
Diese bieten eine einfache Möglichkeit, Dateien zwischen dem Host und dem Gast auszutauschen.
- Ähnlich wie bei gewöhnlichen Windows-Netzwerkfreigaben können Sie Oracle VM VirtualBox anweisen, ein bestimmtes Hostverzeichnis als freigegebenen Ordner zu behandeln, und Oracle VM VirtualBox stellt es dem Gastbetriebssystem als Netzwerkfreigabe zur Verfügung, unabhängig davon, ob der Gast tatsächlich eine hat Netzwerk.
- Siehe Abschnitt 4.3, „Freigegebene Ordner“ .
- Bessere Videounterstützung
Während die virtuelle Grafikkarte, die Oracle VM VirtualBox für jedes Gastbetriebssystem emuliert, alle grundlegenden Funktionen bietet, bieten Ihnen die benutzerdefinierten Videotreiber, die mit den Guest Additions installiert werden, extra hohe und nicht standardmäßige Videomodi sowie eine beschleunigte Videoleistung .
- Außerdem können Sie bei Windows-, Linux- und Oracle Solaris-Gästen die Größe des Fensters der virtuellen Maschine ändern, wenn die Guest Additions installiert sind.
- Die Videoauflösung im Gast wird automatisch angepasst, als ob Sie manuell eine beliebige Auflösung in den Anzeigeeinstellungen .
- Siehe Abschnitt 1.8.5, „Größe des Maschinenfensters ändern“ .
- Wenn die Guest Additions installiert sind, können 3D-Grafiken und 2D-Videos für Gastanwendungen beschleunigt werden.
- Siehe Abschnitt 4.5, „Hardwarebeschleunigte Grafik“ .
- Nahtlose Fenster
Mit dieser Funktion können die einzelnen Fenster, die auf dem Desktop der virtuellen Maschine angezeigt werden, auf dem Desktop des Hosts abgebildet werden, als ob die zugrunde liegende Anwendung tatsächlich auf dem Host ausgeführt würde.
- Siehe Abschnitt 4.6, „Seamless Windows“ .
- Generische Host/Gast-Kommunikationskanäle
Mit den Guest Additions können Sie die Gastausführung steuern und überwachen.
- Die Guest -Eigenschaften bieten einen generischen, auf Zeichenfolgen basierenden Mechanismus zum Austausch von Datenbits zwischen einem Guest und einem Host, von denen einige besondere Bedeutungen für die Steuerung und Überwachung des Guest haben.
- Siehe Abschnitt 4.7, „Gasteigenschaften“ .
- Zusätzlich können Anwendungen in einem Gast vom Host aus gestartet werden.
- Siehe Abschnitt 4.9, „Gaststeuerung von Anwendungen“ .
- Zeitsynchronization
Wenn die Guest Additions installiert sind, kann Oracle VM VirtualBox sicherstellen, dass die Systemzeit des Gasts besser mit der des Hosts synchronisiert wird.
- Aus verschiedenen Gründen kann die Zeit im Gast etwas anders laufen als die Zeit auf dem Host.
- Der Host könnte Updates über NTP erhalten und seine eigene Zeit könnte nicht linear laufen.
- Eine VM könnte auch pausiert werden, was den Zeitfluss im Gast für kürzere oder längere Zeit anhält.
- Wenn sich die Uhrzeit zwischen Gast und Gastgeber nur geringfügig unterscheidet, versucht der Zeitsynchronisierungsdienst, die Uhrzeit des Gasts schrittweise und reibungslos in kleinen Schritten anzupassen, um entweder Zeit aufzuholen oder Zeit zu verlieren.
- Wenn der Unterschied zu groß ist, z. B. wenn eine VM für Stunden angehalten oder aus dem gespeicherten Zustand wiederhergestellt wurde, wird die Gastzeit sofort geändert, ohne eine schrittweise Anpassung.
- Die Gasterweiterungen werden die Zeit regelmäßig neu synchronisieren.
- Siehe Abschnitt 9.11.3, „Anpassen der Zeitsynchronisierungsparameter von Guest Additions“ für die Konfiguration der Parameter des Zeitsynchronisierungsmechanismus.
- Gemeinsame Zwischenablage
Wenn die Guest Additions installiert sind, kann die Zwischenablage des Gastbetriebssystems optional mit Ihrem Host-Betriebssystem geteilt werden.
- Siehe Abschnitt 3.4, „Allgemeine Einstellungen“ .
- Automatisierte Anmeldungen
Wird auch als Credentials Passing bezeichnet.
- Siehe Abschnitt 9.1, „Automatisierte Gastanmeldungen“ .
Jede Version von Oracle VM VirtualBox, sogar Nebenversionen, wird mit einer eigenen Version der Guest Additions ausgeliefert.
- Während die Schnittstellen, über die der Kern von Oracle VM VirtualBox mit den Guest Additions kommuniziert, stabil gehalten werden, sodass Guest Additions, die bereits in einer VM installiert sind, weiterhin funktionieren sollten, wenn Oracle VM VirtualBox auf dem Host aktualisiert wird, wird für beste Ergebnisse empfohlen, sie beizubehalten die Gasterweiterungen in derselben Version.
Die Windows- und Linux-Gasterweiterungen prüfen daher automatisch, ob sie aktualisiert werden müssen.
- Wenn auf dem Host eine neuere Oracle VM VirtualBox-Version als die Guest Additions ausgeführt wird, wird im Gast eine Benachrichtigung mit weiteren Anweisungen angezeigt.
Um diese Updateprüfung für die Guest Additions einer bestimmten virtuellen Maschine zu deaktivieren, setzen Sie den Wert der Gasteigenschaft /VirtualBox/GuestAdd/CheckHostVersion
auf 0
.
- Siehe Abschnitt 4.7, „Gasteigenschaften“ .
2 Installing and Maintaining Guest Additions
Die Gasterweiterungen werden innerhalb der virtuellen Maschine installiert
- Nachdem das Gast-Betriebssystem fertig installiert worden ist.
Guest Additions sind für virtuelle Maschinen verfügbar, auf denen Windows, Linux, Oracle Solaris oder OS/2 ausgeführt wird. In den folgenden Abschnitten werden die Besonderheiten jeder Variante im Detail beschrieben.
2.1 Debian Host
# apt install build-essential # apt install linux-headers-$(uname -r)
[...]
# apt-get install virtualbox-guest-additions-iso
2.2 Debian Gast
2.3 Guest Additions for Linux
Wie die Windows Guest Additions sind die Oracle VM VirtualBox Guest Additions für Linux eine Reihe von Gerätetreibern und Systemanwendungen, die im Gastbetriebssystem installiert werden können.
Die folgenden Linux-Distributionen werden offiziell unterstützt:
- Oracle Linux ab Version 5, inklusive UEK-Kernel
- Fedora ab Fedora Core 4
- Red Hat Enterprise Linux ab Version 3
- SUSE und openSUSE Linux ab Version 9
- Ubuntu ab Version 5.10
Es ist bekannt, dass viele andere Distributionen mit den Guest Additions arbeiten.
Die in SUSE und openSUSE 10.2, Ubuntu 6.10 (alle Versionen) und Ubuntu 6.06 (Server-Edition) standardmäßig mitgelieferte Version des Linux-Kernels enthält einen Fehler, der zum Absturz beim Start führen kann, wenn es in einer virtuellen Maschine ausgeführt wird. Die Guest Additions funktionieren in diesen Distributionen.
Beachten Sie, dass einige Linux-Distributionen bereits alle oder einen Teil der Oracle VM VirtualBox Guest Additions enthalten. Sie können sich dafür entscheiden, die Version der Guest Additions der Distribution beizubehalten, aber diese sind oft nicht auf dem neuesten Stand und in ihrer Funktionalität eingeschränkt, daher empfehlen wir, sie durch die Guest Additions zu ersetzen, die mit Oracle VM VirtualBox geliefert werden. Das Oracle VM VirtualBox Linux Guest Additions-Installationsprogramm versucht, eine vorhandene Installation zu erkennen und zu ersetzen, aber je nachdem, wie die Distribution die Guest Additions integriert, kann dies einige manuelle Eingriffe erfordern. Es wird dringend empfohlen, vor dem Ersetzen vorinstallierter Guest Additions einen Snapshot der virtuellen Maschine zu erstellen.
Installing the Linux Guest Additions
Die Oracle VM VirtualBox Guest Additions für Linux werden auf derselben virtuellen CD-ROM-Datei bereitgestellt wie die Guest Additions für Windows. Siehe Abschnitt 4.2.1.1, „Installieren der Windows-Gasterweiterungen“ . Sie werden auch mit einem Installationsprogramm geliefert, das Sie durch den Einrichtungsprozess führt. Aufgrund der erheblichen Unterschiede zwischen Linux-Distributionen kann die Installation jedoch im Vergleich zu Windows etwas komplexer sein.
Die Installation umfasst im Allgemeinen die folgenden Schritte: # Bevor Sie die Guest Additions installieren, bereiten Sie Ihr Gastsystem für den Bau externer Kernel-Module vor. Dies funktioniert wie in Abschnitt 2.3.2, „Die Oracle VM VirtualBox-Kernel-Module“ , außer dass dieser Schritt in Ihrem Linux Gastsystem und nicht auf einem Linux-Hostsystem ausgeführt werden muss. Wenn Sie vermuten, dass etwas schief gelaufen ist, überprüfen Sie, ob Ihr Gast richtig eingerichtet ist, und führen Sie den folgenden Befehl als Root aus: rcvboxadd setup
- in
Legen Sie die CD-Datei VBoxGuestAdditions.iso
das virtuelle CD-ROM-Laufwerk Ihres Linux-Gasts ein, wie für einen Windows-Gast in Abschnitt 4.2.1.1, „Installieren der Windows-Gasterweiterungen“ . - Wechseln Sie in das Verzeichnis, in dem Ihr CD-ROM-Laufwerk gemountet ist, und führen Sie den folgenden Befehl als Root aus: sh ./VBoxLinuxAdditions.run
Graphics and Mouse Integration
In Linux- und Oracle Solaris-Gästen erfolgt die Grafik- und Mausintegration von Oracle VM VirtualBox über das X Window System. Oracle VM VirtualBox kann die X.Org-Variante des Systems oder XFree86 Version 4.3 verwenden, die mit der ersten X.Org-Version identisch ist. Während des Installationsvorgangs wird der X.Org-Anzeigeserver so eingerichtet, dass er die Grafik- und Maustreiber verwendet, die mit den Guest Additions geliefert werden.
Nach der Installation der Guest Additions in einer Neuinstallation einer unterstützten Linux-Distribution oder eines Oracle Solaris-Systems funktionieren auch viele nicht unterstützte Systeme ordnungsgemäß, der Grafikmodus des Gasts ändert sich bei der Größenänderung an die Größe des Oracle VM VirtualBox-Fensters auf dem Host . Sie können das Gastsystem auch bitten, auf eine bestimmte Auflösung umzuschalten, indem Sie mit dem VBoxManage- Tool einen Videomodus-Hinweis senden.
Mehrere Gastmonitore werden in Gästen unterstützt, die die X.Org-Serverversion 1.3 verwenden, die Teil von Version 7.3 des X Window-Systems Version 11 oder einer späteren Version ist. Das Layout der Gastbildschirme kann mit den Tools, die mit dem Gastbetriebssystem geliefert werden, nach Bedarf angepasst werden.
Wenn Sie mehr darüber erfahren möchten, wie die X.Org-Treiber eingerichtet werden, insbesondere wenn Sie sie in einer Einstellung verwenden möchten, die unser Installationsprogramm nicht richtig Abschnitt 9.3.2, „Gastgrafik und Maus Treiber-Setup im Detail“ .
Updating the Linux Guest Additions
Die Guest Additions können einfach aktualisiert werden, indem Sie den Installationsvorgang mit einem aktualisierten CD-ROM-Image erneut durchlaufen. Dadurch werden die Treiber durch aktualisierte Versionen ersetzt. Sie sollten nach dem Aktualisieren der Guest Additions neu starten.
Uninstalling the Linux Guest Additions
Wenn Sie eine Version der Guest Additions auf Ihrer virtuellen Maschine installiert haben und diese entfernen möchten, ohne neue zu installieren, können Sie dies tun, indem Sie das CD-Image der Guest Additions wie oben beschrieben in das virtuelle CD-ROM-Laufwerk einlegen. Führen Sie dann das Installationsprogramm für die aktuellen Guest Additions mit dem uninstall
-Parameter aus dem Pfad aus, in dem das CD-Image im Gast bereitgestellt wird, wie folgt:
sh ./VBoxLinuxAdditions.run deinstallieren
Während dies normalerweise ohne Probleme funktioniert, müssen Sie in einigen Fällen möglicherweise eine manuelle Bereinigung des Gasts durchführen, insbesondere der XFree86Config- oder xorg.conf-Datei. Insbesondere, wenn die installierte Additions-Version oder das Gastbetriebssystem sehr alt waren oder wenn Sie nach der Installation eigene Änderungen am Guest Additions-Setup vorgenommen haben.
Sie können die Additions wie folgt deinstallieren:
/opt/VBoxGuestAdditions- version /uninstall.sh
Ersetzen Sie /opt/VBoxGuestAdditions- version
durch das korrekte Installationsverzeichnis von Guest Additions.
Guest Additions for Windows
siehe VirtualBox:Gast-Erweiterung:Windows
Anwendungen
Fehlerbehebung
Syntax
Optionen
Parameter
Umgebungsvariablen
Exit-Status
Konfiguration
Dateien
Sicherheit
Dokumentation
RFC
Man-Pages
Info-Pages
Siehe auch
Links
Projekt-Homepage
Weblinks
Einzelnachweise
Testfragen
Testfrage 1
Testfrage 2
Testfrage 3
Testfrage 4
Testfrage 5
RHEL/CentOS
Install required packages for a guest addition compilation
# dnf install tar bzip2 kernel-devel-$(uname -r) kernel-headers perl gcc make elfutils-libelf-devel
Insert Virtualbox guest additions ISO image
NOTE Use the latest Virtualbox Guest addition CD image if possible. The ISO supplied with your VirtualBox may be outdated which might result in compilation errors.
Use the following link to download the latest Virtualbox Guest addition ISO image.
"Click on the Devices menu and select Insert Guest Additions CD image..."
Click on the Devices menu and select Insert Guest Additions CD image...
Compile and install Virtualbox guest additions
Once you insert the Virtualbox Guest addition ISO image the window may pop-up. You can hit the Run button to begin the installation.
"Begin the Virtualbox guest additions installation"
Begin the Virtualbox guest additions installation
However, I suggest to start the installation from the command line in order to get more verbose output from the installation process. This way it is easier to troubleshoot any possible issues you encounter.
"Mounted Virtualbox guest additions ISO location"
Mounted Virtualbox guest additions ISO location
To do so run the following command:
$ cd /run/media/`whoami`/VB*
Change to the root user and begin installation:
$ su # ./VBoxLinuxAdditions.run
if successful you should see the following output:
Installing additional modules ... VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules. This may take a while. VirtualBox Guest Additions: Running kernel modules will not be replaced until the system is restarted VirtualBox Guest Additions: Starting.
Reboot your system to enable the Virtualbox guest additions
Confirm that Virtualbox guest additions are installed and loaded
# lsmod | grep vbox
Manual
With the shared folders feature of Oracle VM VirtualBox, you can access files of your host system from within the guest system.
- This is similar to how you would use network shares in Windows networks, except that shared folders do not require networking, only the Guest Additions.
- Shared folders are supported with Windows 2000 or later, Linux, and Oracle Solaris guests.
- Oracle VM VirtualBox includes experimental support for Mac OS X and OS/2 guests.
Shared folders physically reside on the host and are then shared with the guest, which uses a special file system driver in the Guest Additions to talk to the host.
- For Windows guests, shared folders are implemented as a pseudo-network redirector.
- For Linux and Oracle Solaris guests, the Guest Additions provide a virtual file system.
To share a host folder with a virtual machine in Oracle VM VirtualBox, you must specify the path of the folder and choose a share name that the guest can use to access the shared folder.
- This happens on the host.
- In the guest you can then use the share name to connect to it and access files.
There are several ways in which shared folders can be set up for a virtual machine: * In the window of a running VM, you select Shared Folders from the Devices menu, or click on the folder icon on the status bar in the bottom right corner.
- If a VM is not currently running, you can configure shared folders in the virtual machine's Settings dialog.
- From the command line, you can create shared folders using VBoxManage, as follows: VBoxManage sharedfolder add "VM name" --name "sharename" --hostpath "C:\test"See Section 8.40, “VBoxManage sharedfolder”.
There are two types of shares: * Permanent shares, that are saved with the VM settings.
- Transient shares, that are added at runtime and disappear when the VM is powered off.
- These can be created using a check box in the VirtualBox Manager, or by using the --transient option of the VBoxManage sharedfolder add command.
Shared folders can either be read-write or read-only.
- This means that the guest is either allowed to both read and write, or just read files on the host.
- By default, shared folders are read-write.
- Read-only folders can be created using a check box in the VirtualBox Manager, or with the --readonly option of the VBoxManage sharedfolder add command.
Oracle VM VirtualBox shared folders also support symbolic links, also called symlinks, under the following conditions: * The host operating system must support symlinks.
- For example, a Mac OS X, Linux, or Oracle Solaris host is required.
- Currently only Linux and Oracle Solaris Guest Additions support symlinks.
- For security reasons the guest OS is not allowed to create symlinks by default.
- If you trust the guest OS to not abuse the functionality, you can enable creation of symlinks for a shared folder as follows: VBoxManage setextradata "VM name" VBoxInternal2/SharedFoldersEnableSymlinksCreate/sharename 1
Manual Mounting
You can mount the shared folder from inside a VM, in the same way as you would mount an ordinary network share: * In a Windows guest, shared folders are browseable and therefore visible in Windows Explorer.
- To attach the host's shared folder to your Windows guest, open Windows Explorer and look for the folder in My Networking Places, Entire Network, Oracle VM VirtualBox Shared Folders.
- By right-clicking on a shared folder and selecting Map Network Drive from the menu that pops up, you can assign a drive letter to that shared folder.
- Alternatively, on the Windows command line, use the following command: net use x: \\vboxsvr\sharenameWhile vboxsvr is a fixed name, note that vboxsrv would also work, 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 mountpointTo mount a shared folder during boot, add the following entry to /etc/fstab: sharename mountpoint vboxsf defaults 0 0
- In a Oracle Solaris guest, use the following command: mount -F vboxfs [-o OPTIONS] sharename mountpointReplace sharename, use a lowercase string, with the share name specified with VBoxManage or the VirtualBox Manager.
- Replace mountpoint with the path where you want the share to be mounted on the guest, such as /mnt/share.
- The usual mount rules apply.
- For example, create this directory first if it does not exist yet.
- Here is an example of mounting the shared folder for the user jack on Oracle Solaris: $ iduid=5000(jack) gid=1(other)$ mkdir /export/home/jack/mount$ pfexec mount -F vboxfs -o uid=5000,gid=1 jackshare /export/home/jack/mount$ cd ~/mount$ lssharedfile1.mp3 sharedfile2.txt$Beyond the standard options supplied by the mount command, the following are available: iocharset CHARSETThis option sets the character set used for I/O operations.
- Note that on Linux guests, if the iocharset option is not specified, then the Guest Additions driver will attempt to use the character set specified by the CONFIG_NLS_DEFAULT kernel option.
- If this option is not set either, then UTF-8 is used.
- convertcp CHARSETThis option specifies the character set used for the shared folder name.
- This is UTF-8 by default.
- The generic mount options, documented in the mount manual page, apply also.
- Especially useful are the options uid, gid and mode, as they can allow access by normal users in read/write mode, depending on the settings, even if root has mounted the filesystem.
- In an OS/2 guest, use the VBoxControl command to manage shared folders.
- For example: VBoxControl sharedfolder use D: MyShareNameVBoxControl sharedfolder unuse D:VBoxControl sharedfolder listAs with Windows guests, shared folders can also be accessed via UNC using \\VBoxSF\, \\VBoxSvr\ or \\VBoxSrv\ as the server name and the shared folder name as sharename.
Automatic Mounting
Oracle VM VirtualBox provides the option to mount shared folders automatically.
- When automatic mounting is enabled for a shared folder, the Guest Additions service will mount it for you automatically.
- For Windows or OS/2, a preferred drive letter can also be specified.
- For Linux or Oracle Solaris, a mount point directory can also be specified.
If a drive letter or mount point is not specified, or is in use already, an alternative location is found by the Guest Additions service.
- The service searches for an alternative location depending on the guest OS, as follows: * Windows and OS/2 guests. Search for a free drive letter, starting at Z:.
- If all drive letters are assigned, the folder is not mounted.
- Linux and Oracle Solaris guests. Folders are mounted under the /media directory.
- The folder name is normalized (no spaces, slashes or colons) and is prefixed with sf_.
- For example, if you have a shared folder called myfiles, it will appear as /media/sf_myfiles in the guest.
- The guest properties /VirtualBox/GuestAdd/SharedFolders/MountDir and the more generic /VirtualBox/GuestAdd/SharedFolders/MountPrefix can be used to override the automatic mount directory and prefix.
- See Section 4.7, “Guest Properties”.
Access to an automatically mounted shared folder is granted to everyone in a Windows guest, including the guest user.
- For Linux and Oracle Solaris guests, access is restricted to members of the group vboxsf and the root user.
Drag and Drop
Oracle VM VirtualBox enables you to drag and drop content from the host to the guest, and vice versa.
- For this to work the latest version of the Guest Additions must be installed on the guest.
Drag and drop transparently allows copying or opening files, directories, and even certain clipboard formats from one end to the other.
- For example, from the host to the guest or from the guest to the host.
- You then can perform drag and drop operations between the host and a VM, as it would be a native drag and drop operation on the host OS.
At the moment drag and drop is implemented for Windows-based and X-Windows-based systems, both on the host and guest side.
- As X-Windows supports many different drag and drop protocols only the most common one, XDND, is supported for now.
- Applications using other protocols, such as Motif or OffiX, will not be recognized by Oracle VM VirtualBox.
In the context of using drag and drop, the origin of the data is called the source.
- That is, where the actual data comes from and is specified.
- The destination specifies where the data from the source should go to.
- Transferring data from the source to the destination can be done in various ways, such as copying, moving, or linking.
- Note
At the moment only copying of data is supported.
- Moving or linking is not yet implemented.
When transferring data from the host to the guest OS, the host in this case is the source, whereas the guest OS is the destination.
- However, when transferring data from the guest OS to the host, the guest OS this time became the source and the host is the destination.
For security reasons drag and drop can be configured at runtime on a per-VM basis either using the Drag and Drop menu item in the Devices menu of the virtual machine, as shown below, or the VBoxManage command.
Figure 4.1. Drag and Drop Menu Options
"Drag and Drop Menu Options" |
The following drag and drop modes are available: * Disabled. Disables the drag and drop feature entirely.
- This is the default when creating a new VM.
- Host To Guest. Enables drag and drop operations from the host to the guest only.
- Guest To Host. Enables drag and drop operations from the guest to the host only.
- Bidirectional. Enables drag and drop operations in both directions: from the host to the guest, and from the guest to the host.
- Note
Drag and drop support depends on the frontend being used.
- At the moment, only the VirtualBox Manager frontend provides this functionality.
To use the VBoxManage command to control the current drag and drop mode, see Chapter 8, VBoxManage.
- The modifyvm and controlvm commands enable setting of a VM's current drag and drop mode from the command line.
Supported Formats
As Oracle VM VirtualBox can run on a variety of host operating systems and also supports a wide range of guests, certain data formats must be translated after transfer.
- This is so that the destination operating system, which receives the data, is able to handle them in an appropriate manner.
- Note
When dragging files no data conversion is done in any way.
- For example, when transferring a file from a Linux guest to a Windows host the Linux-specific line endings are not converted to Windows line endings.
The following formats are handled by the Oracle VM VirtualBox drag and drop service: * Plain text: From applications such as text editors, internet browsers and terminal windows.
- Files: From file managers such as Windows Explorer, Nautilus, and Finder.
- Directories: For directories, the same formats apply as for files.
Known Limitations
The following limitations are known for drag and drop:
On Windows hosts, dragging and dropping content between UAC-elevated (User Account Control) programs and non-UAC-elevated programs is not allowed.
- If you start Oracle VM VirtualBox with Administrator privileges then drag and drop will not work with Windows Explorer, which runs with regular user privileges by default.
On Linux hosts and guests, programs can query for drag and drop data while the drag operation is still in progress.
- For example, on LXDE using the PCManFM file manager.
- This currently is not supported.
- As a workaround, a different file manager, such as Nautilus, can be used instead.
Hardware-Accelerated Graphics
Hardware 3D Acceleration (OpenGL and Direct3D 8/9)
The Oracle VM VirtualBox Guest Additions contain experimental hardware 3D support for Windows, Linux, and Oracle Solaris guests.
With this feature, if an application inside your virtual machine uses 3D features through the OpenGL or Direct3D 8/9 programming interfaces, instead of emulating them in software, which would be slow, Oracle VM VirtualBox will attempt to use your host's 3D hardware.
- This works for all supported host platforms, provided that your host operating system can make use of your accelerated 3D hardware in the first place.
The 3D acceleration feature currently has the following preconditions: * It is only available for certain Windows, Linux, and Oracle Solaris guests.
- In particular:
- 3D acceleration with Windows guests requires Windows 2000 or later.
- Apart from on Windows 2000 guests, both OpenGL and Direct3D 8/9 are supported on an experimental basis.
- OpenGL on Linux requires kernel 2.6.27 or later, as well as X.org server version 1.5 or later.
- Ubuntu 10.10 and Fedora 14 have been tested and confirmed as working.
- OpenGL on Oracle Solaris guests requires X.org server version 1.5 or later.
- The Guest Additions must be installed.
- Note
For the basic Direct3D acceleration to work in a Windows Guest, Oracle VM VirtualBox needs to replace Windows system files in the virtual machine.
- As a result, the Guest Additions installation program offers Direct3D acceleration as an option that must be explicitly enabled.
- Also, you must install the Guest Additions in Safe Mode.
- This does not apply to the WDDM Direct3D video driver available for Windows Vista and later.
- See Chapter 14, Known Limitations for details.
- Because 3D support is still experimental at this time, it is disabled by default and must be manually enabled in the VM settings.
- See Section 3.6, “Display Settings”.
- Note
Untrusted guest systems should not be allowed to use the 3D acceleration features of Oracle VM VirtualBox, just as untrusted host software should not be allowed to use 3D acceleration.
- Drivers for 3D hardware are generally too complex to be made properly secure and any software which is allowed to access them may be able to compromise the operating system running them.
- In addition, enabling 3D acceleration gives the guest direct access to a large body of additional program code in the Oracle VM VirtualBox host process which it might conceivably be able to use to crash the virtual machine.
To enable Aero theme support, the Oracle VM VirtualBox WDDM video driver must be installed, which is available with the Guest Additions installation.
- The WDDM driver is not installed by default for Vista and Windows 7 guests and must be manually selected in the Guest Additions installer by clicking No in the Would You Like to Install Basic Direct3D Support dialog displayed when the Direct3D feature is selected.
The Aero theme is not enabled by default on Windows.
- See your Windows platform documentation for details of how to enable the Aero theme.
Technically, Oracle VM VirtualBox implements 3D acceleration by installing an additional hardware 3D driver inside the guest when the Guest Additions are installed.
- This driver acts as a hardware 3D driver and reports to the guest operating system that the virtual hardware is capable of 3D hardware acceleration.
- When an application in the guest then requests hardware acceleration through the OpenGL or Direct3D programming interfaces, these are sent to the host through a special communication tunnel implemented by Oracle VM VirtualBox.
- The host then performs the requested 3D operation using the host's programming interfaces.
Hardware 2D Video Acceleration for Windows Guests
The Oracle VM VirtualBox Guest Additions contain experimental hardware 2D video acceleration support for Windows guests.
With this feature, if an application such as a video player inside your Windows VM uses 2D video overlays to play a movie clip, then Oracle VM VirtualBox will attempt to use your host's video acceleration hardware instead of performing overlay stretching and color conversion in software, which would be slow.
- This currently works for Windows, Linux and Mac OS X host platforms, provided that your host operating system can make use of 2D video acceleration in the first place.
Hardware 2D video acceleration currently has the following preconditions: * Only available for Windows guests, running Windows XP or later.
- Guest Additions must be installed.
- Because 2D support is still experimental at this time, it is disabled by default and must be manually enabled in the VM settings.
- See Section 3.6, “Display Settings”.
Technically, Oracle VM VirtualBox implements this by exposing video overlay DirectDraw capabilities in the Guest Additions video driver.
- The driver sends all overlay commands to the host through a special communication tunnel implemented by Oracle VM VirtualBox.
- On the host side, OpenGL is then used to implement color space transformation and scaling.
Seamless Windows
With the seamless windows feature of Oracle VM VirtualBox, you can have the windows that are displayed within a virtual machine appear side by side next to the windows of your host.
- This feature is supported for the following guest operating systems, provided that the Guest Additions are installed: * Windows guests.
- Supported Linux or Oracle Solaris guests running the X Window System.
After seamless windows are enabled, Oracle VM VirtualBox suppresses the display of the desktop background of your guest, allowing you to run the windows of your guest operating system seamlessly next to the windows of your host.
Figure 4.2. Seamless Windows on a Host Desktop
"Seamless Windows on a Host Desktop" |
To enable seamless mode, after starting the virtual machine, press the Host key + L.
- The Host key is normally the right control key.
- This will enlarge the size of the VM's display to the size of your host screen and mask out the guest operating system's background.
- To disable seamless windows and go back to the normal VM display, press the Host key + L again.
Guest Properties
Oracle VM VirtualBox enables requests of some properties from a running guest, provided that the Oracle VM VirtualBox Guest Additions are installed and the VM is running. This provides the following advantages:
- A number of predefined VM characteristics are automatically maintained by Oracle VM VirtualBox and can be retrieved on the host.
- For example, to monitor VM performance and statistics.
- Arbitrary string data can be exchanged between guest and host.
- This works in both directions.
To accomplish this, Oracle VM VirtualBox establishes a private communication channel between the Oracle VM VirtualBox Guest Additions and the host, and software on both sides can use this channel to exchange string data for arbitrary purposes.
- Guest properties are simply string keys to which a value is attached.
- They can be set, or written to, by either the host and the guest.
- They can also be read from both sides.
In addition to establishing the general mechanism of reading and writing values, a set of predefined guest properties is automatically maintained by the Oracle VM VirtualBox Guest Additions to allow for retrieving interesting guest data such as the guest's exact operating system and service pack level, the installed version of the Guest Additions, users that are currently logged into the guest OS, network statistics and more.
- These predefined properties are all prefixed with /VirtualBox/ and organized into a hierarchical tree of keys.
Some of this runtime information is shown when you select Session Information Dialog from a virtual machine's Machine menu.
A more flexible way to use this channel is with the VBoxManage guestproperty command.
- See Section 8.31, “VBoxManage guestproperty”.
- For example, to have all the available guest properties for a given running VM listed with their respective values, use this command:
$ VBoxManage guestproperty enumerate "Windows Vista III" VirtualBox Command Line Management Interface Version version-number (C) 2005-2019 Oracle Corporation All rights reserved.
Name: /VirtualBox/GuestInfo/OS/Product, value: Windows Vista Business Edition, timestamp: 1229098278843087000, flags: Name: /VirtualBox/GuestInfo/OS/Release, value: 6.0.6001, timestamp: 1229098278950553000, flags: Name: /VirtualBox/GuestInfo/OS/ServicePack, value: 1, timestamp: 1229098279122627000, flags: Name: /VirtualBox/GuestAdd/InstallDir, value: C:/Program Files/Oracle/VirtualBox Guest Additions, timestamp: 1229098279269739000, flags: Name: /VirtualBox/GuestAdd/Revision, value: 40720, timestamp: 1229098279345664000, flags: Name: /VirtualBox/GuestAdd/Version, value: version-number, timestamp: 1229098279479515000, flags: Name: /VirtualBox/GuestAdd/Components/VBoxControl.exe, value: version-numberr40720, timestamp: 1229098279651731000, flags: Name: /VirtualBox/GuestAdd/Components/VBoxHook.dll, value: version-numberr40720, timestamp: 1229098279804835000, flags: Name: /VirtualBox/GuestAdd/Components/VBoxDisp.dll, value: version-numberr40720, timestamp: 1229098279880611000, flags: Name: /VirtualBox/GuestAdd/Components/VBoxMRXNP.dll, value: version-numberr40720, timestamp: 1229098279882618000, flags: Name: /VirtualBox/GuestAdd/Components/VBoxService.exe, value: version-numberr40720, timestamp: 1229098279883195000, flags: Name: /VirtualBox/GuestAdd/Components/VBoxTray.exe, value: version-numberr40720, timestamp: 1229098279885027000, flags: Name: /VirtualBox/GuestAdd/Components/VBoxGuest.sys, value: version-numberr40720, timestamp: 1229098279886838000, flags: Name: /VirtualBox/GuestAdd/Components/VBoxMouse.sys, value: version-numberr40720, timestamp: 1229098279890600000, flags: Name: /VirtualBox/GuestAdd/Components/VBoxSF.sys, value: version-numberr40720, timestamp: 1229098279893056000, flags: Name: /VirtualBox/GuestAdd/Components/VBoxVideo.sys, value: version-numberr40720, timestamp: 1229098279895767000, flags: Name: /VirtualBox/GuestInfo/OS/LoggedInUsers, value: 1, timestamp: 1229099826317660000, flags: Name: /VirtualBox/GuestInfo/OS/NoLoggedInUsers, value: false, timestamp: 1229098455580553000, flags: Name: /VirtualBox/GuestInfo/Net/Count, value: 1, timestamp: 1229099826299785000, flags: Name: /VirtualBox/HostInfo/GUI/LanguageID, value: C, timestamp: 1229098151272771000, flags: Name: /VirtualBox/GuestInfo/Net/0/V4/IP, value: 192.168.2.102, timestamp: 1229099826300088000, flags: Name: /VirtualBox/GuestInfo/Net/0/V4/Broadcast, value: 255.255.255.255, timestamp: 1229099826300220000, flags: Name: /VirtualBox/GuestInfo/Net/0/V4/Netmask, value: 255.255.255.0, timestamp: 1229099826300350000, flags: Name: /VirtualBox/GuestInfo/Net/0/Status, value: Up, timestamp: 1229099826300524000, flags: Name: /VirtualBox/GuestInfo/OS/LoggedInUsersList, value: username, timestamp: 1229099826317386000, flags:
To query the value of a single property, use the get subcommand as follows:
$ VBoxManage guestproperty get "Windows Vista III" "/VirtualBox/GuestInfo/OS/Product" VirtualBox Command Line Management Interface Version version-number (C) 2005-2019 Oracle Corporation All rights reserved.
Value: Windows Vista Business Edition
To add or change guest properties from the guest, use the tool VBoxControl.
- This tool is included in the Guest Additions.
- When started from a Linux guest, this tool requires root privileges for security reasons.
$ sudo VBoxControl guestproperty enumerate VirtualBox Guest Additions Command Line Management Interface Version version-number (C) 2005-2019 Oracle Corporation All rights reserved.
Name: /VirtualBox/GuestInfo/OS/Release, value: 2.6.28-18-generic, timestamp: 1265813265835667000, flags: <NULL> Name: /VirtualBox/GuestInfo/OS/Version, value: #59-Ubuntu SMP Thu Jan 28 01:23:03 UTC 2010, timestamp: 1265813265836305000, flags: <NULL> ...
For more complex needs, you can use the Oracle VM VirtualBox programming interfaces.
Using Guest Properties to Wait on VM Events
The properties /VirtualBox/HostInfo/VBoxVer, /VirtualBox/HostInfo/VBoxVerExt or /VirtualBox/HostInfo/VBoxRev can be waited on to detect that the VM state was restored from saved state or snapshot:
$ VBoxControl guestproperty wait /VirtualBox/HostInfo/VBoxVer
Similarly the /VirtualBox/HostInfo/ResumeCounter can be used to detect that a VM was resumed from the paused state or saved state.
Guest Control File Manager
The Guest Control File Manager is a feature of the Guest Additions that enables easy copying and moving of files between a guest and the host system.
- Other file management operations provide support to create new folders and to rename or delete files.
Figure 4.3. Guest Control File Manager
"Guest Control File Manager" |
The Guest Control File Manager works by mounting the host file system.
- Guest users must authenticate and create a guest session before they can transfer files.
Using the Guest Control File Manager
The following steps describe how to use the Guest Control File Manager. # Open the Guest Control File Manager.
- In the guest VM, select Machine, File Manager.
- The left pane shows the files on the host system.
- Create a guest session.
- At the bottom of the Guest Control File Manager, enter authentication credentials for a user on the guest system.
- Click Create Session.
- The contents of the guest VM file system appears in the right pane of the Guest Control File Manager.
- Transfer files between the guest and the host system by using the move and copy file transfer icons.
- You can copy and move files from a guest to the host system or from the host system to the guest.
- Close the Guest Control File Manager.
- Click Close to end the guest session.
Guest Control of Applications
The Guest Additions enable starting of applications inside a guest VM from the host system.
- This feature can be used to automate deployment of software within the guest.
For this to work, the application needs to be installed on the guest.
- No additional software needs to be installed on the host.
- Additionally, text mode output to stdout and stderr can be shown on the host for further processing.
- There are options to specify user credentials and a timeout value, in milliseconds, to limit the time the application is able to run.
The Guest Additions for Windows allow for automatic updating.
- This applies for already installed Guest Additions versions.
- Also, copying files from host to the guest as well as remotely creating guest directories is available.
To use these features, use the Oracle VM VirtualBox command line.
Memory Overcommitment
In server environments with many VMs, the Guest Additions can be used to share physical host memory between several VMs.
- This reduces the total amount of memory in use by the VMs.
- If memory usage is the limiting factor and CPU resources are still available, this can help with running more VMs on each host.
Memory Ballooning
The Guest Additions can change the amount of host memory that a VM uses, while the machine is running.
- Because of how this is implemented, this feature is called memory ballooning.
- Note
- Oracle VM VirtualBox supports memory ballooning only on 64-bit hosts.
- It is not supported on Mac OS X hosts.
- Memory ballooning does not work with large pages enabled.
- To turn off large pages support for a VM, run VBoxManage modifyvm vmname --largepages off
Normally, to change the amount of memory allocated to a virtual machine, you have to shut down the virtual machine entirely and modify its settings.
- With memory ballooning, memory that was allocated for a virtual machine can be given to another virtual machine without having to shut the machine down.
When memory ballooning is requested, the Oracle VM VirtualBox Guest Additions, which run inside the guest, allocate physical memory from the guest operating system on the kernel level and lock this memory down in the guest.
- This ensures that the guest will not use that memory any longer.
- No guest applications can allocate it, and the guest kernel will not use it either.
- Oracle VM VirtualBox can then reuse this memory and give it to another virtual machine.
The memory made available through the ballooning mechanism is only available for reuse by Oracle VM VirtualBox.
- It is not returned as free memory to the host.
- Requesting balloon memory from a running guest will therefore not increase the amount of free, unallocated memory on the host.
- Effectively, memory ballooning is therefore a memory overcommitment mechanism for multiple virtual machines while they are running.
- This can be useful to temporarily start another machine, or in more complicated environments, for sophisticated memory management of many virtual machines that may be running in parallel depending on how memory is used by the guests.
At this time, memory ballooning is only supported through VBoxManage.
- Use the following command to increase or decrease the size of the memory balloon within a running virtual machine that has Guest Additions installed:
VBoxManage controlvm "VM name" guestmemoryballoon n
where VM name is the name or UUID of the virtual machine in question and n is the amount of memory to allocate from the guest in megabytes.
You can also set a default balloon that will automatically be requested from the VM every time after it has started up with the following command:
VBoxManage modifyvm "VM name" --guestmemoryballoon n
By default, no balloon memory is allocated.
- This is a VM setting, like other modifyvm settings, and therefore can only be set while the machine is shut down.
- See Section 8.8, “VBoxManage modifyvm”.
Page Fusion
Whereas memory ballooning simply reduces the amount of RAM that is available to a VM, Page Fusion works differently.
- It avoids memory duplication between several similar running VMs.
In a server environment running several similar VMs on the same host, lots of memory pages are identical.
- For example, if the VMs are using identical operating systems.
- Oracle VM VirtualBox's Page Fusion technology can efficiently identify these identical memory pages and share them between multiple VMs.
- Note
Oracle VM VirtualBox supports Page Fusion only on 64-bit hosts, and it is not supported on Mac OS X hosts.
- Page Fusion currently works only with Windows 2000 and later guests.
The more similar the VMs on a given host are, the more efficiently Page Fusion can reduce the amount of host memory that is in use.
- It therefore works best if all VMs on a host run identical operating systems.
- Instead of having a complete copy of each operating system in each VM, Page Fusion identifies the identical memory pages in use by these operating systems and eliminates the duplicates, sharing host memory between several machines.
- This is called deduplication.
- If a VM tries to modify a page that has been shared with other VMs, a new page is allocated again for that VM with a copy of the shared page.
- This is called copy on write.
- All this is fully transparent to the virtual machine.
You may be familiar with this kind of memory overcommitment from other hypervisor products, which call this feature page sharing or same page merging.
- However, Page Fusion differs significantly from those other solutions, whose approaches have several drawbacks: * Traditional hypervisors scan all guest memory and compute checksums, also called hashes, for every single memory page.
- Then, they look for pages with identical hashes and compare the entire content of those pages.
- If two pages produce the same hash, it is very likely that the pages are identical in content.
- This process can take rather long, especially if the system is not idling.
- As a result, the additional memory only becomes available after a significant amount of time, such as hours or sometimes days.
- Even worse, this kind of page sharing algorithm generally consumes significant CPU resources and increases the virtualization overhead by 10 to 20%.
- Page Fusion in Oracle VM VirtualBox uses logic in the Oracle VM VirtualBox Guest Additions to quickly identify memory cells that are most likely identical across VMs.
- It can therefore achieve most of the possible savings of page sharing almost immediately and with almost no overhead.
- Page Fusion is also much less likely to be confused by identical memory that it will eliminate, just to learn seconds later that the memory will now change and having to perform a highly expensive and often service-disrupting reallocation.
At this time, Page Fusion can only be controlled with VBoxManage, and only while a VM is shut down.
- To enable Page Fusion for a VM, use the following command:
VBoxManage modifyvm "VM name" --pagefusion on
You can observe Page Fusion operation using some metrics. RAM/VMM/Shared shows the total amount of fused pages, whereas the per-VM metric Guest/RAM/Usage/Shared will return the amount of fused memory for a given VM.
- See Section 8.33, “VBoxManage metrics” for information on how to query metrics.
- Note
Enabling Page Fusion might indirectly increase the chances for malicious guests to successfully attack other VMs running on the same host.
Controlling Virtual Monitor Topology
X11/Wayland Desktop Environments
The Guest Additions provide services for controlling the guest system's monitor topology.
- Monitor topology means the resolution of each virtual monitor and its state (disabled/enabled).
- The resolution of a virtual monitor can be modified from the host side either by resizing the window that hosts the virtual monitor, through the view menu or through VBoxManage controlvm "vmname" setscreenlayout.
- On guest operating systems with X11/Wayland desktops this is put into effect by either of two following services:
VBoxClient --vmsvga VBoxDRMClient
Here are some details about guest screen resolution control functionality: * On X11/Wayland desktops the resizing service is started during desktop session initialization, that is desktop login.
- On X11 desktops VBoxClient --vmsvga handles screen topology through the RandR extension.
- On Wayland clients VBoxDRMClient is used.
- The decision is made automatically at each desktop session start.
- On 32 bit guest operating systems VBoxDRMClient is always used, in order to work around bugs.
- Since the mentioned monitor topology control services are initialized during the desktop session start, it is impossible to control the monitor resolution of display managers such as gdm, lightdm.
- This default behavior can be changed by setting the guest property /VirtualBox/GuestAdd/DRMResize of the virtual machine to any value.
- Please refer to Section 4.7, “Guest Properties” for updating guest properties.
- When this guest property is set then VBoxDRMClient is started during the guest OS boot and stays active all the time, for both ithe display manager login screen and the desktop session.
Known Limitations
VBoxDRMClient is not able to handle arbitrary guest monitor topologies.
- Specifically, disabling a guest monitor (except the last one) invalidates the monitor topology due to limitations in the Linux kernel module vmwgfx.ko.
- iFor example, when the guest is configured to have 4 monitors it is not recommended to disable the 2nd or 3rd monitor.