Wednesday, July 30, 2008

Upgrading OpenSolaris

Updated: Dec 12, 2008
OpenSolaris 2008.11 is officially out. Download link here. The new version is far superior than 2008.05 with a lot of new features and bug fixes.


I just upgraded my OpenSolaris box from build86 (the version installed from the CD image) to build 93. To get the build number of your existing system, use 'uname -v' and it will show 'snv_xx' where xx is the build number. This post only discusses the upgrade from snv_86 to snv_93.

The upgrade process is not straightforward. First of all, use 'upgrade all' or install the 'entire' package in Package Manager will render the system unbootable because of changes in GRUB boot system. Second, direct 'image-update' may also fail due to another bug. Therefore we will do the update manually by creating and updating another BE (Build Environment).

My main reference is this post from OpenSolaris forum. I will list (read: copy directly from the post) the instructions that worked for me. Despite the dollar sign ($) at the following commands, you need root privilege to proceed.

Again, standard warnings in place: back up your important data, don't believe anything on internet, use at your own risk, call your mum, yadi yada.

  1. Make sure the latest version of IPS software is installed

    $ BUILD=`uname -v | sed s/snv_//`
    $ pfexec pkg refresh
    $ pfexec pkg install SUNWipkg@0.5.11-0.$BUILD

  2. We will build our BE (Build Environment) manually:

    First, display the list of the existing BEs on the system

    $ beadm list
    BE Active Active on Mountpoint Space
    Name reboot Used
    ---- ------ --------- ---------- -----
    opensolaris yes yes legacy 2.23G

  3. Here we can see the machine only has one BE namely 'opensolaris'. We need to create another BE and populate it with build 93 files. After we are done, we tell opensolaris to boot the new BE in the next restarting of the machine. By convention, let's call the new BE 'opensolaris-'. Note the trailing hyphen (-).

  4. Execute the following sequence of commands to create, mount and update the new BE

    $ pfexec beadm create opensolaris-
    $ mkdir /tmp/mnt$$
    $ pfexec beadm mount opensolaris- /tmp/mnt$$
    $ pfexec pkg -R /tmp/mnt$$ image-update

  5. !!!IMPORTANT!!!: Failure to perform this step will render your machine a piece of dead meat. Update the GRUB configuration on your ZFS boot device(s):

    $ pfexec /tmp/mnt$$/boot/solaris/bin/update_grub -R /tmp/mnt$$

  6. Unmount and activate the newly created BE

    $ pfexec beadm unmount opensolaris-
    $ pfexec beadm activate opensolaris-

  7. [Optional] You can delete the old BE using beadm. Refer to the man page or google around...
  8. Reboot and you should be good to go. :)

No comments: