# Installing VirtualBox



## balanga (Nov 19, 2019)

Looking at a couple of references for installing VirtualBox:-









						Chapter 23. Virtualization
					

Virtualization software allows multiple operating systems to run simultaneously on the same computer




					www.freebsd.org
				











						How to Install Oracle VirtualBox in FreeBSD - OSTechNix
					

This brief tutorial describes about how to Install Oracle VirtualBox in FreeBSD 10.3 MATE desktop edition.




					www.ostechnix.com
				




both suggest building from ports, but I'd prefer to install a pkg, since building invariably takes a long time and is error prone. 
Is there any reason not to install a pkg? 

Are the rest of the instructions in The Handbook still accurate? Anything in particular to note? I'm hoping to run Windows 7 under
VirtualBox...


----------



## twllnbrck (Nov 19, 2019)

Sound could be a reason to use ports over pkg. As far as I know OSS dont work and you need virtualbox with pulseaudio support to get sound running. But maybe things have changed with 5.2.32 upgrade


----------



## AndrewManson (Mar 28, 2021)

Hi balanga,
Do you have "success story" with using packages ?
Currently I'm trying to set up V.B. (installed from pkgs) on FreeBSD 12.2, and looks like I'm not lucky enough :
installation of any OS (I've checked FreeBSD 8.4 x32 and Windows 7 x64) hangs with issues with copying files from distribution medias :-(
There are some messages in LOGs which I'm afraid I can't interpret correctly (something about DMA access). Tried to "google" the messages - looks like nobody has met the issue. 
"Is there any chance that installing Virtual Box from ports is more preferable ?" - what is your experience ?


----------



## jardows (Mar 29, 2021)

If you want guest additions you have to install from ports.  I think it's a licensing issue. If you are going to user VirtualBox like I do (able to run Windows programs in the VM while still in my FreeBSD environment) then the guest additions are a requirement.  If you don't care about things like shared folders, shared clipboard, mouse pointer integration, you can skip guest additions and just install from packages.


----------



## SirDice (Mar 29, 2021)

jardows said:


> If you want guest additions you have to install from ports. I think it's a licensing issue.


Nonsense. The packages work just fine, if they are available. While it is certainly true the packages sometimes fail to build this is not the rule. The license doesn't prohibit packaging either.


----------



## _martin (Mar 29, 2021)

jardows: There are licensing concerns when you want to install packs, but not the guest additions.


----------



## _martin (Mar 29, 2021)

balanga: I install it from ports because I don't use X on my setup. I can selectively deselect these then and avoid having huge port dependencies. 
Compiler dependency takes the longest. Now from my personal experience (and while I do know this is generally bad idea) I tend to install gcc/llvm from precompiled ports when available.


----------



## SirDice (Mar 29, 2021)

There are -nox11 packages for the guest additions if you need those (emulators/virtualbox-ose-additions-nox11 for example). For the VirtualBox application itself, yes, you'll need to build from ports if you want to run it in a server configuration without the GUI. Although you can just install the package and simply not use the GUI, it's going to pull in a lot of X11 and QT libraries though.


----------



## balanga (Mar 29, 2021)

To be quite honest I haven't looked at VirtualBox in over a year. My intention was to get Windows 7 working under VirtualBox by got sidetracked trying to use bhyve() but never got that working, although I hope to get back to intended task shortly. Seeing this thread pop up in What's New has escalated this task in my todo list


----------



## _martin (Mar 29, 2021)

Yeah, I just saw that this is an older thread revived.  It's worth mentioning that you can't have both hypervisors running. I think I opened a PR few years ago about vmm(4) load (and possibly some activity from VM) crashing the system when VirtualBox is running. There was no check about other hypervisors.
As all my servers are headless I tend to avoid pulling all the unwanted dependencies with the installation. Also old habits die hard -- I always do the upgrade from sources and install packages from src. I have problems very seldom with ports though. And if I do I open a PR for it.


----------



## jardows (Mar 29, 2021)

SirDice said:


> Nonsense. The packages work just fine, if they are available. While it is certainly true the packages sometimes fail to build this is not the rule. The license doesn't prohibit packaging either.


I'm not sure why you consider it nonsense when the default option is GUESTADDITIONS=OFF.  I certainly could be wrong about the licensing issue, like I said - "I think." If it isn't licensing, I wonder what the intention is for making that the default option.  I would think they would be more desireable than not, and if you didn't want them, you could build from ports to exclude them.


----------



## SirDice (Mar 29, 2021)

That option pulls in a fairly large ISO, which most people don't need anyway. But you're right though, there's a license issue with that ISO too. 


```
.if ${PORT_OPTIONS:MGUESTADDITIONS}
GUESTADDITIONS= VBoxGuestAdditions_${PORTVERSION}.iso
RESTRICTED=     for personal use only
RESTRICTED_FILES=       ${GUESTADDITIONS}
.endif
```


----------



## Deleted member 66267 (Mar 29, 2021)

The VirtualBox extensions pack doesn't work on FreeBSD anyway. So don't care about it.


----------



## _martin (Mar 29, 2021)

SirDice Reasoning about large iso makes sense. But I think you were right the first time -- there are no restrictions to additions (in the sense of commercial use). As I sent the wiki link above, Q7:



> The “VirtualBox Guest Additions” are a set of software drivers and utilities that are shipped as a subset of the VirtualBox base package and that are installed inside a virtual machine for better performance and usability. Like the VirtualBox base package, the VirtualBox Guest Additions are licensed under the GPLv2.


----------



## _martin (Mar 29, 2021)

obnoxious said:


> The VirtualBox extensions pack doesn't work on FreeBSD anyway. So don't care about it.


Not the way it works on Linux but still default one is there:

```
$  VBoxManage list extpacks
Extension Packs: 1
Pack no. 0:   VNC
Version:      5.2.44
Revision:     139111
Edition:
Description:  VNC plugin module
VRDE Module:  VBoxVNC
Usable:       true
Why unusable:
```


----------



## Deleted member 66267 (Mar 29, 2021)

_martin said:


> Not the way it works on Linux but still default one is there:
> 
> ```
> $  VBoxManage list extpacks
> ...


I don't know. I see the error when adding it so I think it just not work on FreeBSD.


----------



## Terpentijn (Mar 29, 2021)

Installed virtualbox 6 and the extensions on FreeBSD 13 and it runs very smooth. No issues. Installed from pkg.


----------

