Home > Articles

  • Print
  • + Share This
This chapter is from the book

Patch Administration

A patch is a collection of files intended to update or fix problems with installed software. For example, a patch might be required to fix a problem with a system command or address a security issue. Because most system and application software are installed as packages, patches are applied against one or more packages. Actually, patches are special packages used to update other packages. Like packages, a collection of patches can be grouped together into a patch cluster.

The ability to obtain and install patches, keep track of installed patches, and occasionally remove patches are key skills of a competent system administrator.

Obtaining Patches and Patch Information

You can obtain patches from Sun Microsystems in several ways. The two most common methods are purchasing a service contract from Sun or downloading the patches yourself from Sun's Web or FTP site.

Sun Service customers have access to an online patch database and an extended set of patches. The patches can be downloaded from Sun's Web site or FTP site. In addition, Sun Service customers receive a CD-ROM of patches every six to eight weeks.

Everyone else can obtain recommended and security patches for supported systems on the Web at http://sunsolve.sun.com or through anonymous FTP from ftp://sunsolve1.sun.com/pubs/patches. Another site for Solaris patches is http://www.ibiblio.org/pub/sun-info/sun-patches.

TIP

Sun offers a bimonthly report that summarizes recommended and security patches for each supported system. Like the patches, the information is available at http://sunsolve.sun.com along with other system support information.

Patches are identified with an eight-digit number. The first six digits identify the base patch, and the last two digits identify the revision. For example, patch number 110906-01 is the update for the x86 version of the Solaris 8 find(1) command.

Installing a Patch

You install patches by using the patchadd command. The appropriate type of system configuration must be specified by using a patchadd command-line argument. You might also need to specify a target directory. In addition, you can use a single patchadd command to install more than one patch.

Regardless of the type of system configuration being patched, the patchadd command is typically executed locally on the system where the software being patched resides (the target directory). However, you can install patches remotely over the network if the target directory can be accessed through Network File System (NFS) services.

If the patch is on a CD-ROM, you can install it directly from the CD-ROM. A patch downloaded from the Sun Web or FTP site must reside on a system hard disk. The area where patches are stored before they are installed is referred to as the spool directory.

TIP

Although patches have no required spool directory, the most commonly used location is the /var/spool/patch directory. However, you can use any location on the system that has adequate free space.

If a patch was obtained via download, chances are good that it is zipped (compressed) to make it easier and quicker to download. Some patches (mainly for SPARC platforms) are compressed with the gzip(1) command and have filenames ending with the .gz suffix. Others are compressed with the zip(1) command and have filenames ending with the .zip suffix. The zip command is used for both SPARC and Intel x86 platforms. To uncompress or unzip the x86 find patch (110906-01), which is located in the current directory, use the unzip(1) command as shown in the following example:

# unzip 110906-01.zip
Archive: 110906-01.zip
  creating: 110906-01/
 inflating: 110906-01/.diPatch 
  creating: 110906-01/SUNWcsu/
 inflating: 110906-01/SUNWcsu/pkgmap 
 inflating: 110906-01/SUNWcsu/pkginfo 
  creating: 110906-01/SUNWcsu/install/
 inflating: 110906-01/SUNWcsu/install/checkinstall 
 inflating: 110906-01/SUNWcsu/install/copyright 
 inflating: 110906-01/SUNWcsu/install/i.none 
 inflating: 110906-01/SUNWcsu/install/patch_checkinstall 
 inflating: 110906-01/SUNWcsu/install/patch_postinstall 
 inflating: 110906-01/SUNWcsu/install/postinstall 
 inflating: 110906-01/SUNWcsu/install/preinstall 
  creating: 110906-01/SUNWcsu/reloc/
  creating: 110906-01/SUNWcsu/reloc/usr/
  creating: 110906-01/SUNWcsu/reloc/usr/bin/
 inflating: 110906-01/SUNWcsu/reloc/usr/bin/find 
 inflating: 110906-01/README.110906-01 
# 

A subdirectory with the same name as the patch will be created under the current directory, and the unzipped files will be placed in this subdirectory.

You then use the patchadd command to install the patch. Because patches have no default spool directory, you must specify the full pathname to the patch as a command-line argument. The following example shows the installation of the x86 find command patch on a standalone system:

# patchadd 110906-01

Checking installed patches...
Verifying sufficient filesystem capacity (dry run method)...
Installing patch packages...

Patch number 110906-01 has been successfully installed.
See /var/sadm/patch/110906-01/log for details

Patch packages installed:
 SUNWcsu

# 

Note that the patch modified the SUNWcsu package (core Solaris software). The patchadd command is actually a ksh script that calls the pkgadd command to install the patch.

To apply a patch to the bootable root image of a diskless client or AutoClient, use the -R command-line argument and specify the path to the client's root image. For example, applying the Solaris 8 x86 find command patch to a diskless client that uses a root image stored under the /export/root/client directory on the current system requires the following command:

patchadd -R /export/root/client /var/spool/patch/110906-01

To apply a patch to an operating system (OS) service, use the -S command-line argument and specify the service. (See Chapter 13, "The Solaris Network Environment," for information about OS servers.) For example, applying the Solaris 8 find command patch to an x86 Solaris 8 OS service named Solaris_8x86 on the OS server requires the following command:

