Solarisのアップグレード

試してみたのはSolaris 10 U7 5/09 → Solaris 10 U8 10/09のアップグレード。

Liveupgradeを使えば、サービスを継続したままSolaris OSのアップグレードの準備をしサービス停止はOS再起動時間のみ、という謳い文句に惹かれてやってみた。
テスト環境なので、そもそもサービスはないけどね。

まず準備するもの

  • インストール済のSolaris環境。Solaris 2.6以降が対象。今回はSolaris 10 U7 (2009年05月版)。
  • アップグレード先のバージョンのSolarisのインストールパッケージ。通常はインストールメディア。今回はSolaris 10 U8 (2009年10月版)のDVDメディア。
  • (場合によって)Liveupgradeのパッケージ。通常はインストールメディアに入っている。

大まかな流れ

  1. 現在のSolaris環境にアップグレード先のバージョンのSolarisに対応したLiveupgradeをインストールする。準備したインストールメディアに入っているものを使うのがよい。
  2. Liveupgradeのツールを使ってアップグレード用ブート環境(Boot Environment = BE)を作成。
  3. アップグレード用ブート環境をアップグレード。
  4. アップグレード用ブート環境で起動するように設定変更。
  5. 再起動。
  6. 起動したらOSのアップグレードが終わっている。

実際の作業

一連の作業をする前の環境の確認。

今回ゾーンは使っていない。ZFSもインストールした直後の状態で、特別なことはしていない。
LiveupgradeのBEは1つも存在しない。

# cat /etc/release
                        Solaris 10 5/09 s10x_u7wos_08 X86
           Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
                        Use is subject to license terms.
                             Assembled 30 March 2009
# 
# uname -a
SunOS aki 5.10 Generic_139556-08 i86pc i386 i86pc
# 
# zoneadm list
global
# zfs list
NAME                       USED  AVAIL  REFER  MOUNTPOINT
rpool                     6.01G  8.26G  35.5K  /rpool
rpool/ROOT                4.01G  8.26G    18K  legacy
rpool/ROOT/s10x_u7wos_08  4.01G  8.26G  4.01G  /
rpool/dump                1.00G  8.26G  1.00G  -
rpool/export                37K  8.26G    19K  /export
rpool/export/home           18K  8.26G    18K  /export/home
rpool/swap                   1G  9.03G   244M  -
# 
# lucurr
ERROR: No boot environments are configured on this system
ERROR: cannot determine boot environment name for mount point </>
# lustatus
ERROR: No boot environments are configured on this system
ERROR: cannot determine list of all boot environment names
# 
アップグレード先Solaris対応Liveupgradeをインストール

一応と思ってやっているけど、見た感じ何年もバージョンが変わっていないので、既に入っているSolaris付属でOK。
ZFS対応は……呼び出される側のツールで吸収?

# ls /cdrom/sol_10_1009_x86/Solaris_10/Tools/Installers/
liveupgrade20  solaris
# sh /cdrom/sol_10_1009_x86/Solaris_10/Tools/Installers/liveupgrade20

Java Accessibility Bridge for GNOME loaded.



Solaris Web Start will assist you in installing software for Live Upgrade.

   <Press ENTER to continue>
Sun Microsystems, Inc.
Binary Code License Agreement
Live Upgrade
READ THE TERMS OF THIS AGREEMENT AND ANY PROVIDED
SUPPLEMENTAL LICENSE TERMS (COLLECTIVELY "AGREEMENT")
CAREFULLY BEFORE OPENING THE SOFTWARE MEDIA PACKAGE.  BY
OPENING THE SOFTWARE MEDIA PACKAGE, YOU AGREE TO THE TERMS
OF THIS AGREEMENT.  IF YOU ARE ACCESSING THE SOFTWARE
ELECTRONICALLY, INDICATE YOUR ACCEPTANCE OF THESE TERMS BY
SELECTING THE "ACCEPT" BUTTON AT THE END OF THIS
AGREEMENT.  IF YOU DO NOT AGREE TO ALL THESE TERMS,
PROMPTLY RETURN THE UNUSED SOFTWARE TO YOUR PLACE
OF PURCHASE FOR A REFUND OR, IF THE SOFTWARE IS ACCESSED
ELECTRONICALLY, SELECT THE "DECLINE" BUTTON AT THE END OF
THIS AGREEMENT.
1.  LICENSE TO USE.  Sun grants you a non-exclusive and
non-transferable license for the internal use only of the
accompanying software and documentation and any error
corrections provided by Sun (collectively "Software"), by the
number of users and the class of computer hardware for which

    <--[15%]--[ENTER To Continue]--[n To Finish]-->

