Go to main content

Adding and Updating Software in Oracle® Solaris 11.3

Exit Print View

Updated: September 2018
 
 

Updating to a Version Older Than the Newest Version Allowed

Sometimes you do not want to update to the newest version allowed. This section describes methods to update to a version that is older than the newest version allowed:

  • Specify the version in the update command. This is the simplest method with no lasting side effects.

  • Specify a version limit prior to giving the update command. This method uses pkg freeze, and therefore you need to remember to unfreeze later when you want to update to a newer version.

  • Use an Oracle Solaris constraint package. Using a constraint package is the most scalable, controllable, and trackable method.

  • Use a custom constraint package. Using a constraint package is the most scalable, controllable, and trackable method.

Specifying the Version to Install

A simple way to update to a version that is older than the newest version allowed is to specify the package name on the pkg update command, including a portion of the version string. The following example shows how to specify the version of the pkg:/entire constraint package to update to Oracle Solaris 11.3 SRU 13, even though a newer version would be allowed:

$ pkg update -nv entire@0.5.11,5.11-0.175.3.13 '*'
            Packages to remove:        2
           Packages to install:        1
            Packages to update:      486
     Estimated space available: 48.39 GB
Estimated space to be consumed:  2.50 GB
       Create boot environment:      Yes
     Activate boot environment:      Yes
Create backup boot environment:       No
          Rebuild boot archive:      Yes

Changed packages:
solaris
...
  entire
    0.5.11,5.11-0.175.0.10.0.5.0:20120803T182627Z -> 0.5.11,5.11-0.175.3.13.0.4.0:20160929T175502Z
... 

Be sure to use the -nv options and check the output before performing the actual update. When you perform the actual update, use the --be-name option to give the new BE a meaningful name.

Some installed packages might not be dependent on any package that is constrained by the entire constraint package. Those packages will not be updated by updating just the entire package. You can add those packages by name to the same pkg update command or specify * in addition to entire@version.


Note -  Specifying a version constraint at the command line is not the best way to manage a large number of systems. The best scalable solution is to use a constraint package as described in Using an Oracle Solaris Constraint Package and Installing a Custom Constraint Package.

Specifying a Version Constraint Prior to Updating

If you want to allow updates to any Oracle Solaris 11.2 version but not allow update to Oracle Solaris 11.3, you can freeze the pkg:/entire constraint package as shown in the following command. Specifying 0.175.2 means the entire package can be updated to 0.175.2.15, for example, but not to 0.175.3.

$ pkg freeze -c "Keep this image at 11.2." entire@0.5.11,5.11-0.175.2
entire was frozen at 0.5.11,5.11-0.175.2
$ pkg freeze
NAME    VERSION             DATE                     COMMENT
entire  0.5.11,5.11-0.175.2 30 Jan 2014 15:50:01 PST Keep this image at 11.2.
$ pkg list entire
NAME (PUBLISHER)  VERSION                       IFO
entire            0.5.11,5.11-0.175.2.10.0.5.0  if-

For more information about package freezing, see Locking Packages to a Specified Version.

To update beyond Oracle Solaris 11.2, you will need to pkg unfreeze entire or freeze entire at a newer version.


Note -  Freezing a package is not the best way to manage a large number of systems. The best scalable solution is to use a constraint package as described in Using an Oracle Solaris Constraint Package and Installing a Custom Constraint Package.

Using an Oracle Solaris Constraint Package

Similar to using the pkg freeze command as shown in the previous section, you can install a package that constrains the version of pkg:/entire that can be installed. See Constraint Packages for more information about constraint packages and their use in Oracle Solaris.

Oracle Solaris 11.3 provides a package that constrains pkg:/entire to any version of Oracle Solaris 11.3.

$ pkg list -s solaris-11.3
NAME (PUBLISHER)                 SUMMARY
release/constraint/solaris-11.3  Constraint Package for Oracle Solaris 11.3

The content of this package shows that if you install this package, you will be able to update your system to any Oracle Solaris 11.3 release (entire@0.5.11-0.175.3), such as an Oracle Solaris 11.3 SRU, but not to any newer Oracle Solaris 11.n release.

