Fixes for stock Oracle VirtualBox "vboxconfig.sh" script to work on non-Oracle Solaris relatives
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE
README.asciidoc
S98vbox-dualboot-xorg
vboxconfig.sh
vboxconfig.sh.patch
vboxconfig.sh.patch-20150309-vs-4.3.24
vboxconfig.sh.patch-20150624-vs-4.3.24

README.asciidoc

About

This repository contains the vboxconfig.sh script fixed to properly detect non-"Oracle Solaris 11" platforms during VirtualBox installations.

This script estimates the OS environment on the VirtualBox host and chooses which drivers to install and register, for Solaris ("SunOS" distro) in particular. In case of the extended Solaris family (based on the open-sourced illumos core) the original Sun/Oracle Solaris logic does not work well, so to cater for these systems some fixes were needed.

Flag-files

The original script supports influence on its configuration by having the administrator touch certain files before installation begins. This patch extends such approach with more files to touch (e.g. if your environment does not fit the expectations of the existing script).

Useful names (relative to the package installation root directory) include:

  • /etc/vboxinst_vboxflt — install NetFilter (STREAMS) networking module (applicable for illumos)

  • /etc/vboxinst_vboxbow — install CrossBow networking module (for Oracle Solaris 11 snv_159+)

  • /etc/vboxinst_vboxusb — force-attempt installation of the USBMonitor module and the USB module (otherwise requires that the script detects that your host kernel is at least Solaris 11 build 124 or Solaris 12)

Branches

The downloaded branch shall contain occasional snapshots of the script provided by the upstream VirtualBox downloadable distributions.

The illumos-fix is my work in progress as I develop and test the script, as well as rebase it to newer upstream versions over time.

The master branch is a sort of release variant of the illumos-fix — whatever seems stable enough to publish and use for everybody daring enough ;)

License

Common license for the script itself is GPLv2 as in VirtualBox OSE. Patch changes are released under MIT License so as to conform to contribution requirements for the upstream Oracle VirtualBox project.

In any case, I hope these changes would be found useful and might wind up in pre-packaged distributions, be it the original Oracle VirtualBox, or any of the OSE builds in illumos distributions.

Applying and using the patch to (un)install a VirtualBox package

There are two approaches: partially install the unmodified package, fail in the configuration step on an unsupported OS, patch the installed script and resume configuration to complete the installation, or to fix the SVR4 package file. The former is more simple in practice, while the latter is more suitable for distro maintainers or LAN admins who want to suffer the complicated procedure once per upgrade, not once per host.

Applying and using the patch to (un)install an unmodified VirtualBox package

Note
Thanks to "russell" from the OpenIndiana mailing list for pointing in the right direction for this simplified procedure.

If you can stand an "unclean" install/uninstall procedure, which is quite acceptable e.g. on a single-user desktop (as opposed to a VM server farm), you can follow this simple procedure:

  • Download this patch to your machine:

:; mkdir -p /var/tmp/vbox
:; cd /var/tmp/vbox
:; wget https://raw.githubusercontent.com/jimklimov/vboxconfig_sh/master/vboxconfig.sh.patch
  • If you have on old version of VirtualBox already installed, you have to uninstall it before upgrading. If pkgrm SUNWvbox fails, you may need to patch (or replace) the /opt/VirtualBox/vboxconfig.sh:

:; ( cd /opt/VirtualBox/ && gpatch -p1 ) < vboxconfig.sh.patch
patching file vboxconfig.sh

Note that some "fuzz" or "offset <by a small number of> lines" messages may be reported by gpatch. If they are not "FAILED", this is generally harmless. Complete uninstallation of old version with pkgrm SUNWvbox.

  • Install the new version according to standard procedure. Watch it fail to configure in the end.

  • Patch the newly installed /opt/VirtualBox/vboxconfig.sh following the procedure above, run it to complete the installation, and enable some new services installed as part of VirtualBox:

:; ( cd /opt/VirtualBox/ && gpatch -p1 ) < vboxconfig.sh.patch
:; ( cd /opt/VirtualBox/ && ./vboxconfig.sh --postinstall )
:; svcadm enable virtualbox/balloonctrl
:; svcadm enable virtualbox/zoneaccess
  • At this point, your update of VirtualBox core should be complete. Do not forget to proceed to updating the Extension Pack and/or Guest Additions, if applicable, as detailed below ;)