the corresponding fee has been paid.
2.  RESTRICTIONS Software is confidential and copyrighted.
Title to Software and all associated intellectual property
rights is retained by Sun and/or its licensors.  Except as
specifically authorized in any Supplemental License Terms, you
may not make copies of Software, other than a single copy of
Software for archival purposes.  Unless enforcement is
prohibited by applicable law, you may not modify, decompile,
or reverse engineer Software.  Software is not designed or
licensed for use in on-line control of aircraft, air traffic,
aircraft navigation or aircraft communications; or in the
design, construction, operation or maintenance of any nuclear
facility.  You warrant that you will not use Software for these
purposes.  You may not publish or provide the results of any
benchmark or comparison tests run on Software to any third
party without the prior written consent of Sun.  No right,
title or interest in or to any trademark, service mark, logo or
trade name of Sun or its licensors is granted under this
Agreement.
3. LIMITED WARRANTY.  Sun warrants to you that for a period of

    <--[30%]--[ENTER To Continue]--[n To Finish]-->

ninety (90) days from the date of purchase, as evidenced by a
copy of the receipt, the media on which Software is furnished
(if any) will be free of defects in materials and workmanship
under  normal use.  Except for the foregoing, Software is
provided "AS IS".  Your exclusive remedy and Sun's entire
liability under this limited warranty will be at Sun's option
to replace Software media or refund the fee paid for Software.
4.  DISCLAIMER OF WARRANTY.  UNLESS SPECIFIED IN THIS
AGREEMENT, ALL EXPRESS OR IMPLIED CONDITIONS,
REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED
WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE
EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.
5.  LIMITATION OF LIABILITY.  TO THE EXTENT NOT PROHIBITED BY
LAW, IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY
LOST REVENUE, PROFIT OR DATA, OR FOR SPECIAL, INDIRECT,
CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
CAUSED REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF
OR RELATED TO THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF
SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.  In no

    <--[45%]--[ENTER To Continue]--[n To Finish]-->

event will Sun's liability to you, whether in contract, tort
(including negligence), or otherwise, exceed the amount paid by
you for Software under this Agreement.  The foregoing
limitations will apply even if the above stated warranty fails
of its essential purpose.
6.  Termination.  This Agreement is effective until terminated.
You may terminate this Agreement at any time by destroying all
copies of Software.  This Agreement will terminate immediately
without notice from Sun if you fail to comply with any
provision of this Agreement.  Upon Termination, you must
destroy all copies of Software.
7.  Export Regulations.  All Software and technical data
delivered under this Agreement are subject to US export control
laws and may be subject to export or import regulations in
other countries.  You agree to comply strictly with all such
laws and regulations and acknowledge that you have the
responsibility to obtain such licenses to export, re-export,
or import as may be required after delivery to you.
8.  U.S. Government Restricted Rights.  Use, duplication, or
disclosure by the U.S. Government is subject to restrictions

    <--[60%]--[ENTER To Continue]--[n To Finish]-->

set forth in this Agreement and as provided in
DFARS 227.7202-1 (a) and 227.7202-3(a) (1995), DFARS
252.227-7013 (c)(1)(ii)(Oct 1988), FAR 12.212 (a) (1995), FAR
52.227-19 (June 1987), or FAR 52.227-14(ALT III) (June 1987),
as applicable.
9.  Governing Law.  Any action related to this Agreement will
be governed by California law and controlling U.S. federal law.
No choice of law rules of any jurisdiction will apply.
10.  Severability. If any provision of this Agreement is held
to be unenforceable, This Agreement will remain in effect with
the provision omitted, unless omission would frustrate the
intent of the parties, in which case this Agreement will
immediately terminate.
11.  Integration.  This Agreement is the entire agreement
between you and Sun relating to its subject matter.  It
supersedes all prior or contemporaneous oral or written
communications, proposals, representations and warranties and
prevails over any conflicting or additional terms of any quote,
order, acknowledgment, or other communication between the
parties relating to its subject matter during the term of this

    <--[75%]--[ENTER To Continue]--[n To Finish]-->

