VirtualBox 4.1.6 postinstall fails on OpenSolaris snv 126

Discussions related to using VirtualBox on Solaris hosts.
Post Reply
Napalm_God
Posts: 9
Joined: 15. Dec 2008, 01:22

VirtualBox 4.1.6 postinstall fails on OpenSolaris snv 126

Post by Napalm_God »

I can't upgrade my VBox version to the latest 4.1.6.

Trying "pkgadd -d VirtualBox-4.1.6-SunOS-r74727.pkg" I get an this error:

## Installing part 1 of 1.
[ verifying class <none> ]
[ verifying class <manifest> ]
## Executing postinstall script.
Checking for older bits...
## Failed to detect the Solaris kernel version.
## ERROR!! Failed to remove older/partially installed bits.
pkgadd: ERROR: postinstall script did not complete successfully

I tried to uninstall the package with "pkgrm SUNWvbox" but I got this:

## Verifying package <SUNWvbox> dependencies in global zone
## Processing package information.
## Executing preremove script.
Removing VirtualBox services and drivers...
## Failed to detect the Solaris kernel version.
## Failed.
pkgrm: ERROR: preremove script did not complete successfully

Tried again after rebooting, without luck.

Never had this problem with any VBox version up to 4.1.4.

Any ideas/suggestion would be greatly appreciated.
Napalm_God
Posts: 9
Joined: 15. Dec 2008, 01:22

Re: VirtualBox 4.1.6 postinstall fails on OpenSolaris snv 12

Post by Napalm_God »

OK, so the culprit appears to be in vboxconfig.sh.

the get_sysinfo() function can't determine the OS version, so it aborts installation.

Removing the "!" from lines 226 & 230 resulted in installation completed, minus the USB portion.

Setting the script in debug mode, it seems that the error is produced because, apparently, in line 225:
PKGFMRI=`$BIN_PKG $BASEDIR_PKGOPT contents -H -t set -a name=pkg.fmri -o pkg.fmri pkg:/system/kernel 2> /dev/null`

the "-a" option is not supported. Go figure...

Anyway, since my solution seems too much of a workaround. Any better solution would be appreciated.

BTW, the get_sysinfo() function is the only piece of code that presents major differences in vboxconfig.sh between 4.1.4 and 4.1.6.

Any ideas/suggestions, anyone?
martyscholes
Posts: 202
Joined: 11. Sep 2011, 00:24
Primary OS: Solaris
VBox Version: PUEL
Guest OSses: Win 7, Ubuntu, Win XP, Vista, Win 8, Mint, Pear, Several Linux Virtual Appliances

Re: VirtualBox 4.1.6 postinstall fails on OpenSolaris snv 12

Post by martyscholes »

If you find an answer, please let me know. I successfully mangled my install so completely that it wouldn't work and wouldn't remove the 4.16 version. I run build 128a, but will be switching to Solaris 11 once Sun Ray software is validated against it.

In the end, I extracted the 4.14 package (thank goodness I keep the tar files around) to an alternate root and copied over the 4.14 vboxconfig.sh into the /opt/ tree long enough to uninstall the 4.16 version.

Honestly, how did the package get far enough into the install to leave a broken, unable to remove package? That this was possible is downright scary.

I may snap the boot environment and try again with your changes to the script, if I have the courage.
Ramshankar
Oracle Corporation
Posts: 793
Joined: 7. Jan 2008, 16:17

Re: VirtualBox 4.1.6 postinstall fails on OpenSolaris snv 12

Post by Ramshankar »

With pkg changing fluidly across internal builds with no real version numbers included in their binaries and no real way of our installer to detect the Solaris version it is being installed on gives us little room for completely stable VBox installers for all internal builds.

If "-a" is unsupported I'm guessing that "-o" will not work either. The only thing I can suggest at this point, is update to the latest S11 and retry. In the meantime I'll try to see if there is a way to workaround this without needing "-a" and "-o" and if dropping that really gives us the desired behaviour on the latest builds as well.
Oracle Corp.
Napalm_God
Posts: 9
Joined: 15. Dec 2008, 01:22

Re: VirtualBox 4.1.6 postinstall fails on OpenSolaris snv 12