Applying and using the patch to install VirtualBox from the package file

If you like package installations to be marked clean and report no errors, you should patch the downloaded package to include the enhanced script.

Note
The instructions below were tested on an OpenIndiana Hipster 2015.0 installation and on an OmniOS Bloody 151015.
:; mkdir -p /var/tmp/vbox
:; cd /var/tmp/vbox
:; wget https://raw.githubusercontent.com/jimklimov/vboxconfig_sh/master/vboxconfig.sh.patch
:; wget -c http://dlc-cdn.sun.com/virtualbox/4.3.28/VirtualBox-4.3.28-100309-SunOS.tar.gz && \
   gzip -cd < "`ls -1 VirtualBox-*-SunOS.tar.gz | tail -1`" | tar xvf -

VirtualBox-4.3.28-SunOS-amd64-r100309.pkg
LICENSE
autoresponse
ReadMe.txt
  • Unpack the package into individual files (this creates a subdirectory named SUNWvbox under the target directory ./ in our example case):

:; yes '' | pkgtrans "`ls -1 VirtualBox-*-SunOS*pkg | tail -1`" ./
:; du -ks SUNWvbox/ ; find SUNWvbox/ | grep vboxconfig
210448  SUNWvbox/
SUNWvbox/root/opt/VirtualBox/vboxconfig.sh
  • Apply the patch:

:; ( cd SUNWvbox/root/opt/VirtualBox/ && gpatch -p1 ) < vboxconfig.sh.patch
patching file vboxconfig.sh

Note that some "fuzz" or "offset <by a small number of> lines" messages may be reported by gpatch. If they are not "FAILED", this is generally harmless.

  • Fix up the SVR4 package metadata (embed new size and checksum of the resulting file into the pkgmap):

:; CSSZ="$( /bin/cksum -B1 -s SUNWvbox/root/opt/VirtualBox/vboxconfig.sh | awk '{print $2" "$1}' )" && \
   echo "$CSSZ"
47288 14514

:; sed 's,^\(.* f .* /opt/VirtualBox/vboxconfig.sh [^ ]* [^ ]* [^ ]* \)\([^ ]* [^ ]* \)\([^ ]*\)$,\1'"$CSSZ "'\3,' \
    -i SUNWvbox/pkgmap

:; grep -i vboxconfig SUNWvbox/pkgmap
1 f none /opt/VirtualBox/vboxconfig.sh 0755 root bin 47288 14514 1431530679
Caution
The next step covers installation of the resulting patched package on a hypervisor host. Keep in mind that this process will disrupt networking, so initiate the installation only from an out-of-band connection (console) or at least a non-disruptable session (VNC, screen) so that the SSH link disconnection will not botch the installation.
  • Hope that all went well above, and install the package (in case of upgrading or retrying, remove an old one first):

:; cd /var/tmp/vbox && \
   if [ -d /var/sadm/pkg/SUNWvbox ] ; then yes y | pkgrm SUNWvbox ; fi && \
   yes '' | pkgadd -d . -a ./autoresponse
  • If you want to reuse the resulting package on several hosts, you can copy over the SUNWvbox subdirectory and install it in the same way as above, or you can pkgtrans it back into a single file for more convenient storage, e.g.:

:; pkgtrans . VirtualBox\-4.3.28\-SunOS\-amd64\-r100309-illumos.pkg SUNWvbox
Transferring <SUNWvbox> package instance

Updating the Extension pack

After updating the host software, if you’re using the PUEL-licensed extension pack, don’t forget to update it as well. A nice automation was posted on the VirtualBox forums https://forums.virtualbox.org/viewtopic.php?f=7&t=44337 by "Sasquatch":

#!/bin/bash
if version=$(VBoxManage -v) ; then
  echo $version
  var1=$(echo $version | cut -d 'r' -f 1)
  echo $var1
  var2=$(echo $version | cut -d 'r' -f 2)
  echo $var2
  file="Oracle_VM_VirtualBox_Extension_Pack-$var1-$var2.vbox-extpack"
  echo $file
  wget -c http://download.virtualbox.org/virtualbox/$var1/$file -O /tmp/$file
  sudo VBoxManage extpack uninstall "Oracle VM VirtualBox Extension Pack"
  sudo VBoxManage extpack install --replace /tmp/$file