$ pkg contents -m solaris-11.3
set name=pkg.fmri value=pkg://solaris/release/constraint/solaris-11.3@0,5.11:20161021T222558Z
set name=pkg.summary value="Constraint Package for Oracle Solaris 11.3"
set name=variant.arch value=sparc value=i386
set name=pkg.depend.install-hold value=core-os
depend fmri=entire@0.5.11-0.175.3 type=incorporate
depend fmri=entire type=require
  • If you install the solaris-11.3 package and then attempt to update when you already have the newest available Oracle Solaris 11.3 release installed, you will receive a message that no updates are available.

  • If you install the solaris-11.3 package and then attempt to update to a newer Oracle Solaris 11.n release, you will receive a message that your system is overly constrained. To update to a newer Oracle Solaris 11.n release, you must first uninstall the solaris-11.3 constraint package.

Installing a Custom Constraint Package

Similar to using the Oracle Solaris constraint packages described in the previous section, you can create your own custom constraint package to specify the constraints you want. You might want to specify a constraint that is different from the constraints that are available in Oracle Solaris packages.

  • Create the constraint package and install the package from a local IPS package repository or package archive file.

  • To change the constraints, modify and redeliver the custom constraint package, and use pkg update to install the new constraint package.

Using a custom constraint package to control the version of software that can be installed enables you to easily maintain different versions of Oracle Solaris on different systems without maintaining multiple package repositories. Each system can install a different version of the custom update control package. All systems share the same package repository that contains all versions of software needed by any of the systems.

Create a Custom Constraint Package

The versions of core operating system packages that can be installed in an image are controlled by the pkg:/entire constraint package. To control system upgrades, create a package that specifies a particular version of the entire package as an incorporate dependency.

Create the Custom Constraint Package Manifest

The following example shows a manifest named upgradectrl.p5m for a custom constraint package that controls the version of the pkg:/entire package that can be installed. Some of the settings in this manifest are described below.

set name=pkg.fmri value=upgradectrl@1.0
set name=pkg.summary value="Package to constrain the version of the OS"
set name=pkg.description value="This package controls the version of \
pkg://solaris/entire that can be installed."
set name=info.classification value="org.opensolaris.category.2008:Meta Packages/Incorporations"
set name=pkg.depend.install-hold value=core-os
set name=variant.opensolaris.zone value=global value=nonglobal
set name=variant.arch value=sparc value=i386
depend fmri=feature/package/dependency/self type=parent variant.opensolaris.zone=nonglobal
depend fmri=pkg://solaris/entire type=require
depend fmri=pkg://solaris/entire@0.5.11,5.11-0.175.1.0 type=incorporate
pkg.depend.install-hold

If a user enters the pkg update upgradectrl command, the pkg:/entire package is automatically updated as well.

variant.opensolaris.zone

This package can be installed in both global and non-global zones. See also the description of the parent dependency.

variant.arch

This package can be installed on both SPARC and x86 systems.

parent dependency

This package can be installed in a non-global zone only if it is already installed in the global zone.

require dependency

The upgradectrl package can be installed only if the pkg://solaris/entire package is already installed or can be installed in this same operation.

incorporate dependency

The pkg://solaris/entire package must be installed at the specified version. More than one version can satisfy an incorporate dependency, depending on how many places of accuracy are specified. In this example, 0.175.1.0 specifies Oracle Solaris 11.1 SRU 0. This upgrade control package will keep systems at Oracle Solaris 11.1 with no support updates. This upgrade control package will, however, allow packages that are not constrained by the pkg:/entire constraint package to be updated.

Publish the Upgrade Control Package

Publish the upgradectrl package to a local file-based repository. This repository is for developing and testing this new package. If you create a repository for general use, you should include additional steps such as creating a separate file system for the repository. For information about creating package repositories for general use, see Copying and Creating Package Repositories in Oracle Solaris 11.3.

Create a package development repository on your system. See the pkgrepo(1) man page for more information about the pkgrepo command.

$ pkgrepo create myrepo

Set the default publisher for this repository. The default publisher is the value of the publisher/prefix property of the repository.

$ pkgrepo -s myrepo set publisher/prefix=site

Publish the upgradectrl package to the development repository.

$ pkgsend -s myrepo publish upgradectrl.p5m
pkg://site/upgradectrl@1.0,5.11:20131104T072336Z
PUBLISHED

Notice that the repository default publisher has been applied to the package FMRI.

Examine the repository to confirm that the package was published.

