Install FreeBSD 10.0 using memstick IMG file on Virtualbox

When FreeBSD 10.0 arrived, I headed straight to the FreeBSD website and downloaded the FreeBSD-10.0-RELEASE-amd64-memstick.img file. I usually do not burn DVDs. It is just not flexible enough. Writing the installation media on to a USB is easiest thing to do when you are addicted to installing OSs in your free time.

Most Linux distros publish their installation media as ISO images while the FreeBSD team creates an IMG image in addition to the ISO. While the Linux ISO images can be written to a USB (ISO -> USB), the FreeBSD ISO cannot beĀ  written to USB. That is where the FreeBSD IMG file comes into picture. While the IMG file is good for writing onto USB drive, one will surely have a horrid time installing FreeBSD as a Virtualbox guest using the IMG file. Virtualbox does not recognize the IMG format.

What is the solution?

Just run the following command:

VBoxManage convertfromraw -format VDI [filename].img [filename].vdi

Once this is done, a VDI file is generated. This is the virtual hard disk file format used by Virtualbox. Now this file can simply be attached as another storage device in Virtualbox. During the boot process, hit F12 key and enter the virtual BIOS menu. One can select the attached drive and boot from it, in case Virtualbox does not automatically boot from the attached drive.

To write FreeBSD IMG file to USB, I use the following command:

dd if=FreeBSD-10.0-RELEASE-amd64-memstick.img of=/dev/<device> bs=64k

The general command is:

dd if=<Any compatible ISO or IMG file> of=/dev/<device> bs=64k

Yes, dd command works on Linux and FreeBSD

Be very careful while using the above command. The changes are irreversible. Thus, if you select a wrong device, you will definitely lose all data.

Further reading:

Advertisements

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.