Virtualbox Guest Additions for FreeBSD Guest

I had to test something on FreeBSD. I was not sure how the test would turn out. Virtual machines help a lot in this regard. Virtualbox is one of the best tools available that helps in creating virtual machines. I can easily create virtual machines on Virtualbox and test to my heart’s content. Back-ups are possible. Throwing away the virtual machine too would cost nothing(apart from the time one invested in creating the virtual machine).

I installed FreeBSD on Virtualbox and everything went fine. I installed XFCE 4.10 on it. But most of the features that make Virtualbox a pleasure to work with need Virtualbox Guest Additions to be installed on the guest OS. This includes sharing the clipboard, mouse pointer integration, shared folders, full screen/scale-mode etc. Installing Guest Additions is a trivial step in the Windows guests and on most Linux distributions. It is however a different story with FreeBSD. It is still simple but one needs to go through the FreeBSD’s unparalleled documentation.

The FreeBSD Wiki and FreeBSD Handbook have clear details of how to install Virtualbox Guest Additions to the FreeBSD guest. The gist is:

  • First, install the emulators/virtualbox-ose-additions package or port in the FreeBSD guest. This will install the port:
cd /usr/ports/emulators/virtualbox-ose-additions && make install clean

The above process needs the port to be installed on the system. Each port has complete data needed for compiling and installing the application. However, the source code is not downloaded when you install the ports collection. The Makefile in the port will fetch and compile the source code and then install. This may not be suitable for all. About ports:

Each port’s Makefile automatically fetches the application source code, either from a local disk, CD-ROM or via ftp, unpacks it on your system, applies the patches, and compiles. If all went well, a simple make install will install the application and register it with the package system.

I did not have the ports tree with me and did not want to compile. I decided to install the virtualbox-ose-additions binary package. Luckily, it existed and did not have to go through the process of compiling everything. I did the following:

pkg_add -r  virtualbox-ose-additions

That was it. Done.

Add these lines to /etc/rc.conf:

vboxguest_enable="YES" 

vboxservice_enable="YES"

That is all. There is nothing more to it. Everything now works as expected.

Edit: for FreeBSD 10.0

When I installed Xorg packages on the FreeBSD guest, I ran the Xorg -configure command too. After that I installed the guest additions package. But the FULL SCREEN mode did not work. That is when I re-ran the Xorg -configure. The vboxvideo driver was recognized and xorg.conf.new file was generated at some temp location. I copied this file as /etc/X11/xorg.conf. Everything works now.