How to Update Only Java on Your Oracle Solaris 11 System

by Peter Dennis and Alta Elstad

This article describes how to update Java without updating any other software. Java might be updated multiple times in an Oracle Solaris release, so you should follow this procedure periodically.


Published May 2013


Java is part of the Oracle Solaris 11 system software. Usually, best practice is to update system software together, as a tested-together supported set. Oracle Solaris 11 keeps specific sets of software together by using special packages called incorporations, which specify versions of packages that can be installed. Packages named in an incorporation might themselves be incorporations or might require a particular version of another package to be installed. So the set of packages affected by an incorporation—or constrained by the incorporation—can be much larger than the set named in the incorporation package.

Want to comment on this article? Post the link on Facebook's OTN Garage page.  Have a similar article to share? Bring it up on Facebook or Twitter and let's discuss.

If you try to install a different version of a package whose version is constrained by an incorporation, you will receive an error message and the update or install operation will fail. In general, the supported way to update a package whose version is constrained by an incorporation is to update the incorporation package.

Sometimes you need to install software that is constrained by an incorporation at a different version than the incorporation allows. For example, you might need to install a security update. This article describes how to update one piece of software that is constrained by an incorporation without altering any other software that is constrained by that incorporation, and still end up with a supported system. The software updated in this example is Java.

For more information about incorporations, see “Structure of Oracle Solaris 11 Software” in the article “More Tips for Updating Your Oracle Solaris 11 System from the Oracle Support Repository.”

How to Update Java Software in Oracle Solaris 11.1

Oracle Solaris 11.1 installs Java SE 7 packages that are version-constrained by the java-incorporation package. You cannot update this package simply by updating the java-incorporation package, because this package is in turn constrained by the pkg:/entire incorporation package.

To update Java without updating the pkg:/entire package, unlock the version-lock facet of the Java incorporation package and then update the Java incorporation package, as described in the following procedure, which describes how to update the global zone.

For more information about version-lock facets, see “Relaxing Version Constraints Specified by Incorporations” in Chapter 5, “Configuring Installed Images” of Adding and Updating Oracle Solaris 11.1 Software Packages.

  1. Check whether an updated package is available:

    Make sure an update is available for the java-incorporation package.

    # pkg list -af java-incorporation
    NAME (PUBLISHER)                                  VERSION                    IFO
    consolidation/java/java-incorporation             0.5.11-0.175.1.7.0.4.0     ---
    consolidation/java/java-incorporation             0.5.11-0.175.1.0.0.24.0    i--
    

    If the version of these packages that is currently installed in the image (“i” in the “I” column) is the most current version available, you have nothing to update and you can stop here.

    If you believe newer versions should be available, check your solaris publisher origin. If your solaris publisher origin is a local location, make sure that local repository is current with the latest updated packages. If you change your publisher origin or update your local package repository, refresh the publisher or refresh or rebuild the repository.

  2. Unlock the version-lock facet:

    Change the value of the version-lock facet of the java-incorporation package to false, as shown in Listing 1. The number of packages to update is the number of packages installed in this image, because each package in the image is checked for this facet.

    # pkg change-facet \
    facet.version-lock.consolidation/java/java-incorporation=false
                Packages to update: 851
         Variants/Facets to change:   1
           Create boot environment:  No
    Create backup boot environment: Yes
    
    Planning linked: 1/1 done
    PHASE                                          ITEMS
    Removing old actions                             1/1
    Updating image state                            Done 
    Creating fast lookup database                   Done 
    Reading search index                            Done 
    Building new search index                    851/851
    

    Listing 1

    Use the pkg facet command to confirm the changed value of the facet.

    # pkg facet
    FACETS                                                   VALUE
    facet.version-lock.consolidation/java/java-incorporation False
    
  3. Update the package:

    Update the java-incorporation package. As a best practice, do the update first with the -nv options, as shown in Listing 2, to see what will be updated.

    # pkg update -nv java-incorporation
    
                Packages to update:         2
         Estimated space available:  77.61 GB
    Estimated space to be consumed: 377.26 MB
           Create boot environment:        No
    Create backup boot environment:       Yes
              Rebuild boot archive:        No
    
    Changed packages:
    solaris
      consolidation/java/java-incorporation
        0.5.11,5.11-0.175.1.0.0.24.0:20120904T175431Z -> 0.5.11,5.11-0.175.1.7.0.4.0:20130429T150946Z
      runtime/java/jre-7
        1.7.0.7,5.11-0.175.1.0.0.24.0:20120904T175502Z -> 1.7.0.21,5.11-0.175.1.7.0.4.0:20130429T151023Z
    Planning linked: 0/1 done; 1 working: zone:z1
    Linked image 'zone:z1' output:
    |      Estimated space available: 77.61 GB
    | Estimated space to be consumed: 28.95 MB
    |           Rebuild boot archive:       No
    `
    Planning linked: 1/1 done
    

    Listing 2

    If you are satisfied, execute the update without the -n option. As a best practice, use the --be-name option, as shown in Listing 3, to make the changes only in a new boot environment (BE) and leave the current boot environment unchanged as a backup.

    # pkg update -v --be-name s11.1javaupdate java-incorporation
    
                Packages to update:         2
         Estimated space available:  77.57 GB
    Estimated space to be consumed: 377.26 MB
           Create boot environment:       Yes
         Activate boot environment:       Yes
    Create backup boot environment:        No
              Rebuild boot archive:        No
    
    Changed packages:
    solaris
      consolidation/java/java-incorporation
        0.5.11,5.11-0.175.1.0.0.24.0:20120904T175431Z -> 0.5.11,5.11-0.175.1.7.0.4.0:20130429T150946Z
      runtime/java/jre-7
        1.7.0.7,5.11-0.175.1.0.0.24.0:20120904T175502Z -> 1.7.0.21,5.11-0.175.1.7.0.4.0:20130429T151023Z
    Planning linked: 0/1 done; 1 working: zone:z1
    Linked image 'zone:z1' output:
    |      Estimated space available: 77.57 GB
    | Estimated space to be consumed: 28.95 MB
    |           Rebuild boot archive:       No
    `
    Planning linked: 1/1 done
    DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
    Completed                                2/2       191/191    62.4/62.4  1.5M/s
    
    Downloading linked: 0/1 done; 1 working: zone:z1
    Downloading linked: 1/1 done
    PHASE                                          ITEMS
    Removing old actions                             7/7
    Installing new actions                           8/8
    Updating modified actions                    190/190
    Updating package state database                 Done 
    Updating package cache                           2/2 
    Updating image state                            Done 
    Creating fast lookup database                   Done 
    Reading search index                            Done 
    Updating search index                            2/2 
    Executing linked: 0/1 done; 1 working: zone:z1
    Executing linked: 1/1 done
    
    A clone of solaris11.1 exists and has been updated and activated.
    On the next boot the Boot Environment s11.1javaupdate will be
    mounted on '/'.  Reboot when ready to switch to this updated BE.
    

    Listing 3

    Confirm that the package has been updated in the new boot environment:

    # pkg list java-incorporation
    NAME (PUBLISHER)                                  VERSION                    IFO
    consolidation/java/java-incorporation             0.5.11-0.175.1.0.0.24.0    i--
    # beadm mount s11.1javaupdate /mnt
    # pkg -R /mnt list java-incorporation
    NAME (PUBLISHER)                                  VERSION                    IFO
    consolidation/java/java-incorporation             0.5.11-0.175.1.7.0.4.0     i--
    # beadm unmount s11.1javaupdate
    

