Live Update and Alternate Boot Environments

Print

Written by Greg King Saturday, 06 October 2012 13:25

DISCLAIMER! This document is nothing more than the musings of the author as he attempts to perform the stated tasks.  Conclusions and approaches
may very well be incorrect, inefficient, or otherwise outside of professionally accepted best practices. Use this document at your own risk! In this
document, screen outputs will be presented in green. Where keyboard input is required, the prompt will be in bolded red. # means you should be at the
super user prompt, $ means you should be at an
unprivileged
user prompt. Do not include these prompts in your input! The command to be typed will be
shown in blue.
# ls -al
means you type ls -al at the super user prompt.
The first thing we are going to do is configure our prompt so that it shows more useful information.

# export PS1='[\t \u@\h:\w] \$ '

our prompt now looks like this:

[21:18:56 root@12ADM:/] #

this tells us the time, who we are, what system we are on and what our working directory is.  This prompt is useful to me because my customer has asked that I keep time records on this process for planning purposes.  Combined with the script command we will be using, the time information will be automatically recorded.

You can input this line into your ~/.profile and it is set each time you login!

We are going to do some groundwork first.  The initial step is to create a log file of what we are doing.  We will use the script command for this.  The script command basically records all inputs and outputs from the screen into a file.  We can then look at the file and follow along with the commands being entered and the system output.  This is very useful for troubleshooting.  We are going to name the file so that it is timestamped, includes some system info, etc.

# script ./`hostid`.lu147440-23.`date '+%Y%m%d'`

