Friday, June 29, 2012

VirtualBox on the global zone

It's relatively simple to have Solaris as a VirtualBox host.
Below is what I've found to be the cleaner steps for installation.
   
If upgrading, remove previous versions.
Each existing VM configuration won't be lost.
 
# pkgrm SUNWvbox
   
Download and extract it to an empty folder:
  
# tar xzf VirtualBox-<version>.tar.gz
 

The subsequent installation action (pkgadd) may create the directory /opt/VirtualBox. If you pre-created it as the mountpoint of a ZFS dataset dedicated to VirtualBox files, then make sure you adjust the ownership attributes (chgrp) to root:bin, otherwise the installation will fail.

Install the stream package:
  
# pkgadd -n -a autoresponse -d VirtualBox-<version>.pkg all
Checking package dependencies...
Done.
Checking for older bits...
   - Unloaded: Web service
   - Unloaded: Balloon control service
   - Unloaded: Zone access service
Installing new ones...
Detected Solaris 5.11 Version 175
Loading VirtualBox kernel modules...
   - Loaded: Host module
   - Loaded: NetAdapter module
   - Loaded: NetFilter (Crossbow) module
   - Loaded: USBMonitor module
   - Loaded: USB module
Configuring services...
   - Loaded: Zone access service
Installing MIME types and icons...
Installing Python bindings...
   - Installed: Bindings for Python 2.6
Updating the boot archive...
Installation of <SUNWvbox> was successful.
  
# pkginfo -l SUNWvbox
   PKGINST:  SUNWvbox
      NAME:  Oracle VM VirtualBox
  CATEGORY:  application
      ARCH:  i386
   VERSION:  5.0.16,REV=2016.03.04.18.00.105871
   BASEDIR:  /
    VENDOR:  Oracle Corporation
      DESC:  A powerful PC virtualization solution
    PSTAMP:  vbox20160304180116_r105871
  INSTDATE:  Mar 11 2016 00:11
   HOTLINE:  Please contact your local service provider
     EMAIL:  info@virtualbox.org
    STATUS:  completely installed
     FILES:      355 installed pathnames
                  12 linked files
                  23 directories
                  29 executables
                   6 setuid/setgid executables
              439160 blocks used (approx)


Install the extension pack:
  
# VBoxManage extpack install --replace
 
/.../..._VirtualBox_Extension_Pack-<version>.vbox-extpack
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Successfully installed "Oracle VM VirtualBox Extension Pack".
  
Check everything so far:
  
# VBoxManage list hostinfo | less
# VBoxManage list extpacks | less
# VBoxManage list systemproperties | less


Tune down ZFS ARC maximum bytes for better guests' performance:
(and let's say you set aside 5% to the kernel)
  
# grep zfs_arc_max /etc/system
set zfs:zfs_arc_max = 0.95 x (RAMphysical - RAMguests) in hexadecimal (0x...)
 
To find out the current zfs_arc_max value:
  
# C_MAX=`kstat -n arcstats |
         grep c_max |
         tr -s '[:space:]' |
         cut -f2 -d\ `
   
  • In gigabytes:
    # echo "scale=2; $C_MAX / 1024 ^ 3" | bc
     
  • In hexadecimal:
    # echo "obase=16; $C_MAX" | bc
     
NOTE
 
  • A desktop system is not needed as RDP is available.
  • Of course, other requirements can affect zfs_arc_max tuning.
  • Just for completeness, there exists a zfs_arc_min.
  • In Solaris 11.3 user_reserve_hint_pct supersedes  zfs_arc_max.