Agreement.  No modification of this Agreement will be binding,
unless in writing and signed by an authorized representative
of each party.
For inquiries please contact: Sun Microsystems, Inc., 4150
Network Circle, Santa Clara, California 95054, U.S.A.
Sun Microsystems, Inc.
Supplemental Terms for
Live Upgrade
These terms and conditions for Live Upgrade supplement the
terms of the Binary Code License Agreement ("BCL").
Capitalized terms not defined herein will have the meanings
ascribed to them in the BCL.  These terms and conditions will
supersede any inconsistent or conflicting terms and conditions
in the BCL.
A.Source Code. Software may contain source code that, unless
expressly licensed for other purposes, is provided solely for
reference purposes pursuant to the terms of this Agreement.
Source code may not be redistributed unless expressly provided
for in this Agreement.
B.Third Party Code. Additional copyright notices and license

    <--[90%]--[ENTER To Continue]--[n To Finish]-->

terms applicable to portions of the Software are set forth in
the THIRDPARTYLICENSEREADME.txt file. In addition to any terms
and conditions of any third party opensource/freeware license
identified in the THIRDPARTYLICENSEREADME.txt file, the
disclaimer of warranty and limitation of liability provisions
in paragraphs 5 and 6 of the Binary Code License Agreement
shall apply to all Software in this distribution.
C.Termination for Infringement. Either party may terminate
this Agreement immediately should any Software become, or
in either party's opinion be likely to become, the subject
of a claim of infringement of any intellectual property right.
For inquiries please contact: Sun Microsystems, Inc., 4150
Network Circle, Santa Clara, California 95054, U.S.A.

   Enter 'y' to accept the license agreement. Enter 'n' to decline the license
   agreement and exit the install.y




IMPORTANT NOTICE

Patches Needed to Run Solaris Live Upgrade

Correct operation of Solaris Live Upgrade requires that a limited set of patch
revisions be installed for a given OS version.

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.

Live Upgrade may fail to work properly if the latest limited set of patch
revisions are not installed on this system.

   <Press ENTER to continue>

Please select the type of install to perform from the following choices:

Typical - Software will be installed with the most common
options.  Recommended for most users.

Custom - You may choose the options you want to install.
Recommended for advanced users.

1. Typical
2. Custom

   What would you like to do [1]? 

Checking disk space.


The following items will be installed:

Product: Live Upgrade
Location: /
Size: 2.23 MB
---------------------
     Live Upgrade (root)    976.23 KB
Live Upgrade (usr)    1.26 MB
Live Upgrade (config)    17.26 KB



Ready to Install

1. Install Now
2. Start Over
3. Exit Installation

   What would you like to do [1]? 

Installing Live Upgrade
|-1%--------------25%-----------------50%-----------------75%--------------100%|


Installation details:

     Product       Result     More Info
 1.  Live Upgrade  Installed  Available

 2.  Done

   Enter the number corresponding to the desired selection for more
   information, or enter 2 to continue [2]: 

#
アップグレード用BEの作成

lucreateにて作成する。それだけ。今まで1つもBEが無かったので、現在のものと、それをコピーしたものと2つ作成される。

