Thursday, August 21, 2008

Live Upgrade with ZFS root using SXCE (Nevada)

Couple of weeks ago I did a fresh install of "Solaris Express Community Edition snv_94" and selected ZFS root to see what it was like on my desktop. Then I thought I would upgrade to snv_95, but then I could not see any information about doing a live upgrade, what was I going to do!

After some searching I found a couple of old pages which hinted at it but not a full example, so there was only one way to find out......

Step-by-step guide.
  1. Download latest SXCE in this case sol-nv-b95-x86-dvd.iso
  2. Mount the ISO on the system
  3. # lofiadm -a /export/iso/sol-nv-b95-x86-dvd.iso
    /dev/lofi/1
    # mount -o ro -F hsfs -o ro /dev/lofi/1 /mnt
  4. Upgrade to the latest Live Upgrade Packages
  5. # pkginfo SUNWluu SUNWluzone SUNWlur SUNWlucfg
    application SUNWlucfg Live Upgrade Configuration
    application SUNWlur Live Upgrade (root)
    application SUNWluu Live Upgrade (usr)
    application SUNWluzone Live Upgrade (zones support)

    # pkgrm SUNWluu SUNWluzone SUNWlur SUNWlucfg
    # cd /mnt/Solaris_11/Product
    # pkgadd -d . SUNWlucfg SUNWlur SUNWluu SUNWluzone

  6. Now the fun! Create a new boot environment. lucreate has a new option -p which specifies the ZFS pool
  7. -p zfs_root_pool
    Specifies the ZFS pool in which a new BE will reside.
    This option can be omitted if the source and target BEs are within the same pool.
    e.g. lucreate -c b94 -n b95a -p newpool
    # lucreate -c b94 -n b95a
    Checking GRUB menu...
    System has findroot enabled GRUB
    Analyzing system configuration.
    Comparing source boot environment <b94> file systems with the file
    system(s) you specified for the new boot environment. Determining which
    file systems should be in the new boot environment.
    Updating boot environment description database on all BEs.
    Updating system configuration files.
    Creating configuration for boot environment <b95a>.
    Source boot environment is <b94>.
    Creating boot environment <b95a>.
    Cloning file systems from boot environment <b94> to create boot environment <b95a>.
    Creating snapshot for <rpool/root/snv_94> on <rpool/root/b95a@b95a>.
    Creating clone for <rpool/root/b95a@b95a> on <rpool/root/b95a>.
    Setting canmount=noauto for </> in zone <global> on <rpool/ROOT/b95a>.
    Saving existing file </boot/grub/menu.lst> in top level dataset for BE <b95a> as <mount-point>//boot/grub/menu.lst.prev.
    File </boot/grub/menu.lst> propagation successful
    Copied GRUB menu from PBE to ABE
    No entry for BE <b95a> in GRUB menu
    Population of boot environment <b95a> successful.
    Creation of boot environment <b95a> successful.

  8. Check all is well
  9. # lustatus
    Boot Environment           Is       Active Active    Can    Copy
    Name Complete Now On Reboot Delete Status
    -------------------------- -------- ------ --------- ------ ----------
    b94 yes yes yes no -
    b95a yes no no yes -

    # zfs list
    NAME                       USED  AVAIL  REFER  MOUNTPOINT
    rpool 112G 116G 41K /rpool
    rpool/ROOT 14.7G 116G 18K legacy
    rpool/ROOT/snv_94 14.6G 116G 6.78G /
    rpool/ROOT/b95a 81.8M 116G 9.51G /.alt.tmp.b-Cz.mnt/

  10. Now do the upgrade
  11. # luupgrade -u -n b95a -s /mnt
    System has findroot enabled GRUB
    No entry for BE <b95a> in GRUB menu
    Copying failsafe kernel from media.
    Uncompressing miniroot
    Uncompressing miniroot archive (Part2)
    13364 blocks
    Creating miniroot device
    miniroot filesystem is <ufs>
    Mounting miniroot at </mnt/Solaris_11/Tools/Boot>
    Mounting miniroot Part 2 at </mnt/Solaris_11/Tools/Boot>
    Validating the contents of the media </mnt>.
    The media is a standard Solaris media.
    The media contains an operating system upgrade image.
    The media contains <Solaris> version <11>.
    Constructing upgrade profile to use.
    Locating the operating system upgrade program.
    Checking for existence of previously scheduled Live Upgrade requests.
    Creating upgrade profile for BE <b95a>.
    Checking for GRUB menu on ABE <b95a>.
    Saving GRUB menu on ABE <b95a>.
    Checking for x86 boot partition on ABE.
    Determining packages to install or upgrade for BE <b95a>.
    Performing the operating system upgrade of the BE <b95a>.
    CAUTION: Interrupting this process may leave the boot environment unstable or unbootable.
    Upgrading Solaris: 100% completed
    Installation of the packages from this media is complete.
    Restoring GRUB menu on ABE <b95a>.
    Adding operating system patches to the BE <b95a>.
    The operating system patch installation is complete.
    ABE boot partition backing deleted.
    PBE GRUB has no capability information.
    PBE GRUB has no versioning information.
    ABE GRUB is newer than PBE GRUB. Updating GRUB.
    GRUB update was successful.
    Configuring failsafe for system.
    Failsafe configuration is complete.
    INFORMATION: The file </var/sadm/system/logs/upgrade_log> on boot environment <b95a> contains a log of the upgrade operation.
    INFORMATION: The file </var/sadm/system/data/upgrade_cleanup> on boot environment <b95a> contains a log of cleanup operations required.
    WARNING: <1> packages failed to install properly on boot environment <b95a>.
    INFORMATION: The file </var/sadm/system/data/upgrade_failed_pkgadds> on boot environment <b95a> contains a list of packages that failed to upgrade or install properly.
    INFORMATION: Review the files listed above. Remember that all of the files are located on boot environment <b95a>. Before you activate boot environment <b95a>, determine if any additional system maintenance is required or if additional media of the software distribution must be installed.
    The Solaris upgrade of the boot environment <b95a> is partially complete.
    Installing failsafe
    Failsafe install is complete.

  12. Check status
  13. # lustatus
    Boot Environment           Is       Active Active    Can    Copy      
    Name Complete Now On Reboot Delete Status
    -------------------------- -------- ------ --------- ------ ----------
    b94 yes yes yes no -
    b95a yes no no yes -

  14. If you want to look at the new filesystem
  15. # zfs mount rpool/ROOT/b95a
    # df -F zfs
    /                  (rpool/ROOT/snv_94   ):243553838 blocks 243553838 files
    /export (rpool/export ):243553838 blocks 243553838 files
    /export/home (rpool/export/home ):243553838 blocks 243553838 files
    /rpool (rpool ):243553838 blocks 243553838 files
    .alt.tmp.b-Cz.mnt (rpool/ROOT/b95a ):243553838 blocks 243553838 files
    # zfs unmount rpool/ROOT/b95a

  16. Make it live
  17. # luactivate b95a
    System has findroot enabled GRUB
    Generating boot-sign, partition and slice information for PBE <b94>
    Saving existing file </etc/bootsign> in top level dataset for BE <b94> as <mount-point>//etc/bootsign.prev.
    WARNING: <1> packages failed to install properly on boot environment <b95a>.
    INFORMATION: </var/sadm/system/data/upgrade_failed_pkgadds> on boot environment <b95a> contains a list of packages that failed to upgrade or install properly. Review the file before you reboot the system to determine if any additional system maintenance is required.

    Generating boot-sign for ABE <b95a>
    Saving existing file </etc/bootsign> in top level dataset for BE <b95a> as <mount-point>//etc/bootsign.prev.
    Generating partition and slice information for ABE <b95a>
    Copied boot menu from top level dataset.
    Generating direct boot menu entries for PBE.
    Generating xVM menu entries for PBE.
    Generating direct boot menu entries for ABE.
    Generating xVM menu entries for ABE.
    Disabling splashimage
    Re-enabling splashimage
    No more bootadm entries. Deletion of bootadm entries is complete.
    GRUB menu default setting is unaffected
    Done eliding bootadm entries.

    **********************************************************************
    The target boot environment has been activated. It will be used when you
    reboot. NOTE: You MUST NOT USE the reboot, halt, or uadmin commands. You
    MUST USE either the init or the shutdown command when you reboot. If you
    do not use either init or shutdown, the system will not boot using the
    target BE.
    **********************************************************************
    In case of a failure while booting to the target BE, the following process
    needs to be followed to fallback to the currently working boot environment:
    1. Boot from Solaris failsafe or boot in single user mode from the Solaris
    Install CD or Network.
    2. Mount the Parent boot environment root slice to some directory (like
    /mnt). You can use the following command to mount:

    mount -Fzfs /dev/dsk/c1d0s0 /mnt

    3. Run <luactivate> utility with out any arguments from the Parent boot environment root slice, as shown below:

    /mnt/sbin/luactivate

    4. luactivate, activates the previous working boot environment and indicates the result.

    5. Exit Single User mode and reboot the machine.

    **********************************************************************

    Modifying boot archive service
    Propagating findroot GRUB for menu conversion.
    File </etc/lu/installgrub.findroot> propagation successful
    File </etc/lu/stage1.findroot> propagation successful
    File </etc/lu/stage2.findroot> propagation successful
    File </etc/lu/GRUB_capability> propagation successful
    Deleting stale GRUB loader from all BEs.
    File </etc/lu/installgrub.latest> deletion successful
    File </etc/lu/stage1.latest> deletion successful
    File </etc/lu/stage2.latest> deletion successful
    Activation of boot environment <b95a> successful.
    #

  18. Reboot I see what happens.....

Wednesday, August 20, 2008

VirtualBox fails to run on snv_95 OpenSolaris

Just upgraded to snv_95 (SXCE: Nevada) and Virtualbox failed to start.

# VirtualBox
ERROR: 0 bytes read from child process

Failed to create the VirtualBox COM object.
Callee RC 0x80470007

After a panic, several reboots I found the web link which get me the solution:

http://www.virtualbox.org/ticket/1840

Summary:
========

Start VBoxSVC with environment variable LD_NODIRECT=1:

# cd /opt/VirtualBox
# mv VBoxSVC VBoxSVC.real
# cat > VBoxSVC
#!/bin/sh
LD_NODIRECT=1
export LD_NODIRECT
exec /opt/VirtualBox/VBoxSVC.real "$@"
^D
# chmod +x VBoxSVC