$ pkgrepo -s myrepo list
PUBLISHER NAME                    O VERSION
site      upgradectrl               1.0,5.11:20131104T072336Z
$ pkg list -vg myrepo
FMRI                                                   IFO
pkg://site/upgradectrl@1.0,5.11:20131104T072336Z       ---

A value in the O column indicates whether the package is obsolete (o) or renamed (r).

Deliver the package to a local repository in a separate ZFS file system in a shared location.

$ pkgrecv -s myrepo -d /var/share/pkgrepos/solaris upgradectrl
Processing packages for publisher site ...
Retrieving and evaluating 1 package(s) ...
PROCESS      ITEMS    GET (MB)    SEND (MB)
Completed      1/1     0.0/0.0      0.0/0.0

Verify the package in the repository and the version of pkg:/entire that it incorporates.

$ pkg info -g /var/share/pkgrepos/solaris upgradectrl
          Name: upgradectrl
       Summary: Package to constrain the version of the OS
   Description: This package controls the version of pkg://solaris/entire that
                can be installed.
      Category: Meta Packages/Incorporations
         State: Not installed
     Publisher: site
       Version: 1.0
 Build Release: 5.11
        Branch: None
Packaging Date: November 20, 2013 01:01:05 AM 
          Size: 0.00 B
          FMRI: pkg://site/upgradectrl@1.0,5.11:20131120T010105Z
$ pkg contents -Hro fmri -t depend -a type=incorporate upgradectrl
pkg://solaris/entire@0.5.11,5.11-0.175.1.0

See Creating and Publishing a Package in Packaging and Delivering Software With the Image Packaging System in Oracle Solaris 11.3 for more detailed information about creating and delivering IPS packages.

Set the Publisher Origin

Set the origin for the site publisher. The system repository is automatically updated with this information so that non-global zones can access packages from the site publisher.

$ pkg set-publisher -g /var/share/pkgrepos/solaris site
$ pkg publisher
PUBLISHER              TYPE     STATUS P LOCATION
solaris                origin   online F https://pkg.oracle.com/solaris/support/
site                   origin   online F file:///var/share/pkgrepos/solaris/

Install the Upgrade Control Package

Install the package. In this case, few changes should be made because the installed version of pkg:/entire is the same as the version incorporated by the upgrade control package. Notice that the package is also installed in the non-global zone.

$ pkg list -v entire
FMRI                                                                         IFO
pkg://solaris/entire@0.5.11,5.11-0.175.1.0.0.24.2:20120919T190135Z           i--
$ zoneadm list
global
z1
$ pkg install upgradectrl
           Packages to install:  1
       Create boot environment: No
Create backup boot environment: No

Planning linked: 0/1 done; 1 working: zone:z1
Planning linked: 1/1 done
Downloading linked: 0/1 done; 1 working: zone:z1
Downloading linked: 1/1 done
PHASE                                          ITEMS
Installing new actions                           9/9
Updating package state database                 Done 
Updating image state                            Done 
Creating fast lookup database                   Done 
Reading search index                            Done 
Updating search index                            1/1 
Executing linked: 0/1 done; 1 working: zone:z1
Executing linked: 1/1 done

The following commands show that versions of pkg:/entire that are newer than the installed version are available from the configured solaris publisher, but an attempt to upgrade is controlled by the newly installed upgrade control package.

$ pkg list -af entire
NAME (PUBLISHER)                                  VERSION                    IFO
entire                                            0.5.11-0.175.1.13.0.6.0    ---
entire                                            0.5.11-0.175.1.12.0.5.0    ---
entire                                            0.5.11-0.175.1.11.0.4.0    ---
entire                                            0.5.11-0.175.1.10.0.6.0    ---
entire                                            0.5.11-0.175.1.10.0.5.0    ---
...
$ pkg update
pkg update: No solution was found to satisfy constraints
Plan Creation: Package solver has not found a solution to update to latest available versions.
This may indicate an overly constrained set of packages are installed.
latest incorporations:
...
Try specifying expected results to obtain more detailed error messages.
$ pkg update -nv entire@0.5.11-0.175.1.13.0.6.0
pkg update: No matching version of entire can be installed:
  Reject:  pkg://solaris/entire@0.5.11,5.11-0.175.1.13.0.6.0:20131108T211557Z
  Reason:  This version is excluded by installed incorporation pkg://site/upgradectrl@1.0,5.11:20131120T010105Z