# lucreate -c sol10u7_5_09 -n sol10u8_10_09
Checking GRUB menu...
Analyzing system configuration.
No name for current boot environment.
Current boot environment is named <sol10u7_5_09>.
Creating initial configuration for primary boot environment <sol10u7_5_09>.
The device </dev/dsk/c1t0d0s0> is not a root device for any boot environment; cannot get BE ID.
PBE configuration successful: PBE name <sol10u7_5_09> PBE Boot Device </dev/dsk/c1t0d0s0>.
Comparing source boot environment <sol10u7_5_09> 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 <sol10u8_10_09>.
Source boot environment is <sol10u7_5_09>.
Creating boot environment <sol10u8_10_09>.
Cloning file systems from boot environment <sol10u7_5_09> to create boot environment <sol10u8_10_09>.
Creating snapshot for <rpool/ROOT/s10x_u7wos_08> on <rpool/ROOT/s10x_u7wos_08@sol10u8_10_09>.
Creating clone for <rpool/ROOT/s10x_u7wos_08@sol10u8_10_09> on <rpool/ROOT/sol10u8_10_09>.
Setting canmount=noauto for </> in zone <global> on <rpool/ROOT/sol10u8_10_09>.
Saving existing file </boot/grub/menu.lst> in top level dataset for BE <sol10u8_10_09> 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 <sol10u8_10_09> in GRUB menu
Population of boot environment <sol10u8_10_09> successful.
Creation of boot environment <sol10u8_10_09> successful.
#
BEを作っただけの状態の確認
# lucurr
sol10u7_5_09
#
# lustatus
Boot Environment           Is       Active Active    Can    Copy      
Name                       Complete Now    On Reboot Delete Status    
-------------------------- -------- ------ --------- ------ ----------
sol10u7_5_09               yes      yes    yes       no     -         
sol10u8_10_09              yes      no     no        yes    -         
#
# zfs list
NAME                                     USED  AVAIL  REFER  MOUNTPOINT
rpool                                   6.01G  8.26G  35.5K  /rpool
rpool/ROOT                              4.01G  8.26G    18K  legacy
rpool/ROOT/s10x_u7wos_08                4.01G  8.26G  4.01G  /
rpool/ROOT/s10x_u7wos_08@sol10u8_10_09  63.5K      -  4.01G  -
rpool/ROOT/sol10u8_10_09                  82K  8.26G  4.01G  /
rpool/dump                              1.00G  8.26G  1.00G  -
rpool/export                              37K  8.26G    19K  /export
rpool/export/home                         18K  8.26G    18K  /export/home
rpool/swap                                 1G  9.03G   244M  -
# zoneadm list
global
# 
アップグレード用BEをアップグレード

