Solaris Live Upgrade
In the following post I’d like to go through in a step-by-step manner an upgrade process of Solaris OS. My goal is to jump from Solaris 9 right into Solaris 10 wagon and cause as minimal downtime as possible. To achieve that goal I will be using Solaris Live Upgrade facility together with Solaris flash archive to update a freshly born boot environment or BE for short.
Lets start our engines, gents. First of all, double check that 137477-01 or later patch (for SPARC) is installed which adds p7zip support to your systems. Otherwise, since Live Upgrade depends on p7zip, the upgrade process would fail.
showrev -p | grep 137477 Patch: 137477-01 Obsoletes: Requires: Incompatibles: Packages: SUNWbzip, SUNWsfman
Looks like we are good to go and could proceed with required packages installation. Here we have several options: either to use pkgadd command or have everything being done by liveupgrade20 utility but whatever route you’ll choose it’s always a good practice to remove the previous versions if there are any:
# pkgrm SUNWlucfg SUNWluu SUNWlur
And only after that it’s safe to install the new packages. Btw, keep in mind that you have to use the packages from the release you’re upgrading to.
# pkgadd -d path_to_packages SUNWlucfg SUNWlur SUNWluu
As I mentioned before, there is another option to install Live Upgrade packages using liveupgrade20 script:
# cd /path_to/Solaris_10/Tools/Installers # ./liveupgrade20 -nodisplay Solaris Web Start will assist you in installing software for Live Upgrade.
Take a heed to the following warning:
Before installing or running Live Upgrade, you are required to install a limited set of patch revisions. Make sure you have the most recently updated patch list by consulting sunsolve.sun.com. Search for the info doc 72099 on the SunSolve(tm) web site.
I prefer to just save the list of all required patches into a file and use an one-liner:
# for p in `cat patch.list | awk '{print $1}' | grep -v "^$" | cut -f1 -d\-`; do showrev -p | /usr/xpg4/bin/grep -q $p; echo "$p - $?"; done 115689 - 0 112951 - 0 113713 - 0 113280 - 0 114482 - 0 114329 - 0 114636 - 0 114006 - 0 113023 - 1 113859 - 0 137477 - 0 112966 - 0 112233 - 0 117426 - 0
Since neither of SUNWcbcp, SUNWcwbcp, SUNWhbcp, SUNWhwbcp, SUNWkbcp, or SUNWkwbcp packages are installed I could skip patch 113023 safely.
And now goes most magical part which involves lucreate command. But before creating a new BE make sure that the new home for it has been prepared and partitioned properly in accordance with your needs.
I used the following command to create a new BE:
# lucreate -c Solaris9 -n Solaris10 -C /dev/dsk/c2t0d0s0 -m /:/dev/dsk/c3t0d0s0:ufs -m /var:/dev/dsk/c3t0d0s3:ufs -m -:/dev/dsk/c3t0d0s1:swap
Let me elaborate a bit and explain what the above command actually does. Since my goal was to create a new BE I also want to have some means to distinguish the current and the new BEs from each other. To be able to do that we could assign our BEs each own name and that’s why there are -c and -n options. They tell which names should be applied to the current, -c options, and the new one, -n, boot environments. -C option deliberately points to my boot device for source BE. And finally, -m options explicitly hints lucreate what partitions, in our case it’s / and /var, we’re about to copy, which target devices it should copy to, /dev/dsk/c3t0d0s0 and /dev/dsk/c3t0d0s3 respectively, and tells it to create the file system as the UFS volumes. With swap it’s slightly different because by default all swap partitions on a UFS-based source BE are shared with a UFS-based target BE. That means that it’s up to you to decide whether or not you need an absolutely dedicated swap partition for your new BE. If the answer is affirmative, then you have to explicitly specify it, e.g. -m -:/dev/dsk/c3t0d0s1:swap. All that and more, i.e. how to merge and split partitions, create SVM mirrors, etc., is explained in lucreate(1M) man page.
One more thing to keep in mind before you’ll go and press enter – double check that all your target partitions have “wm” flag. Otherwise you will receive an error similar to this one:
Template entry /var:/dev/dsk/c3t0d0s3:ufs skipped.
luconfig: ERROR: Template filesystem definition failed for /var, all devices are not applicable..
ERROR: Configuration of boot environment failed.
When lucreate finishes it’s time to proceed with the final step – upgrading BE.
It’s wise to do a dry-run before jumping into a fray and that’s why there is an option -N in the first command.
# luupgrade -N -f -n Solaris10 -s /install/Sun/install_server/10 -a /bigfs/sun4u.Solaris_10u8.vxvm5mp3rp2_nbclient65.flar
Quick information about other options I used for luupgrade:
-f install an operating system from a Solaris Flash archive. -n BE_name Name of the BE to receive an OS installation. -s os_image_path Path name of a directory containing an OS image. This can be a directory on an installation medium such as a CD-ROM or can be an NFS or UFS directory. -a archive Path to the Solaris Flash archive when the archive is available on the local file system.
Since the dry-run finished with no errors it’s time for the real thing:
# luupgrade -f -n Solaris10 -s /install/Sun/install_server/10 -a /bigfs/sun4u.Solaris_10u8.vxvm5mp3rp2_nbclient65.flar
Once it’s done, we need to make our new BE active after the reboot. With lustatus it’s possible to check the current status of all BEs:
# lustatus Boot Environment Is Active Active Can Copy Name Complete Now On Reboot Delete Status -------------------------- -------- ------ --------- ------ ---------- Solaris9 yes yes yes no - Solaris10 yes no no yes - # luactivate -n Solaris10 A Live Upgrade Sync operation will be performed on startup of boot environment. ********************************************************************** 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. Enter the PROM monitor (ok prompt). 2. Change the boot device back to the original boot environment by typing: setenv boot-device /pci@8,700000/pci@3/scsi@2/disk@0,0:a 3. Boot to the original boot environment by typing: boot ********************************************************************** Modifying boot archive service Activation of boot environment successful. # lustatus Boot Environment Is Active Active Can Copy Name Complete Now On Reboot Delete Status -------------------------- -------- ------ --------- ------ ---------- Solaris9 yes yes no no - Solaris10 yes no yes no -
Here is the output from the console which clearly shows what’s going on in the background.
Live Upgrade: Deactivating current boot environment
.
Live Upgrade: Executing Stop procedures for boot environment.
Live Upgrade: Current boot environment is.
Live Upgrade: New boot environment will be.
Live Upgrade: Activating boot environment.
Creating boot_archive for /.alt.tmp.b-RNc.mnt
updating /.alt.tmp.b-RNc.mnt/platform/sun4u/boot_archive
Live Upgrade: The boot device for boot environmentis
.
Live Upgrade: Activation of boot environmentcompleted.
Groovy! Let’s rock and init 6 ;-)
# cat /etc/release Solaris 10 10/09 s10s_u8wos_08a SPARC Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms. Assembled 16 September 2009