Post by Napalm_God »

Hi Ramshankar,
wasn't the old method of determining the OS version (e.g. the one used in 4.1.4) good anymore?

BTW, I'll surely try and use the latest S11 as per your suggestion, but I'd like to remark that, as per VBox manual, the minimum requirement is OSOL 2008.05. I'm currently on 2009.06, so I should be good to go...

Mind you, this is not a critic to the VBox team: you're doing a great job and I would be out of luck on OSOL without VBox.
I really appreciate your work, as I'm sure the most of the Solaris community will.

This is just my 2 cents contribution to the development of the best (at least IMO) desktop virtualization environment. ;)
martyscholes
Posts: 202
Joined: 11. Sep 2011, 00:24
Primary OS: Solaris
VBox Version: PUEL
Guest OSses: Win 7, Ubuntu, Win XP, Vista, Win 8, Mint, Pear, Several Linux Virtual Appliances

Re: VirtualBox 4.1.6 postinstall fails on OpenSolaris snv 12

Post by martyscholes »

Mind you, this is not a critic to the VBox team: you're doing a great job and I would be out of luck on OSOL without VBox.
I really appreciate your work, as I'm sure the most of the Solaris community will.
I have to second that. As grumpy as I became when I had no VB for my users and a broken install, it would be much worse if VB wasn't even available.

It is better to have had VB and lost it then to have never had it in the first place, I guess.
Napalm_God
Posts: 9
Joined: 15. Dec 2008, 01:22

Re: VirtualBox 4.1.6 postinstall fails on OpenSolaris snv 12

Post by Napalm_God »

martyscholes wrote:If you find an answer, please let me know. I successfully mangled my install so completely that it wouldn't work and wouldn't remove the 4.16 version. I run build 128a, but will be switching to Solaris 11 once Sun Ray software is validated against it.
Marty, did you try my workaround to get the pkg to install? If you'd like, I can be more specific about what I've done. I might as well try and "transplant" the old get_sysinfo() function from 4.1.4 into 4.1.6 and see what happens...

I'm also thinking about experimenting with a different version of pkg. Maye trying to copy a newer version from Solaris Express would do... That would be a cleaner solution than messing with scripts left from a botched installation.
Ramshankar
Oracle Corporation
Posts: 793
Joined: 7. Jan 2008, 16:17

Re: VirtualBox 4.1.6 postinstall fails on OpenSolaris snv 12

Post by Ramshankar »

The reason we chose to get rid of the older way of "detecting" (if you can really call it that) is because relying on uname was just wrong. Sure, it worked for a long time but with Solaris 11, just out of the blue changed snv_XYZ numbers with a "11.0" and our package broke because of this.

We decided to use pkg's kernel package FMRI instead to get a reasonably reliable version information for the OS. The older method of using uname also is busted for remote/target installs (installing on a partition for example, we can't rely on using uname because the target isn't running/live).

The new method of detecting the version not only works for live installs, but pkg (SysV has this too) can determine the package versions on a non-live target.
Oracle Corp.
Napalm_God
Posts: 9
Joined: 15. Dec 2008, 01:22

Re: VirtualBox 4.1.6 postinstall fails on OpenSolaris snv 12

Post by Napalm_God »

So far, I found out that another bit that is not working is the 'pkg:/system/kernel' at the end.

Trying this:
tmp$ pkg contents -H -t set -o pkg.fmri pkg:/system/kernel

...I get this:
pkg: contents: no packages matching the following patterns you specified are
installed on the system. Try specifying -r to query remotely:

pkg:/system/kernel


Could anyone suggest a way to query the kernel package version on OSOL 2009.06 ???
Napalm_God
Posts: 9
Joined: 15. Dec 2008, 01:22

Re: VirtualBox 4.1.6 postinstall fails on OpenSolaris snv 12

Post by Napalm_God »

Anyway, after a bit of tinkering, I came to an (almost) perfect workaround.

Before proceeding, a bit of warning: my procedure essentially removes all checks about Solaris version, so you have to be sure beforehand that the OS version you're running is compatible with the version on VirtualBox you're installing (e.g. OSOL 2009.06, in my case, is supported).

Supposing you're operating in /tmp, perform the following:

0. create “test” dir
mkdir test


1. unpack pkg
pkgtrans VirtualBox-4.1.8-SunOS-r75467.pkg test/


2. edit /tmp/test/SUNWvbox/root/opt/VirtualBox/vboxconfig.sh as follows:

replace line 226:
if test ! -z "$PKGFMRI"; then
with following:
if test -z "$PKGFMRI"; then

replace line 230:
if test ! -z "$STR_KERN"; then
with following:
if test -z "$STR_KERN"; then

...effectively inverting the logic (removing the “!”).


3. edit /tmp/test/SUNWvbox/root/opt/VirtualBox/pkginstall.sh as follows:

replace line 35:
if test "$?" -eq 0; then
with following:
if test 1; then

replace line 588 (this is for USB support):
if test "$HOST_OS_MINORVERSION" -gt 123; then

with following:
if test 1; then


4. repack pkg
pkgtrans -s test/ VirtualBox-4.1.8-SunOS-r75467_repackaged.pkg

New pkg will be in test/

This way, you’ll be able to have the patched package, while preserving the original version.


5. install as usual. At the end you will receive an “Installation of <SUNWvbox> partially failed” error, but that's because the file size checks fail (because of the modifications) for vboxconfig.sh and pkginstall.sh.


6. have fun with your working VirtualBox. :)

Uninstall works perfectly, too.


EDIT: tested on VBox 4.1.8, working great!


MERRY CHRISTMAS EVERYBODY!!!
martyscholes
Posts: 202
Joined: 11. Sep 2011, 00:24
Primary OS: Solaris
VBox Version: PUEL
Guest OSses: Win 7, Ubuntu, Win XP, Vista, Win 8, Mint, Pear, Several Linux Virtual Appliances

Re: VirtualBox 4.1.6 postinstall fails on OpenSolaris snv 12

Post by martyscholes »

I am about to gain the courage to install 4.18. Has anyone tried it? I don't see fixes for this issue in the changelog.
Napalm_God
Posts: 9
Joined: 15. Dec 2008, 01:22

Re: VirtualBox 4.1.6 postinstall fails on OpenSolaris snv 12

Post by Napalm_God »

I'm currently using it with no issues.

Had to modify the pkg as described in my previous post, though.
Ramshankar
Oracle Corporation
Posts: 793
Joined: 7. Jan 2008, 16:17

Re: VirtualBox 4.1.6 postinstall fails on OpenSolaris snv 12

Post by Ramshankar »

I had to change the VBox Solaris installer to support one of our own older testboxes that ran a pre-S11 snv build.

Here is the diff. for those who need to manually adjust /opt/VirtualBox/vboxconfig.sh in order to uninstall the package from their systems.

Code: Select all

Index: trunk/src/VBox/Installer/solaris/vboxconfig.sh
===================================================================
--- a/trunk/src/VBox/Installer/solaris/vboxconfig.sh
+++ b/trunk/src/VBox/Installer/solaris/vboxconfig.sh
@@ -224,4 +224,14 @@
     if test -x "$BIN_PKG"; then
         PKGFMRI=`$BIN_PKG $BASEDIR_PKGOPT contents -H -t set -a name=pkg.fmri -o pkg.fmri pkg:/system/kernel 2> /dev/null`
+        if test -z "$PKGFMRI"; then
+            # Perhaps this is old pkg without '-a' option and/or system/kernel is missing and it's part of 'entire'
+            # Try fallback.
+            PKGFMRI=`$BIN_PKG $BASEDIR_PKGOPT contents -H -t set -o pkg.fmri entire | head -1 2> /dev/null`
+            if test -z "$PKGFMRI"; then
+                # Perhaps entire is conflicting. Try using opensolaris/entire.
+                # Last fallback try.
+                PKGFMRI=`$BIN_PKG $BASEDIR_PKGOPT contents -H -t set -o pkg.fmri opensolaris.org/entire | head -1 2> /dev/null`
+            fi
+        fi
         if test ! -z "$PKGFMRI"; then
             # The format is "pkg://solaris/system/kernel@0.5.11,5.11-0.161:20110315T070332Z"
The above works fine on snv_127.
Oracle Corp.
Post Reply