アップグレード用に作成した方のBEを、インストールメディアを使ってアップグレード。
理由は判らないが、何度か失敗したので根気よく何度も実行(^^;

# luupgrade -u -n sol10u8_10_09 -s /cdrom/sol_10_1009_x86
System has findroot enabled GRUB
No entry for BE <sol10u8_10_09> in GRUB menu
Uncompressing miniroot
Copying failsafe kernel from media.
63093 ブロック
miniroot filesystem is <lofs>
Mounting miniroot at </cdrom/sol_10_1009_x86/Solaris_10/Tools/Boot>
Validating the contents of the media </cdrom/sol_10_1009_x86>.
The media is a standard Solaris media.
The media contains an operating system upgrade image.
The media contains <Solaris> version <10>.
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 <sol10u8_10_09>.
Checking for GRUB menu on ABE <sol10u8_10_09>.
Saving GRUB menu on ABE <sol10u8_10_09>.
Checking for x86 boot partition on ABE.
Determining packages to install or upgrade for BE <sol10u8_10_09>.
Performing the operating system upgrade of the BE <sol10u8_10_09>.
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 <sol10u8_10_09>.
Updating package information on boot environment <sol10u8_10_09>.
Package information successfully updated on boot environment <sol10u8_10_09>.
Adding operating system patches to the BE <sol10u8_10_09>.
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 successfull.
Configuring failsafe for system.
Failsafe configuration is complete.
INFORMATION: The file </var/sadm/system/logs/upgrade_log> on boot
environment <sol10u8_10_09> contains a log of the upgrade operation.
INFORMATION: The file </var/sadm/system/data/upgrade_cleanup> on boot
environment <sol10u8_10_09> contains a log of cleanup operations required.
INFORMATION: Review the files listed above. Remember that all of the files
are located on boot environment <sol10u8_10_09>. Before you activate boot
environment <sol10u8_10_09>, 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 <sol10u8_10_09> is complete.
Installing failsafe
Failsafe install is complete.
#
アップグレード用BEで起動するように変更

luativateで切り替えるだけ。

# luactivate sol10u8_10_09
System has findroot enabled GRUB
Generating boot-sign, partition and slice information for PBE <sol10u7_5_09>
Saving existing file </etc/bootsign> in top level dataset for BE <sol10u7_5_09> as <mount-point>//etc/bootsign.prev.
A Live Upgrade Sync operation will be performed on startup of boot environment <sol10u8_10_09>.

Generating boot-sign for ABE <sol10u8_10_09>
Saving existing file </etc/bootsign> in top level dataset for BE <sol10u8_10_09> as <mount-point>//etc/bootsign.prev.
Generating partition and slice information for ABE <sol10u8_10_09>
Copied boot menu from top level dataset.
Generating multiboot menu entries for PBE.
Generating multiboot 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/c1t0d0s0 /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 <sol10u8_10_09> successful.
#
再起動前の状態を確認
# lucurr
sol10u7_5_09
# lustatus
Boot Environment           Is       Active Active    Can    Copy
Name                       Complete Now    On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
sol10u7_5_09               yes      yes    no        no     -
sol10u8_10_09              yes      no     yes       no     -
#
# zfs list
NAME                                     USED  AVAIL  REFER  MOUNTPOINT
rpool                                   8.17G  6.10G    39K  /rpool
rpool/ROOT                              6.17G  6.10G    18K  legacy
rpool/ROOT/s10x_u7wos_08                6.85M  6.10G  4.02G  /
rpool/ROOT/sol10u8_10_09                6.16G  6.10G  4.10G  /
rpool/ROOT/sol10u8_10_09@sol10u8_10_09  2.06G      -  4.02G  -
rpool/dump                              1.00G  6.10G  1.00G  -
rpool/export                              37K  6.10G    19K  /export
rpool/export/home                         18K  6.10G    18K  /export/home
rpool/swap                                 1G  6.76G   349M  -
#
# zoneadm list
global
#
再起動

initが呼び出される必要があるのでinitか/sbin/shutdownで再起動。通常はshutdownで。
ここでinitを呼び出さないと切り替わらないので注意。

# shutdown -i 6 -y -g 0
再起動後に終わったことを確認

ちゃんとアップグレードされてたバージョン表記になっている。

# cat /etc/release
                       Solaris 10 10/09 s10x_u8wos_08a X86
           Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
                        Use is subject to license terms.
                           Assembled 16 September 2009
# uname -a
SunOS aki 5.10 Generic_141445-09 i86pc i386 i86pc
#
# zfs list
NAME                                     USED  AVAIL  REFER  MOUNTPOINT
rpool                                   8.25G  6.03G    40K  /rpool
rpool/ROOT                              6.24G  6.03G    18K  legacy
rpool/ROOT/s10x_u7wos_08                19.4M  6.03G  4.03G  /
rpool/ROOT/sol10u8_10_09                6.22G  6.03G  4.11G  /
rpool/ROOT/sol10u8_10_09@sol10u8_10_09  2.11G      -  4.02G  -
rpool/dump                              1.00G  6.03G  1.00G  -
rpool/export                              37K  6.03G    19K  /export
rpool/export/home                         18K  6.03G    18K  /export/home
rpool/swap                                 1G  6.69G   349M  -
# zoneadm list
global
#
# lucurr
sol10u8_10_09
# lustatus
Boot Environment           Is       Active Active    Can    Copy
Name                       Complete Now    On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
sol10u7_5_09               yes      no     no        yes    -
sol10u8_10_09              yes      yes    yes       no     -
#

後は不要になった、以前使っていたBEを削除するなりすればOK。

注意点

今回のようにディスク構成だと、lucreateで既存の環境用のBEとアップグレード用のBEが作られるが、
既存BEはそのままファイルの更新を行いアップグレード用BEには反映されない。
また逆にアップグレード用BEはアップグレードするが、当たり前のようにそれは既存BEへは反映されない。
#lucreateと同時に自動で行われるZFSスナップショット&クローンで別々にわかれるため。

そのため、既存BEでサービスを継続していて、再起動ののみのサービス停止を考えている場合は、
lucreate後のファイルの作成、削除、変更がアップグレードBEで使えないことを理解しておかないと、
再起動後のサービスの継続ができないかもしれない。

つまり、メールサーバのキューファイルを残したまま切り替えては行けないとか、そんな感じのこと。
共有ディスクなどアップグレードとは関係ないところに置いておけば、無問題。



他には、VirtualBox上でテストしていたためか、何度かOS丸ごとハングアップすることがあった。
少なくとも1回は確実にVirtualBoxのせい。そんなダイアログが出たから。
liveupgradeの処理90%超で出たりと、お涙頂戴物。
またマルチユーザモードのコンソールログインした場合は、liveupgradeコマンドがSegVで落ちた。これは何かSolarisの問題なんだろうな……