How to Update Non-Global Zones

Changing a facet value in the global zone does not change that facet value in non-global zones. In some cases, installing or updating packages in the global zone affects non-global zones as well. This is not true for Java: You can have different versions of Java installed in the global and non-global zones. If you want updated versions of Java in non-global zones, perform those updates separately, as described below.

If you used the --be-name option during the global zone update, you might want to reboot to the new BE and update the non-global zones there.

In the following example, only the java-incorporation package is updated. Notice that in the global zone example above, the java-incorporation package and the jre-7 package were updated. The non-global in this example does not have the jre-7 package installed. Unlocking and updating the java-incorporation package ensures that if Java 7 is installed in this zone at a later time, it will be installed at the newer version.

  1. Log in to the zone and check the currently installed version of the java-incorporation package:

    # zlogin z1
    [Connected to zone 'z1' pts/4]
    Oracle Corporation	SunOS 5.11	11.1	September 2012
    root@z1:~# pkg list -af java-incorporation
    NAME (PUBLISHER)                                  VERSION                    IFO
    consolidation/java/java-incorporation             0.5.11-0.175.1.7.0.4.0     ---
    consolidation/java/java-incorporation             0.5.11-0.175.1.0.0.24.0    i--
    
  2. Unlock the version-lock facet:

    Change the value of the version-lock facet of the java-incorporation package to false, as shown in Listing 4.

    root@z1# pkg change-facet \
    facet.version-lock.consolidation/java/java-incorporation=false
                Packages to update: 183
         Variants/Facets to change:   1
           Create boot environment:  No
    Create backup boot environment: Yes
    
    PHASE                                          ITEMS
    Removing old actions                             1/1
    Updating image state                            Done 
    Creating fast lookup database                   Done
    

    Listing 4

  3. Update the package:

    Update the java-incorporation package, as shown in Listing 5. You can use the -n or --be-name options in non-global zones, though this example does not show those options. See the global zone example above to see how to use those options.

    root@z1# pkg update java-incorporation
                Packages to update:   1
           Create boot environment:  No
    Create backup boot environment: Yes
    
    DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
    Completed                                1/1           3/3      0.0/0.0  427k/s
    
    PHASE                                          ITEMS
    Removing old actions                             5/5
    Installing new actions                           5/5
    Updating modified actions                        1/1
    Updating package state database                 Done 
    Updating package cache                           1/1 
    Updating image state                            Done 
    Creating fast lookup database                   Done
    

    Listing 5

    Confirm that the package has been updated:

    root@z1# pkg list java-incorporation
    NAME (PUBLISHER)                                  VERSION                    IFO
    consolidation/java/java-incorporation             0.5.11-0.175.1.7.0.4.0     i--
    

See Also

The following resources have more information about unlocking packages:

Here are additional Oracle Solaris 11 resources:

About the Authors

Peter Dennis is a Principal Engineer in the Oracle Solaris Revenue Product Engineering team. He has worked on a wide variety of technologies: file systems, volume management and backup, cluster, and general end-user utilities. He is currently the technical lead for the Oracle Solaris 11 update releases.

Alta Elstad is a technical writer supporting Oracle Solaris 11 packaging.

Revision 1.0, 05/16/2013

Follow us:
Blog | Facebook | Twitter | YouTube