fi

In many cases, a more simple incantation helps (assuming you are in the download directory where the extension pack file is present, and you do want the newest one:

  sudo VBoxManage extpack install --replace \
    "`ls -1 Oracle_VM_VirtualBox_Extension_Pack-* | tail -1`"

Updating Guest Additions

Do not forget to update VirtualBox Guest Additions on the virtual machines, this may be especially important for continued X11 guest desktop support, and you may need to reinstall the additions if your X11 server is updated.

On a guest (or dualboot) Solaris/illumos installation you’d do:

:; 7z x "`ls -1 VBoxGuestAdditions*.iso | tail -1`" VBoxSolarisAdditions.pkg && \
   yes | pkgrm SUNWvboxguest && \
   yes '' | pkgadd -d VBoxSolarisAdditions.pkg all

You’d likely have to reboot the guest to take advantage of the new vboxguest versions.

X.Org config file chooser for dual-booted VM/HW setups

I have an OI installation on a laptop alternately running as a VM or as a "physical" OS. One of the implications is that there are different preset X11 driver configurations relevant to different hardware. A nifty trick I saw advised on the internet was to add an init-script that would choose the suitable pre-made X11 config file and install it, before running GDM or equivalent graphics engine.

This is what S98vbox-dualboot-xorg script is intended for. Look in the sources for hints on configuration, and copy and tune the needed config files as /etc/X11/xorg.conf* names referenced in the script variables (as is, or renamed via its own optional simple config file).

On my laptop with a modular config I switch over the files which define just the Screen#0 /etc/X11/xorg.conf.d/00-common.conf{.vboxguest,.radeon} and keep the rest of device/card/monitor definitions in a common heap of nearby snippet-files. This can be achieved with a customized config file /etc/default/vbox-dualboot-xorg to define the virt/phys applicable filename patterns that you want to switch.

Fixing lack of GUI when executed with another user account

Every once in a while I have to use VirtualBox GUI as a root (e.g. when accessing dual-booted OSes that reside on raw partitions - and an unprivileged user reasonably has no access there.

So I sudo VirtualBox, and on an unprepared machine I see just the window with no elements, perhaps a popup I can not close (it is a message that VirtualBox can not find some disk images in my case, you can just press ESC to get rid of it) and tons of error messages like these below in the terminal which launched the GUI:

Qt WARNING: X Error: BadDrawable (invalid Pixmap or Window parameter) 9
  Major opcode: 62 (X_CopyArea)
  Resource id:  0x4000079
Qt WARNING: X Error: BadPixmap (invalid Pixmap parameter) 4
  Major opcode: 54 (X_FreePixmap)
  Resource id:  0x4000079
Qt WARNING: X Error: BadShmSeg (invalid shared segment parameter) 128
  Extension:    130 (MIT-SHM)
  Minor opcode: 2 (X_ShmDetach)
  Resource id:  0x4000079

The issue has to do with new shared memory policies in QT4 and non-root X server. The currently working solution (or at least workaround) is to export a variable in your shell (consider also adding it to your root account’s ~/.profile):

QT_X11_NO_MITSHM=1
export QT_X11_NO_MITSHM

Good luck, Jim Klimov


Original mailing-list announcement

slightly edited

* From: Jim Klimov
* To: vbox-dev@virtualbox.org
* Date: 9 Mar 16:09 2015
* Subj: Patch to support installation on non-Sun/Oracle Solaris hosts

Hello all,

I submit a patch which should simplify installation of modern VirtualBox
on some non-Oracle derivate distributions of Solaris which are known to
host VirtualBox just fine. Most of the patch deals with "proper" detection
of major and minor OS version numbers on those distributions. Also there
is now a touchable filename to enforce installation of USB filters and
corresponding UNIX group accounts, as a workaround for further distros
not detected as supported by even new code.

I submit this patch under the terms of MIT license.

This was last tested with VirtualBox 4.3.24 and OpenIndiana Hipster and
OmniOS Bloody, all updated today to the most current states available.

Note this was not yet tested in practice with OpenSolaris SXCE (yes, I do
have some running), although snippets were developed that should work there.
I don't expect there are many of those installations left beside my closet,
but those are all pleased with old VBox versions for now... ain't broke,
you know ;)

Hope this helps,
// Jim Klimov