Update the Upgrade Control Package

When you are ready to allow users to update their systems to a new version, update the upgradectrl.p5m manifest, and republish and redeliver the new update control package. In the following manifest, the version of the update control package and the version of the pkg:/entire constraint package are updated. As an aid for users, the version of the upgrade control package, 1.10, is set to match the updated version of the entire package, 0.175.1.10.

set name=pkg.fmri value=upgradectrl@1.10
set name=pkg.summary value="Package to constrain the version of the OS"
set name=pkg.description value="This package controls the version of \
pkg://solaris/entire that can be installed."
set name=info.classification value="org.opensolaris.category.2008:Meta Packages/Incorporations"
set name=pkg.depend.install-hold value=core-os
set name=variant.opensolaris.zone value=global value=nonglobal
set name=variant.arch value=sparc value=i386
depend fmri=feature/package/dependency/self type=parent variant.opensolaris.zone=nonglobal
depend fmri=pkg://solaris/entire type=require
depend fmri=pkg://solaris/entire@0.5.11,5.11-0.175.1.10 type=incorporate

The following commands republish and redeliver the update control package:

$ pkgsend -s myrepo publish upgradectrl.p5m
pkg://site/upgradectrl@1.10,5.11:20131120T021902Z
PUBLISHED
$ pkgrepo -s myrepo list
PUBLISHER NAME                                      O VERSION
site      upgradectrl                                 1.10,5.11:20131120T021902Z
site      upgradectrl                                 1.0,5.11:20131120T010105Z
$ pkgrecv -s myrepo -d /var/share/pkgrepos/solaris upgradectrl
Processing packages for publisher site ...
Retrieving and evaluating 1 package(s)...
PROCESS                                         ITEMS    GET (MB)   SEND (MB)
Completed                                         1/1     0.0/0.0     0.0/0.0
$ pkg refresh site
$ pkg list -af pkg://site/upgradectrl
NAME (PUBLISHER)                                  VERSION                    IFO
upgradectrl (site)                                1.10                       ---
upgradectrl (site)                                1.0                        i--

Upgrade the Image

The following pkg update command updates all packages to the newest available versions allowed because no packages are specified. The command updates to the newest available version of the upgrade control package, which upgrades the image because the pkg.depend.install-hold setting in the upgradectrl package causes the pkg:/entire package to be updated when the upgradectrl package is updated. The image is upgraded to the version of the pkg:/entire constraint package that is specified in the new upgradectrl constraint package.

$ pkg update --be-name s11u1_10
            Packages to remove:   1
            Packages to update: 186
           Mediators to change:   1
       Create boot environment: Yes
Create backup boot environment:  No

Planning linked: 0/1 done; 1 working: zone:z1
Linked image 'zone:z1' output:
|  Packages to remove:  1
| Packages to install:  3
|  Packages to update: 73
| Mediators to change:  1
|  Services to change:  3
`
Planning linked: 1/1 done
DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
Completed                            187/187   16139/16139  507.9/507.9  562k/s

Downloading linked: 0/1 done; 1 working: zone:z1
Downloading linked: 1/1 done
PHASE                                          ITEMS
Removing old actions                       1473/1473
Installing new actions                     3451/3451
Updating modified actions                16378/16378
Updating package state database                 Done 
Updating package cache                       187/187 
Updating image state                            Done 
Creating fast lookup database                   Done 
Reading search index                            Done 
Building new search index                    851/851 
Executing linked: 0/1 done; 1 working: zone:z1
Executing linked: 1/1 done

A clone of s11u1_0 exists and has been updated and activated.
On the next boot the Boot Environment s11u1_10 will be
mounted on '/'.  Reboot when ready to switch to this updated BE.

Verify that the current BE is not changed and the new BE contains the updated packages.

$ pkg list entire upgradectrl
NAME (PUBLISHER)                                  VERSION                    IFO
entire                                            0.5.11-0.175.1.0.0.24.2    i--
upgradectrl (site)                                1.0                        i--
$ beadm mount s11u1_10 /mnt
$ pkg -R /mnt list entire upgradectrl
NAME (PUBLISHER)                                  VERSION                    IFO
entire                                            0.5.11-0.175.1.10.0.6.0    i--
upgradectrl (site)                                1.10                       i--
$ beadm unmount s11u1_10