Oracle VM VirtualBox is a hosted hypervisor for x86 virtualisation.
Supported guests include BSD, Haiku, Linux, OS/2, ReactOS, Solaris and
Windows.
emulators/virtualbox-ose is recommended for most use cases.
emulators/virtualbox-ose-legacy is for exceptional legacy (5.2.x) cases.
<https://www.virtualbox.org/wiki/Changelog-5.2> emphasises that
5.2.x is no longer supported by Oracle.
Guest Additions are available:
emulators/virtualbox-ose-additions-legacy
For the Extension Pack: FreeBSD is not a supported host platform.
Installation of the Pack will not extend the feature set.
===> The following configuration options are available for virtualbox-ose-nox11-legacy-5.2.44_34:
PYTHON=off: Python bindings or support
UDPTUNNEL=on: Build with UDP tunnel support
VDE=off: Build with VDE support
VNC=on: Build with VNC support
WEBSERVICE=on: Build Webservice
===> Use 'make config' to modify these settings
VirtualBox was installed.
You need to load the vboxdrv kernel module via /boot/loader.conf:
vboxdrv_load="YES"
You also have to add all users to your vboxusers group in order to use vbox.
% pw groupmod vboxusers -m jerry
Reboot the machine to load the needed kernel modules.
Bridging Support:
=================
For bridged networking please add the following line to your /etc/rc.conf:
vboxnet_enable="YES"
USB Support:
============
For USB support your user needs to be in the operator group and needs read
and write permissions to the USB device.
% pw groupmod operator -m jerry
Add the following to /etc/devfs.rules (create if it doesn't exist):
[system=10]
add path 'usb/*' mode 0660 group operator
To load these new rule add the following to /etc/rc.conf:
devfs_system_ruleset="system"
Then restart devfs to load the new rules:
% /etc/rc.d/devfs restart
Troubleshooting:
================
Running VirtualBox as non-root user may fail with a fatal error
NS_ERROR_FACTORY_NOT_REGISTERED. In this case delete /tmp/.vbox-*-ipc file.
If you experience "Network: write Failed: Cannot allocate memory" errors
try to increase net.graph.maxdata in /boot/loader.conf
If you are using AIO, then increase these limits (https://bugs.freebsd.org/168298):
vfs.aio.max_buf_aio=8192
vfs.aio.max_aio_queue_per_proc=65536
vfs.aio.max_aio_per_proc=8192
vfs.aio.max_aio_queue=65536
To check if AIO is used use: kldstat -v | grep aio
If you are experiencing VMs freezes with an error in VBox.log such as:
"
00:01:29.590192 AssertLogRel /usr/ports/emulators/virtualbox-ose-legacy/work/VirtualBox-5.2.44
/src/VBox/VMM/VMMR3/PGMPhys.cpp(5148) int PGMR3PhysAllocateHandyPages(PVM): RT_SUCCESS(rc)
00:01:29.590221 87/128: idPage=0x3d400 HCPhysGCPhys=000000027eaed000 rc=VERR_NO_MEMORY
00:01:29.590247 Changing the VM state from 'RUNNING' to 'GURU_MEDITATION'
00:01:29.590261 Console: Machine state changed to 'GuruMeditation'
00:01:29.590695 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00:01:29.590696 !!
00:01:29.590697 !! VCPU0: Guru Meditation -8 (VERR_NO_MEMORY)
"
and see a lot of free RAM, then increase sysctl vm.max_user_wired
(https://bugs.freebsd.org/252227).
For dedicated VM servers, a good start is:
("RAM in GB" - max(1, "RAM in GB" / 32)) * 1024*1024*1024 / PAGE_SIZE
PAGE_SIZE on x86 is 4096.
Examples with different RAM sizes in GB:
16: ( 16-max(1, 16/32)*1024*1024*1024/4096 = 3932160 => 15GB
32: ( 32-max(1, 32/32)*1024*1024*1024/4096 = 8126464 => 31GB
48: ( 48-max(1, 48/32)*1024*1024*1024/4096 = 12189696 => 46.5GB
64: ( 64-max(1, 64/32)*1024*1024*1024/4096 = 16252928 => 62GB
128: (128-max(1,128/32)*1024*1024*1024/4096 = 32505856 => 124GB
256: (256-max(1,256/32)*1024*1024*1024/4096 = 65011712 => 248GB
Check the wiki page for known issues and troubleshooting:
https://wiki.freebsd.org/VirtualBox
Please report any problems to emulation@. Thanks!
emulators/virtualbox-ose*: Flavorize
While here make non-functional changes related to indentation and
formatting, make simplification of CONFLICTS_INSTALL.
Sponsored by: UNIS Labs
emulators/virtualbox-ose*: Add support of "Unattended Installation of Guest OS"
feature
Install files required by Unattended Installation of Guest OS feature.
These files were already prepared during the ports' build, so just add
them to the installation.
Details about this feature are here:
https://www.virtualbox.org/manual/topics/create-vm.html#tk_create-vm-unattended-install
Reported by: xin3qu via IRC (#freebsd-vbox @ Libera.Chat)
emulators/virtualbox-ose*: Improve rc script
- Add sort VMs by name during auto start and reverse sort during stop -
with this user can control the order in which VMs are started and stopped.
- Increase default delay between start VMs from 0 to 1 second -
useful when automatically starting more than "2-3" VMs.
emulators/virtualbox-ose{,-nox11}{,-legacy}: Fix listen VNC on TCP port on IPv6
address
Four new options are available:
- "VNCAddress4" -> IPv4 address to use
- "VNCPort4" -> IPv4 Port to use
- "VNCAddress6" -> IPv6 address to use
- "VNCPort6" -> IPv6 port to use
"TCP/Ports" is used for backward compatibility as IPv4 and IPv6 ports if
"VNCPort4" or "VNCPort6" is not defined.
Detailed description is here:
https://www.virtualbox.org/browser/vbox/trunk/src/VBox/ExtPacks/VNC/VBoxVNC.cpp#L361
PR: 193778
emulators/virtualbox-ose*: Improve ports
* Replace PORTVERSION with DISTVERSION.
* Fix CONFLICTS_INSTALL.
* Fix PYTHON in DEFAULT_OPTIONS in emulators/virtualbox-ose.
* Pet portclippy and portlint.
* Formatting and etc.
PR: 258159
emulators/virtualbox-ose{,-nox11}-legacy: fix USB passthrough fails with: Failed
to create a proxy device for the USB device
Failed to create a proxy device for the USB device. (Error:
VERR_INVALID_PARAMETER)
00:00:24.961804 usbProxyConstruct: Failed to open '/dev/ugen0.6',
rc=VERR_INVALID_PARAMETER
00:00:24.961881 ERROR [COM]: aRC=NS_ERROR_FAILURE (0x80004005)
aIID={872da645-4a9b-1727-bee2-5585105b9eed} aComponent={ConsoleWrap}
aText={Failed to create a proxy device for the USB device. (Error:
VERR_INVALID_PARAMETER)}, preserve=false aResultDetail=-2
In commit
https://cgit.freebsd.org/src/commit/?id=9b077d72bcc313baea2b9283afc7f568739eaadc
+#define USB_FS_XFER_MAX 126
- if (fs_ep_ptr == NULL || ep_index_max > 127)
+ if (fs_ep_ptr == NULL || ep_index_max > USB_FS_XFER_MAX)
To fix VirtualBox decrease USBFBSD_MAXENDPOINTS from 127 to 126:
-#define USBFBSD_MAXENDPOINTS 127
+#define USBFBSD_MAXENDPOINTS 126
PR: 270900
Tested by: groenveld@acm.org, russo@bogodyn.org
Approved by: with hat of vbox (maintainer)
MFH: 2024Q3
emulators/virtualbox-ose{,-nox11}-legacy: add vboxinit start/stop script for VMs
which is controlled from phpvirtualbox
Set the "Startup Mode" to "Automatic" for the virtual machine in
phpvirtualbox to automatically start the virtual machine during OS boot.
This script also stops virtual machines during reboot even if
vboxinit_enable="YES" is not present in /etc/rc.conf.
phpvirtualbox uses the "Web Service" (WEBSERVICE) to configure and
manage virtual machines, so we install the script only when the
WEBSERVICE option is enabled.
PR: 280062
emulators/virtualbox-ose{,-nox11,-kmod,-additions,-additions-nox11}-legacy: fix
build with llvm15+, fix run with PAE on i386
* Fix build with llvm15+ from ports and from base:
- ISO C++17 does not allow 'register' storage class specifier;
- require -fPIC on i386.
* Fix load kernel modules on host and guest i386 if kernel compiled with
PAE option: add non-default option PAE to ports.
Based on patches from mi@.
PR: 279257224616
Approved by: vbox (maintainer, timeout 1 month and 6 years)
emulators/virtualbox-ose{,-nox11}-legacy: fix PORTREVISION and option MANUAL =>
DOCS
1. Fix PORTREVISION in master port emulators/virtualbox-ose-legacy for
slave port emulators/virtualbox-ose-nox11-legacy.
2. Rename in slave port emulators/virtualbox-ose-nox11-legacy MANUAL to
DOCS - in master port was renamed in
https://cgit.freebsd.org/ports/commit?id=a0ef5898beb4c6a73e9d94aaa452c0eb37cbb14c.
3. Bump emulators/virtualbox-ose-nox11-legacy.
Approved by: arrowd (mentor)
Differential Revision: https://reviews.freebsd.org/D41071
MFH: 2023Q3
textproc/libxml2: bump all LIB_DEPENDS consumers
This is a separate commit to facilitate easier cherry-picking for
quarterly.
PR: 262853, 262940, 262877, 263126
Approved by: fluffy (mentor)
textproc/libxml2: bump all dependencies
This should make sure that all dependent ports will pick
up the new version commited with a13ec21cd733f67a9fc0dc00ab45268bdc236246
- Update VirtualBox OSE to 6.1.18
- Old VirtualBox OSE 5.2.44 preserved as "-legacy" versions of the
ports (repocopied)
- Add back extra patch removed in r528258, actually required to
build DEBUG kmod
- Correctly define WITH_DEBUG when enabling the DEBUG option, so
binaries are not stripped
Please note that this new version supports only amd64 CPUs. If you need
to use older hardware please install the legacy ports.
Note that moving VM snapshots across major updates is unsupported, it's
strongly suggested to properly shutdown VMs before upgrading, please
check UPDATING for further details.
(Only the first 15 lines of the commit message are shown above )