Wednesday, February 13, 2008

VirtualBox on Solaris - Virtualization Software - Installing VirtualBox on Solaris 10

While qemu + kqemu was sufficient for most tasks on Solaris hosts, VirtualBox tends to be faster and simpler to use.

Sneak peak and what VirtualBox can do for you:



VBox in seamless mode.



You get mouse integration, seamless mode, snapshots, shared clipboard and folders, Alt-Tabbing to Windows apps... Virtualbox has it all.

Grab the VirtualBox-opensolaris-amd64-1.5.51-r28040-beta.gz package, gunzip it and install the package as root:

# pkgadd -d VirtualBox-opensolaris-amd64-1.5.51-r28040-beta1
Of course, you'll need to add some libraries to your LD_LIBRARY_PATH:
solaris% ldd /opt/VirtualBox/VirtualBox | grep not
VBoxKeyboard.so => (file not found)
libqt-mt.so.3 => (file not found)
VBoxRT.so => (file not found)
VBoxREM.so => (file not found)
VBoxVMM.so => (file not found)
libX11.so.4 (SUNW_1.1) => (version not found)
VBoxXPCOM.so => (file not found)
Just grep the installed package contents database for the proper path, and export LD_LIBRARY_PATH
solaris% grep VBoxKeyboard.so /var/sadm/install/contents
/opt/VirtualBox/VBoxKeyboard.so f none 0755 root bin 57552 64233 1202698345 INNOvbox
solaris% ldd * | grep "not found"
[...]
solaris% LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/VirtualBox:/opt/VirtualBox/qtgcc/lib:/lib:/opt/sfw/lib
solaris% export LD_LIBRARY_PATH



Problem 1: the VBox.sh script relies on /bin/bash, change to /usr/bin/bash or /usr/bin/ksh.
Problem 2: VBoxDD.so needs a 64 bit libdlpi.so, but that's only been updated in OpenSolaris:

On Solaris 10 u4:
solaris% file /lib/libdlpi.so.1
/lib/libdlpi.so.1: ELF 32-bit LSB dynamic lib 80386 Version 1, dynamically linked, not stripped, no debugging information available
solaris% grep libdlpi.so.1 /var/sadm/install/contents
/lib/libdlpi.so.1 f none 0755 root bin 49784 28431 1168280598 SUNWcslr
solaris% pkginfo | grep SUNWcslr
system SUNWcslr Core Solaris Libraries (Root)
Easy fix :-). We download it from Nexenta!

http://archive.nexenta.org/elatte-unstable/base/sunwcslr

solaris% /usr/xpg4/bin/ar x sunwcslr_5.11.82-1_solaris-i386.deb
So we file the libs in data.tar - 64 bit:

solaris% tar -tf data.tar | grep libdlpi.so
./lib/amd64/libdlpi.so.1
./lib/libdlpi.so.1
./lib/amd64/libdlpi.so symbolic link to libdlpi.so.1
./lib/libdlpi.so symbolic link to libdlpi.so.1
solaris% tar xvf data.tar

solaris% file ./lib/amd64/libdlpi.so.1
libdlpi.so.1: ELF 64-bit LSB dynamic lib AMD64 Version 1 [CMOV], dynamically linked, not stripped, no debugging

Now we can start VirtualBox and run Vista on Solaris using virtualization :-).




If you want sound, install OSS.





As you can see, apart from the poor graphical performance (as expected from Virtualization software), performance is very good. Especially disk I/O.



And for all the people who wish to convert their VMware and QEmu virtual machines to Solaris / VirtualBox, read this.

Expect a FreeBSD version of VirtualBox soon.

Running Windows 2008 Enterprise and Vista Ultimate on VirtualBox:




If you want VirtualBox Guest Additions, just download a debian package or whatever, and use ar -x to unpack it. Grab the ISO and mount it in the virtual machine. You need them for AMD PCNet drivers (networking) on Vista and 2008 for example.


And, once VBoxGuest Additions are installed, you can work in seamless mode. It basically means the host and the guest Windows both appear on the same host desktop:






Shared folders:



Want to have some fun? Use VirtualBox virtual machines on ZFS with compression and snapshots :-). You'll get at least 1.5x compression with virtually no performance hit (less data to transfer == faster with a minor hit on CPU for compression / decompression).

Note: VirtualBox also released a 32 bit package for 32 bit x86 Solaris systems.

22 comments:

Piku said...

What computer did you run Vista on VirtualBox ? How many Ram and how does it feel ?

cmihai said...

It's quite responsive. As you can see, it gets pretty good scores, pretty close to what you'd get on real hardware (except for the video card, of course).

Machine is an simple IBM Intellistation, single core 3.4Ghz CPU, 4GB DDR-2 and 4 disks in RAID-10.

Piku said...

Wow, quite a machine. It had to run responsive.

As a small quirk for VirtualBox, on linux it doesn't support tickless-kernel which I use on my laptop.

cmihai said...

Performance is on par with VMware workstation from the benchmarks I've performed. You can use the tools I've posted to convert VMware machines to VirtualBox (or just restore a regular full system backup).

