A closer look at using Oracle Solaris

Triple Boot, Part 4: Windows via VirtualBox

After setting up my triple-boot system, I was not content. I want access to Windows Vista and Ubuntu 8.04without having to restart my system. I mostly run OpenSolaris and rebooting to switch to Vista or Ubuntu is a disruption. If I need to do some sort of benchmarking or a lengthy task on Vista or Ubuntu then it is worth the time to reboot. But there are several use cases where I just want to do something quickly and then go back to what I was doing in OpenSolaris.

With Vista, typically I just want to edit an OpenOffice document, usually a presentation. I frequently edit presentations that were originally created by someone who was running OpenOffice on Windows. Since OpenOffice does not embed the actual fonts in the document, editing a document created on Windows while running OpenOffice on a non-Windows operating system can cause problems. Even with fonts such as Arial - Arial on Windows is not exactly the same as Arial on OpenSolaris, Ubuntu, etc. As a result, items in the documents frequently do not align correctly.

So I need the ability to quickly and easily run Windows Vista for just a few minutes without having to shutdown OpenSolaris, boot Vista, and then shutdown Vista and restart OpenSolaris. There is an easy solution: VirtualBox.

Installing VirtualBox is painless, just be sure to download the correct version for OpenSolaris: 32 or 64 bit. On my system, which has an Intel Core 2 Duo chip, OpenSolaris runs in 64-bit mode, as confirmed by the isainfo command:

gs145266@opensolaris-gs-08.05:~$ isainfo -k
amd64

VirtualBox is a small download and it installs quickly. It is very easy to use - I did not need the documentation until I started doing advanced configuration type stuff.

In VirtualBox I created a virtual machine for Windows Vista and then I had to make a choice:

Use the existing Vista installation that was already on my hard disk. In other words, configure the virtual machine to use the NTFS partition on my hard drive and let it boot Windows Vista from the same installation that boots from the bare metal.

Create a virtual disk image (.vdi) file and configure the virtual machine to use it. The .vdi file would be empty, so this would require getting a Vista DVD so that I could run the Windows installer, etc.

I ultimately decided to go with option 2 because of complications with option 1:

There are some Windows configuration and activation issues. There is a very detailed tutorial available that describes how to accomplish option 1 with Ubuntu as the host operating system and Windows XP as the guest operating system that is running in the virtual machine. I assume the same basic approach would work with OpenSolaris as the host and Vista as the guest, but I am not very knowledgeable about the differences between XP and Vista, especially in the all-important area of hardware profiles (which are key to making option 1 work).

VirtualBox has a nice feature that I like to use called "guest additions." These are device drivers that get added to the guest operating system to enable full screen mode, seamless mode, better mouse integration, etc. According to that tutorial, if you choose option 1 then installing the guest additions is a bad idea because after the guest additions are installed, Windows will no longer boot from the bare metal.

Option 2 was easy to setup and then I was able to run the installer for Windows Vista from a DVD. I added the VirtualBox guest additions and everything worked great.

There was just one problem: when running Vista in that VirtualMachine, I have no access to all that data on my hard drive's NTFS partition. It should be noted, this is not a limitation of VirtualBox - it is possible to configure "shared folders" that allow the installation of Vista that is running in a virtual machine to read/write any directory that OpenSolaris can access.

The problem is that OpenSolaris 2008.05 cannot access my NTFS partition because it does not include any support for NTFS partitions. You can add some packages to it in order to get read-only support for NTFS (see this entry from Pradhap for details), but I would like to be able to write files to the NTFS partition as well.

Once again, VirtualBox provides a solution.

VirtualBox supports raw access by a virtual machine to the host operating system's disk drives. The details are provided in section 9.9 of the VirtualBox 1.6.2 User Guide, which you will need to study before attempting this on your own system. Section 9.9 includes this important warning:

Warning: Raw hard disk access is for expert users only. Incorrect use or useof an outdated configuration can lead to total loss of data on the physicaldisk. Most importantly, do not attempt to boot the partition with the cur-rently running host operating system in a guest. This will lead to severe datacorruption.

I wanted to provide access to the NTFS partition only, so I attempted to follow the instructions in section 9.9.2 of the documentation. Unfortunately, the VBoxManage command described in section 9.9.2 does not work in VirtualBox 1.6.2 when run on OpenSolaris - the bug is documented here.

Luckily, I have other operating systems installed on this machine. :-) I booted up Ubuntu and used the VBoxManage in my installation of VirtualBox on Ubuntu to find out the partition numbers used by VirtualBox:

Note the value in bold: /dev/sda, which of course is the device name for my hard disk in Linux. I changed it to the value that OpenSolaris would expect on my system: /dev/dsk/c5d0p0 and then saved the file.

The final step was to make it available to the virtual machine. In order for this to work, VirtualBox has to be run with enough privileges to get raw access to the disk drive. So I modified the GNOME menu entry for VirtualBox so that it is started by pfexec:

After starting VirtualBox, I added part2Access.vmdk as a virtual disk by using File > Virtual Disk Manager > Add. Then I was able to add it as the IDE Primary Slave device for my Vista virtual machine:

And now when I run Vista in that virtual machine, it sees my NTFS partition on my hard disk as drive E:

VirtualBox is a great software and it save my life lot of time(!), I develope some old software written in VisualC++ inside VirtualBox+WinXP. There is only a big issue, VirtualBox under OpenSolaris can't access USB devices, not a big problem for me but cold be for a lot of users (ex. access to USB stick, iPod ecc...).

I run vbox over a Debian host with (at the moment) XP and Ubuntu and Kubuntu as guest VMs. I've run OpenSUSE11 and OpenSolaris10 in the past. In the future, who knows.

I simply configure shared folders to my /home/username directory and let all guest VM apps access all my user data. IMO, that's the whole point of desktop virtualization, to use the best available apps on a common data pool and not have to care which OS those apps are on.

I'm moving off VMware Server over their decision to scrap the console and make access to their VMs via crash-prone web browsers only.

Hi Luca - USB support when running VirtualBox on OpenSolaris is scheduled to be added to version 2.0 of VirtualBox. The target release date for version 2.0 of VirtualBox is August, 2008, so hopefully it will be available soon. HTH - Gregg

I was able to get Skype for Windows working on Ubuntu using VirtualBox Seamless Mode. I imagine this would work great on OpenSolaris too, as long as sound works properly. I wrote a blog entry about it. Click my name to read about it.

There is another method to access Windows partition without using Linux (in my installation I have WinXP + OpenSolaris), you need to:
install VirtualBox into WinXP
run the "VBoxManage internalcommands ..." replacing /dev/sda with \\\\.\\PhysicalDrive0.

You can use Win4Solaris instead of virtual box and you will get full USB support and you can even do crazy stuff like USB over IP! The only draw back is that Win4Solaris probably costs somewhere around $30 or $40 for a home license whereas VirtualBox is free.