{{Header}}
{{Title|title=
VirtualBox Guest Additions and Shared Folders
}}
{{#seo:
|description=Instructions for installing VirtualBox Guest Additions in {{project_name_long}}. Shared Folders, Clipboard Sharing, Mouse Integration and more.
|image=Cd-699786640.jpg
}}
[[File:Cd-699786640.jpg|thumb]]
{{intro|
VirtualBox Guest Additions is a software package that provides additional functionality to virtual machines (VMs) running in VirtualBox. The Guest Additions package includes drivers and utilities that enhance the performance and usability of the VMs.
Guest Additions provides features such as seamless mouse integration, shared folders between the host and guest operating systems, improved graphics performance, and the ability to resize the guest display dynamically.
[[#VirtualBox Guest Additions|Guest Additions are installed by default in {{project_name_short}} and its derivatives such as {{Whonix}}.]]
}}
= Clipboard Sharing =
== Clipboard Sharing Security Considerations ==
Bidirectional clipboard sharing is currently enabled by default in {{project_name_short}} VirtualBox VM.
[https://forums.whonix.org/t/host-whonix-gateway-clipboard-sharing-enable-by-default/894 Host -> Whonix-Gateway clipboard sharing enable by default?]
There are good reasons to disable clipboard sharing. The decision for the user to disable clipboard sharing or not.
Shared folders are discouraged because it weakens isolation between the guest and the host. Providing a mechanism to access files of the host system from within the guest system via a specially defined path necessarily enlarges the attack surface and provides a potential pathway for malicious actors to compromise the host.
https://forums.whonix.org/t/security-risks-of-virtualbox-shared-folders/10119
To learn more about VirtualBox shared folders, see: [https://www.virtualbox.org/manual/ch04.html#sharedfolders VirtualBox Manual - Chapter 4. Guest Additions].
Admittedly, this recommendation does not have a strong rationale. Disabling additional features in other virtualizers or general applications will similarly lead to less code paths being utilized and arguably increasing security. VirtualBox software is not special in this regard.
== Clipboard Sharing Instructions ==
To change the clipboard sharing setting:
# Power off the virtual machine. Because otherwise you cannot change VirtualBox VM settings.
# Navigate to VirtualBox machine settings
→ General
→ Advanced
→ Shared Clipboard
# Set the preferred configuration: Disabled
, Guest to Host
, Host to Guest
or Bidirectional
.
# Power on the virtual machine again.
To learn more, see: [https://www.virtualbox.org/manual/ch03.html#generalsettings VirtualBox Manual - Chapter 3. Configuring Virtual Machines].
= Shared Folder =
== {{project_name_short}}-Default ==
{{mbox
| type = notice
| image = [[File:Ambox_notice.png|40px|alt=Info]]
| text = Note:
* It is unnecessary to power off the virtual machine.
From VirtualBox v6+.
* For better usability, the package [https://github.com/{{project_name_short}}/vm-config-dist vm-config-dist] has already added the user user
to the group vboxsf
.
Using [https://github.com/{{project_name_short}}/vm-config-dist/blob/master/usr/lib/systemd/system/mnt-shared-vbox.service /lib/systemd/system/mnt-shared-vbox.service].
}}
{{Box|text=
# Host folder preparation: On the host operating system, create a folder to be shared with the {{VM}}. For example, on a Linux host operating system, create the folder /home/user/shared
.
# VirtualBox
→ right-click the virtual machine
→ Settings
→ Shared Folder
# Click the folder icon with a +
symbol in the upper right-hand section of the screen.
# Folder Path
→ Navigate to the folder you want to share.
# Folder Name
→ Type: shared
. A different folder name can be used, but shared
is recommended so it matches the example documented below -- do not use share
(without the trailing d
)!
# Uncheck Read-only
.
If you do not wish to write to that folder from within the VM, you are free to check/enable this setting.
# Check Auto-mount
.
If the option is unavailable, upgrade VirtualBox.
# Mount Point
→ Leave as is (leave it empty and do not make any changes).
Alternatively, the folder /home/user/shared
can be chosen. The VirtualBox default means that the folder would be owned by root
and the group vboxsf
.
# Check Make Permanent
(if that option exists).
This is specific to the VirtualBox version; newer versions may no longer have this option.
Check Make Permanent
if this setting should persist after restarting the virtual machine. Otherwise, this setting will be temporary.
# Press OK
to close the shared folder dialog.
# Press OK
to close the VirtualBox settings.
# The process is now complete, and the shared folder can be used.
In the above example, the shared
folder will accessible as /media/sf_shared
.
By default, VirtualBox uses the prefix sf_
.
The folder can be opened using a [[Software#File Manager|file manager]] such as Thunar, for example. To open it using the command line, run:
{{CodeSelect|code=
cd /media/sf_shared
}}
}}
== Other Operating Systems ==
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.# Add the user that will utilize shared folders from inside the VM to group
vboxsf
: {{CodeSelect|code=
sudo addgroup user vboxsf
}}
# A reboot is required to make group changes take effect.
# Follow the instructions above.
fasttrack.debian.net
) packages virtualbox-guest-utils
, virtualbox-guest-x11
.
|
* Adjusted by Debian specifically for Debian. Works very well when using the same version of the VirtualBox host software as well as VirtualBox guest additions.
* After installation of the package(s), VirtualBox Guest Additions will be fully setup and functional.
| {{Yes}}
| {{Yes}}
|-
! B
| Host ISO
| VirtualBox guest additions ISO / CD
|
* This is the VirtualBox guest additions ISO / CD from Oracle, which is the company that develops VirtualBox.
* This ISO is shipped with the VirtualBox host software.
* The ISO contains generic VirtualBox guest additions installer for many Linux versions.
* Not specifically designed for Debian.
* Only recommended in case [[VirtualBox/Other_Versions#Install_from_VirtualBox.org_Repository|installing a newer version of VirtualBox from the VirtualBox.org Repository]] than available from Debian and only recommended if the ISO cannot instead be installed from the next entry in this table.
* To actually install VirtualBox guest additions from this source, the user would have to mount or extract the ISO and run the setup installer as was per instructions on the [https://www.virtualbox.org/manual/ch04.html#additions-linux VirtualBox website].
| {{No}}
| {{No}}
|-
! C
| Oracle Style
| From Debian's (packages.debian.org
) package [https://packages.debian.org/sid/virtualbox-guest-additions-iso virtualbox-guest-additions-iso
].
|
* Similar to above.
* A Debian maintainer has built the VirtualBox guest additions ISO and added it to the virtualbox-guest-additions-iso
package to provide a more convenient method to acquire the ISO.
* Installation alone of the package does effectively nothing. The package essentially only includes file /usr/share/virtualbox/VBoxGuestAdditions.iso
.
* Only recommended in case [[VirtualBox/Other_Versions#Install_from_VirtualBox.org_Repository|installing a newer version of VirtualBox from the VirtualBox.org Repository]] than available from Debian.
* To actually install VirtualBox guest additions from this source, the user would have to, either:
** '''A)''' mount or extract the ISO and run the setup installer as was per instructions on the VirtualBox website, or
** '''B)''' use [[#vbox-guest-installer|vbox-guest-installer]].
| {{Yes}}
| {{No}}
|-
|}
{{Code2|VirtualBox guest additions}} (from packages virtualbox-guest-utils
, virtualbox-guest-x11
) are installed by default and should be preferred over virtualbox-guest-additions-iso
.
virtualbox-guest-additions-iso
is still installed by default. Should there be issues with virtualbox-guest-utils
, virtualbox-guest-x11
as there was in past due to unavailability, then it's easier to fall back to that solution. vbox-guest-installer
] (installation helper created by {{project_name_short}} developers) is also still installed by default for the same purpose.
== vbox-guest-installer ==
[https://github.com/{{project_name_short}}/vm-config-dist/blob/master/usr/bin/vbox-guest-installer vbox-guest-installer
] is an installation helper created by {{project_name_short}} developers. It is a helper utility for better usability that allows to install {{Code2|VirtualBox guest additions}} from Debian's (packages.debian.org
) package [https://packages.debian.org/sid/virtualbox-guest-additions-iso virtualbox-guest-additions-iso
].
* Not enabled by default.
* Usually no user action required.
* Usually no enable/disable or settings change required.
Whenever the Linux kernel package or virtualbox-guest-additions-iso
is upgraded, vbox-guest-installer
should be automatically running.
debian/vm-config-dist.triggers
vbox-guest-installer
will refuse to install VirtualBox guest additions from package virtualbox-guest-additions-iso
when either package virtualbox-guest-x11
and/or package virtualbox-guest-utils
is still installed. This is because only 1 installation source should be used by default as mentions in chapter [[#VirtualBox/Guest_Additions#VirtualBox_Guest_Additions_Installation_Sources|VirtualBox Guest Additions Installation Sources]].
To use vbox-guest-installer
, see chapter [[VirtualBox/Guest_Additions#Migration_to_Oracle_Style_VirtualBox_Guest_Additions|Migration to Oracle Style VirtualBox Guest Additions]].
== VirtualBox Guest Additions CD ==
Depending on the VM where you intent to use VirtualBox Guest Additions. See instructions for either A) or B).
* '''A)''' If using [[VirtualBox|{{project_name_short}} for VirtualBox]] with the [[VirtualBox/Recommended_Version|recommended VirtualBox version]]:
** {{project_name_short}} default: VirtualBox guest additions are installed by default. (Source: Debian's (fasttrack.debian.net
) packages virtualbox-guest-utils
, virtualbox-guest-x11
)
** Unneeded: It is therefore usually unnecessary and discouraged to install guest additions from Debian's (packages.debian.org
) package virtualbox-guest-additions-iso
or from the VirtualBox ISO / CD (VBoxGuestAdditions.iso
).
** Discouraged: Do not use VirtualBox
→ Devices
→ Insert Guest Additions CD image...
virtualbox-guest-utils
and virtualbox-guest-x11
(Debian style) and wishes to migrate to Oracle Style VirtualBox Guest Additions from package virtualbox-guest-additions-iso
, complete the following steps.
'''1.''' Uninstall the Debian style VirtualBox Guest Additions Packages.
This step is mandatory. Otherwise [[#vbox-guest-installer|vbox-guest-installer]] would refuse to install Oracle Style VirtualBox Guest Additions because only 1 installation source for guest additions must be active at the same time.
{{CodeSelect|code=
sudo apt purge virtualbox-guest-utils virtualbox-guest-x11
}}
'''2.''' Make sure package virtualbox-guest-additions-iso
is installed.
Should be installed by default. To check and install if required, run.
{{Install Package
|package=virtualbox-guest-additions-iso
}}
'''3.''' Run vbox-guest-installer.
{{CodeSelect|code=
sudo vbox-guest-installer
}}
'''4.''' Reboot.
'''5.''' Done.
Migration from VirtualBox Guest Additions (Debian style) to VirtualBox Guest Additions ISO (Oracle style) has been completed.
{{Anchor|Migration to Guest Additions Packages}}
== Migration to Debian Style VirtualBox Guest Additions Packages ==
If the user is currently using VirtualBox Guest Additions from package virtualbox-guest-additions-iso
and/or ISO / CD (Oracle style) and wishes to migrate to VirtualBox packages virtualbox-guest-utils
and virtualbox-guest-x11
(Debian style), complete the following steps.
'''1.''' [[#Uninstall virtualbox-guest-additions-iso|Uninstall virtualbox-guest-additions-iso]].
'''2.''' Install VirtualBox Guest Additions from Debian.
{{Install Package
|package=virtualbox-guest-utils virtualbox-guest-x11
}}
'''3.''' Reboot.
'''4.''' Done.
Migration from VirtualBox Guest Additions ISO (Oracle style) to VirtualBox Guest Additions (Debian style) packages has been completed.
== VirtualBox Guest Additions Security ==
General concerns have been raised about the security of VirtualBox, for example see the article [https://www.phoronix.com/news/OTk5Mw The VirtualBox Kernel Driver Is Tainted Crap] . However, this refers to the kernel driver (on the host), not guest additions. For opposite viewpoints, see [https://lists.debian.org/debian-devel/2013/08/msg00112.html here] and [https://lists.debian.org/debian-devel/2013/08/msg00116.html here].
The situation might have improved since some kernel modules have been upstreamed (integrated) to the Linux mainline kernel.
* https://www.phoronix.com/news/VirtualBox-Guest-V2-Continues
* https://www.phoronix.com/news/Linux-4.16-vboxguest
* vboxguest
: https://www.phoronix.com/news/Linux-4.16-Three-New-Subsystems
* vboxsf
: https://www.phoronix.com/news/VBOXSF-VirtualBox-Staging
* search term: {{CodeSelect|code=
site:kernel.org vbox
}}
= Alternatives =
It is possible to achieve similar functionality without installing guest additions:
* For file exchange with {{project_name_short}}, see: [[File Transfer]] and [[File Sharing]].
* To achieve a higher screen resolution, see: [[VirtualBox/Higher Screen Resolution without installing VirtualBox Guest Additions|Higher Screen Resolution without VirtualBox Guest Additions]].
* To achieve mouse integration, it is possible to set a USB tablet in VirtualBox settings. This is recommended against because it requires adding a USB controller to VirtualBox. (VirtualBox
→ Right-click on Virtual Machine
→ Settings
→ System
→ Enable absolute pointing device
)
= Miscellaneous =
== Uninstall virtualbox-guest-additions-iso ==
This is discouraged and should not be required. However, if you wish to uninstall VirtualBox guest additions as installed by vbox-guest-installer
by {{project_name_short}} developers, follow the steps below.
'''1.''' Note about package virtualbox-guest-additions-iso
.
No purge of package virtualbox-guest-additions-iso
required since vbox-guest-installer
effectively does nothing if VirtualBox guest additions packages are installed. If purging virtualbox-guest-additions-iso
is desired this is OK too.
'''2.''' Uninstall Oracle style VirtualBox guest additions.
To remove VirtualBox guest additions (previously installed by {{project_name_short}} from virtualbox-guest-additions-iso
), run VirtualBox guest additions uninstaller by VirtualBox developers.
{{CodeSelect|code=
sudo /usr/sbin/vbox-uninstall-guest-additions
}}
== Debugging ==
To help debug issues, inspect the following logs and services.
{{CodeSelect|code=
cat /var/log/vboxadd-install.log
}}
{{CodeSelect|code=
sudo systemctl status vboxadd
}}
{{CodeSelect|code=
sudo systemctl status vboxadd-service.service
}}
{{CodeSelect|code=
ls -la /opt/VBoxGuestAdditions-*/init/
}}
=== Kernel Upgrades ===
The following issue is happening during kernel [[Operating System Software and Updates|upgrades]].
/etc/kernel/postinst.d/vboxadd: VirtualBox Guest Additions: Building the modules for kernel 5.6.0-0.bpo.2-amd64. Failed to rename process, ignoring: Operation not permitted update-initramfs terminated by signal TERM.Workaround in short: two reboots required. Workaround details: This results in guest additions being non-functional after the next reboot. During the next reboot VirtualBox guest additions will automatically detect the missing kernel modules for the upgraded kernel and build them. Therefore when rebooting yet another time the issue should be resolved until the next kernel upgrade. Please [[contribute]] to generic bug reproduction: * Conceptually: [[Reporting_Bugs#Generic_Bug_Reproduction|Generic Bug Reproduction]] * Specifically: [[VirtualBox/Troubleshooting#VirtualBox_Generic_Bug_Reproduction|VirtualBox Generic Bug Reproduction]] and [[#Debugging|Debugging]]. See also {{project_name_short}} specific technical information, [[Dev/VirtualBox#VirtualBox_Integration|VirtualBox Integration]]. One long term solution might be replacing initramfs-tools with dracut but that needs further research and development work. ([https://forums.whonix.org/t/replacing-initramfs-tools-with-dracut/4487 develpoment discussion], [https://github.com/dracutdevs/dracut/issues/1565 issue]) == Non-Issues ==