Either way, it's much much faster than qemu + kqemu, and it's lighter than VMware server. And it's free.

Plus it runs on MacOS, Solaris, Linux, Windows and soon FreeBSD hosts.

It also supports VTx extensions and has client additions (like VMware has VMware tools).

Piku said...

I think it's the only one with Seamless Mode. Does it work on Solaris ?

Any ideea on how KVM is performing ? Ubuntu chose KVM in Hardy instead of Xen as Fedora/RH.

cmihai said...

1. Install guest vbox additions

2. Use Solaris containers (zones).

See:
http://en.wikipedia.org/wiki/Comparison_of_virtual_machines

gheorghe said...

Hi,

A freebsd version would indeed be nice. I tried virtualbox about a year ago, and back then it couldn't run for 5 minutes witout crashing the gues OS.

If it really does work now, there's still crappy network support, it only supports nat and port forwarding, not bridge or stuff like that.

cmihai said...

Here are instructions for getting a very early version of the FreeBSD port:

http://www.virtualbox.org/wiki/FreeBSD%20build%20instructions
If you're familiar with development tools, give it a try.

cmihai said...

As you can see piku, seamless mode works perfectly :-). Very responsive also.

steveg said...

Be careful, I've just had some file corruption on my ZFS filesystem with shared folders - Win2000 guest on Solaris 10u4 host ("Value too large for defined data type" due to EOVERFLOW in stat64) - will be leaving alone for a while...

Anonymous said...

where did you find information about expectations for a freebsd port? This is the last thing i'm waiting for to totally switch to my bsd install :)

*any* information on this is appreciated

cmihai said...

http://www.virtualbox.org/wiki/FreeBSD%20build%20instructions

The FreeBSD build instructions are being worked on as the FreeBSD port advances.

If you like to help out with the FreeBSD port, please join the #vbox-dev irc channel or drop a mail on the development mailing list.

Mac said...

I tried install Virtual Box 1.6 on Solaris 10 U5. After creating/configure the VM, and tried to start it, I've got an error:
Unable to load R3 module /opt/VirtualBox/VBoxDD

VBox status code: -102 (VERR_FILE_NOT_FOUND)


then when I tried to issue ldd /opt/VirtualBox/VirtualBox | grep not
I've got the following output:

libX11.so.4 (SUNW_1.1) => (version not found)
libX11.so.4 (SUNW_1.1) => (version not found)
libX1i.so.5 (SUNW_1.1) => (version not found)
libXrender.so.1 (RENDER_-0.0) => (version not found)
libXrender.so.1 (RENDER_-0.5) => (version not found)
libXrender.so.1 (RENDER_-0.8) => (version not found)

and so on

I have add /usr/openwin/lib to LD_PATH_LIBRARY but it didn't help.

Anyone can help?

luc said...

same here (as same as mac). S10U5, Virtual Box 1.6, amd64 ... I used your workaround for 64bit missing libs. When I try to run a virtual machine then error message appered. :(

Unable to load R3 module ....
....

Bob Friesenhahn said...

I get the same problem with fully-patched Solaris 10U4 and amd64. It seems that the build was actually done on OpenSolaris.

Bob Friesenhahn said...

I also encountered the problem with failing to find the necessary X11 libraries on fully-patched Solaris 10U4.

I encountered the Unable to load R3 module /opt/VirtualBox/VBoxDD error message as well.

It seems that the amd64 build is actually done under OpenSolaris and not Solaris 10.

Anonymous said...

Mihai,
Can you get WinXP Pro via VirtualBox on a SunBlade 100 with Solaris 5.9 on it? Multumesc.

cmihai said...

Won't work using VirtualBox (para)virtualization.

VirtualBox requires a x86 host and guest (AMD64 is also x86, btw).

SunBlade 100 is a SPARC based machine, so you'd have to use an emulator like qemu-x86. While that would work, it will be quite slow.

Anonymous said...

Hi there. Good tutorial.

I was wondering if it's possible to run any VirtualBox VM while Solaris is booting?

Thanks.

cmihai said...

If you mean start virtual machines at host machine startup, sure.

VirtualBox uses a client/server architecture so all GUI commands are available via the API and the command line tools (VBoxManage) so it's easy to script.

It's up to you if you want to use the old fashion init or create SMF scripts for individual (or all) virtual machines.

http://www.sun.com/bigadmin/content/selfheal/smf-quickstart.html

srikanth said...

Is there a way to install VirtualBox as a non-root user? I use a Sun Ray at work and don't have root access. Thanks.

cmihai said...

While you can and should use VirtualBox as a non-root user you'll need root access to install the package (or if used from a tarball setup vboxusers user groups, device permissions, and so on). You could also try qemu.

See manual:
VirtualBox is available as a standard Solaris package. Download the VirtualBox SunOS package which includes both the 32-bit and 64-bit versions of VirtualBox. The installation must be performed as root and from the global zone as the VirtualBox installer loads kernel drivers which cannot be done from non-global zones.