Please note in the above command, we use the tick ` (unshifted tilde ~ key) and a single quote ' (unshifted double quote " key).  In my case, it will capture all terminal communication into a file called 835b7001.lu147440-23.20121007. Notice that your prompt changes slightly to signify that you are capturing the output.

Next we are going to capture some useful information into our script file.  This is so we can troubleshoot if problems arise. We are collecting the system name, release information about, disk space free, any services not properly running and the status of our zpool).

# uname -a
# cat /etc/release
# df -h
# svcs -xv
# zpool status -v rpool


The results of this all follow here
bash-3.2# uname -a
SunOS 12ADM 5.10 Generic_147440-01 sun4u sparc SUNW,Sun-Blade-1500

bash-3.2# cat /etc/release
Oracle Solaris 10 8/11 s10s_u10wos_17b SPARC
Copyright (c) 1983, 2011, Oracle and/or its affiliates. All rights reserved.
Assembled 23 August 2011

bash-3.2# df -h
Filesystem             size   used  avail capacity  Mounted on
rpool/ROOT/s10s_u10wos_17b 125G   9.9G   113G     9%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   2.0G   432K   2.0G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/platform/sun4u-us3/lib/libc_psr/libc_psr_hwcap1.so.1 123G   9.9G  
113G     9%    /platform/sun4u-us3/lib/libc_psr.so.1
/platform/sun4u-us3/lib/sparcv9/libc_psr/libc_psr_hwcap1.so.1 123G  9.9G
113G     9%    /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                   2.0G    32K   2.0G     1%    /tmp
swap                   2.0G    40K   2.0G     1%    /var/run
rpool/export           125G    32K   113G     1%    /export
rpool/export/home      125G    35K   113G     1%    /export/home
rpool/flar             125G    31K   113G     1%    /flar
rpool/jumpstart        125G    31K   113G     1%    /jumpstart
rpool                  125G   106K   113G     1%    /rpool

bash-3.2# svcs -xv
svc:/application/print/server:default (LP print server)
State: disabled since Sat Oct 06 23:29:10 2012
Reason: Disabled by an administrator.
See: http://sun.com/msg/SMF-8000-05
See: man -M /usr/share/man -s 1M lpsched
Impact: 2 dependent services are not running:
 svc:/application/print/rfc1179:default
 svc:/application/print/ipp-listener:default

bash-3.2# zpool status -v rpool
pool: rpool
state: ONLINE
 scan: none requested
config:
NAME          STATE     READ WRITE CKSUM
rpool         ONLINE       0     0     0
mirror-0    ONLINE       0     0     0
c0t0d0s0  ONLINE       0     0     0
c0t1d0s0  ONLINE       0     0     0

errors: No known data errors

bash-3.2#
script done on Sun Oct 07 00:32:30 2012

Check: Do we have Boot Environments?

Perform the following command.  If the output indicates there are no boot environments, we have to create one.  Otherwise we skip to the next step.

I have had problems creating boot environments in the past.  The error occurs when it attempts to create the temporary directory for the ABE.  After research I discovered that the problem was with my default umask.  I recommend the following command be issued prior to beginning the abe creation.

# umask 022

# lustatus
ERROR: No boot environments are configured on this system
ERROR: cannot determine list of all boot environment names
Since there are no boot environments defined, we have to create one.  If the above command shows boot environments, you can skip this next command.

# lucreate -c BE_147440-09 -n BE_147440-23
Analyzing system configuration.
No name for current boot environment.
Current boot environment is named <BE_147440-09>.
Creating initial configuration for primary boot environment <BE_147440-09>.
INFORMATION: No BEs are configured on this system.
The device </dev/dsk/c0t0d0s0> is not a root device for any boot environment; cannot get BE ID.
PBE configuration successful: PBE name <BE_147440-09> PBE Boot Device </dev/dsk/c0t0d0s0>.
Updating boot environment description database on all BEs.
Updating system configuration files.
Creating configuration for boot environment <BE_147440-23>.
Source boot environment is <BE_147440-09>.
Creating file systems on boot environment <BE_147440-23>.
Populating file systems on boot environment <BE_147440-23>.
Analyzing zones.
Duplicating ZFS datasets from PBE to ABE.
Creating snapshot for <rpool/ROOT/s10s_u10wos_17b> on <rpool/ROOT/s10s_u10wos_17b@BE_147440-23>.
Creating clone for <rpool/ROOT/s10s_u10wos_17b@BE_147440-23> on <rpool/ROOT/BE_147440-23>.
Mounting ABE <BE_147440-23>.
Generating file list.
Finalizing ABE.
Fixing zonepaths in ABE.
Unmounting ABE <BE_147440-23>.
Fixing properties on ZFS datasets in ABE.
Reverting state of zones in PBE <BE_147440-09>.
Making boot environment <BE_147440-23> bootable.
Population of boot environment <BE_147440-23> successful.
Creation of boot environment <BE_147440-23> successful.
Now that we have created a boot environment, our lustatus output looks different.

# lustatus
Boot Environment           Is       Active Active    Can    Copy      
Name                       Complete Now    On Reboot Delete Status    
-------------------------- -------- ------ --------- ------ ----------
BE_147440-09               yes      yes    yes       no     -         
BE_147440-23               yes      no     no        yes    - 


Patch for live updating

When I created the flar image I used on 12ADM, I included the recommended patch set in /var/tmp.  I will change things when my long awaited NAS system shows up, but at this point you need to either mount the cd or somehow get to the recommended patches.  I my case, they are in /var/tmp.

# cd /var/tmp
# ./installpatchset --apply-prereq --s10patchset


In my case, since I did the above on the original system and used the flar from that box to create the one I am working on, these steps weren't necessary.  I included the steps here to ensure this was done.

Now, we are going to apply all of the patches on 10_Recommended patchset to our newly created boot image. 

# ./installpatchset -d -B BE_147440-23 --s10patchset

A long an tedious output was omitted!

# luactivate BE_147440-23

A Live Upgrade Sync operation will be performed on startup of boot environment <BE_147440-23>.
**********************************************************************
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. Boot the machine to Single User mode using a different boot device (like the Solaris Install CD or Network). Examples:

 At the PROM monitor (ok prompt):
 For boot to Solaris CD:  boot cdrom -s
 For boot to network:     boot net -s

3. Mount the Current boot environment root slice to some directory (like
/mnt). You can use the following commands in sequence to mount the BE:

zpool import rpool
zfs inherit -r mountpoint rpool/ROOT/s10s_u10wos_17b
zfs set mountpoint=<mountpointName> rpool/ROOT/s10s_u10wos_17b
zfs mount rpool/ROOT/s10s_u10wos_17b

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

<mountpointName>/sbin/luactivate

5. luactivate, activates the previous working boot environment and
indicates the result.
6. Exit Single User mode and reboot the machine.
**********************************************************************
Modifying boot archive service
Activation of boot environment <BE_147440-23> successful.
# CTRL-D (hold the control key and hit d)

# init 6

The system will now reboot into the new image.

  Solaris Lab