patchadd -S Solaris_8x86 /var/spool/patch/110906-01

To apply a patch to the mini root of a net install image (the image used to install a system over the network), use the -C command-line argument and specify the pathname to the net install image. For example, applying the Solaris 8 find command patch to an x86 Solaris 8 image on the Solaris_8x86 net install server requires the following command:

patchadd -C /export/Solaris_8x86/Tools/Boot 
/var/spool/patch/110906-01

Multiple patches can be installed by using the patchadd command with the -M command-line argument and by specifying a directory where all the patches are located and a list of the patch numbers. For example, to install patches 108529-05, 108653-23, and 108876-07, which are all located in the /var/spool/patch directory, you can use the following command:

patchadd -M /var/spool/patch 108529-05 108653-23 108876-07

Instead of listing several patches on the command line, you can create a text file containing a list of patches. Then specify the name of the text file on the command line in place of all the individual patch names.

For example, to install the 108529-05, 108653-23, and 108876-07 patches located in the /var/spool/patch directory, create a text file with the name /var/spool/patch/patchlist that contains the name of the three patches (separated by spaces or returns). Then use the following command to install the patches:

patchadd -M /var/spool/patch /var/spool/patch/patchlist

The -M command-line argument can be used to install multiple patches for client, services, or install servers by specifying the previously described -R, -S, or -C command-line argument. This argument should be specified after the -M patch spool directory and patch names or patch list command-line arguments. See the previous examples of the patchadd command for use of these arguments.

By default, any files that will be changed as a result of the patch's installation are copied to one or more backup directories. If necessary, you can then remove the patch and return the system to its state before the patch was installed. However, if you specify the -d command-line argument on the patchadd command, the files are not backed up, and the patch cannot be removed.

The default backup directories, located under /var/sadm/pkg, are based on the installed package or packages being modified by the patch and the patch number. For example, the x86 find command patch (110906-01) modified the SUNWcsu package. Any files changed by installing this patch will be saved under the /var/sadm/pkg/SUNWcsu/110906-01 directory. You can specify a different backup directory by using the -B command-line argument.

The patchadd command will fail if any of the following occur:

  • A package being patched is not installed or is only partially installed.

  • The patch requires another patch that is not installed.

  • The patch is incompatible with another patch already installed.

  • The current version or a higher version of the patch is already installed.

  • The architecture of the patch and the system do not match.

TIP

After you unzip a patch, you can delete the zip file to save space. Likewise, after you install a patch, you can delete the files associated with the patch in the patch spool directory to save space.

Determining Which Patches Are Installed

Two commands can be used to generate a list of installed patches for a standalone system:

  • showrev -p

  • patchadd -p

Both commands generate almost identical lists. The following example illustrates the use of the showrev(1M) command (the output is formatted for readability):

$ showrev -p
Patch: 110906-01
Obsoletes:
Requires:
Incompatibles:
Packages: SUNWcsu
Patch: 108632-06
Obsoletes:
Requires: 109000-01, 109038-01, 109067-02, 108994-01, 108969-01
Incompatibles:
Packages: SUNWcsr, SUNWnisr, SUNWncar
$

When a patch is installed, information about the patch is added to the pkginfo file of each package the patch updates. The pkginfo files are located in subdirectories under the /var/sadm/pkg directory. The showrev and patchadd commands extract and format information from the pkginfo files. In addition to the patch number and packages the patch updates, the commands list any dependency information, such as other required patches or incompatible patches.

You can use the patchadd command to display a list of installed patches for other system configurations by using the -C, -R, and -S command-line arguments, as previously described. For example, to display the patches applied to an OS service named Solaris8x86, you can use the following patchadd command:

patchadd -S solaris8x86 -p

To display a list of patches applied to a particular package, use the pkgparam command. The following example lists the patches applied to the SUNWcsu package:

$ pkgparam SUNWcsu PATCHLIST
108529-01 108826-01 108900-01 108980-04 108986-01 108990-02 
109010-01 109020-01 109028-01 109044-02 109046-02 109092-01 
109138-01 109146-01 109148-01 109150-01 109278-01 108965-02 
108976-02 109004-01 109006-01 109008-01 109012-01 109016-01 
109018-01 109022-01 109024-01 109032-01
109034-01 109036-01 
110906-01
$

Removing a Patch

The patchrm command is used to remove or back out a patch by specifying the patch number as a command-line argument. This command also supports the system configurations that the patchadd command supports. You use the same -C, -R, and -S command-line arguments, as previously described. For example, to remove patch 110906-01 from the bootable root image of a diskless client named client5, you can use the following patchrm command:

patchrm -R /export/root/client5 110906-01

Because the default backup directory could have been changed during installation by using the -B command-line argument to the patchadd command, the patchrm command also supports the -B argument. In addition, you can force the patchrm command to remove a patch that has been superseded by another patch by using the -f command-line argument.

You can remove installed patches and return the system to the state it was in before the patch was installed as long as the following conditions are met:

  • The patch is not required by another patch or has been made obsolete by a later patch.

  • The patch was not installed by using patchadd -d, which instructs patchadd not to save a copy of files before they are updated or replaced.

  • + Share This
  • 🔖 Save To Your Account