Determining What's Installed

There are various ways to determine which patches are installed on the system, using either the patchadd or showrev commands. Both these will produce output similar to that shown below:

hydrogen# patchadd -p
Patch: 105416-01 Obsoletes: Requires: Incompatibles: Packages: SUNWaccu
Patch: 105800-01 Obsoletes: Requires: Incompatibles: Packages: SUNWadmap
Patch: 105421-01 Obsoletes: Requires: Incompatibles: Packages: SUNWapppr
Patch: 105621-02 Obsoletes: Requires: Incompatibles: Packages: SUNWarc, SUNWcsu
Patch: 105405-01 Obsoletes: Requires: Incompatibles: Packages: SUNWarc, SUNWcsu
Patch: 105210-01 Obsoletes: Requires: Incompatibles: Packages: SUNWarc, SUNWcsu
Patch: 105472-01 Obsoletes: Requires: Incompatibles: Packages: SUNWatfsu
Patch: 105377-03 Obsoletes: Requires: Incompatibles: Packages: SUNWbcp
<lines removed for clarity>
hydrogen#

This displays a list of the patches installed, along with any patches that they make obsolete, any they require to work correctly, any they are incompatible with, and the packages that are affected by the patch.

Detecting Patches

We've already mentioned that each package installs into its own subdirectory within /var/sadm/pkg. This package location also includes files containing information about the package.

For example, for the Core Solaris (Root) package, the package name is SUNWcsr, so the package information will be found in the package information file for it, named /var/sadm/pkg/SUNWcsr/pkginfo, which should be something similar to that shown below:

hydrogen# cat /var/sadm/pkg/SUNWcsr/pkginfo
CLASSES=none
BASEDIR=/
TZ=GB
PATH=/sbin:/usr/sbin:/usr/bin:/usr/sadm/install/bin
OAMBASE=/usr/sadm/sysadm
PKG=SUNWcsr
NAME=Core Solaris, (Root)
ARCH=sparc
VERSION=11.6.0,REV=1997.07.15.21.46
PRODNAME=SunOS
PRODVERS=5.6/Generic
SUNW_PKGTYPE=root
SUNW_OBSOLETES=
MAXINST=1000
CATEGORY=system
DESC=core software for a specific instruction-set architecture
VENDOR=Sun Microsystems, Inc.
HOTLINE=Please contact your local service provider
EMAIL=
SUNW_REQUIRES=
SUNW_INCOMPAT=
SUNW_PATCHID=105181-03
PSTAMP=on297-patchm06153920
PKGINST=SUNWcsr
PKGSAV=/var/sadm/pkg/SUNWcsr/save
PATCHLIST=105181-03 105847-01 105845-01 105836-01 105797-01
PATCH_INFO_105181-03=Installed: Tue Feb  3 17:03:47 PST 1998 From: fern
    Obsoletes:  Requires: Incompatibles:
PATCH_INFO_105847-01=Installed: Tue Feb  3 17:06:46 PST 1998 From: fern
    Obsoletes:  Requires: Incompatibles:
PATCH_INFO_105845-01=Installed: Tue Feb  3 17:07:55 PST 1998 From: fern
    Obsoletes:  Requires: Incompatibles:
PATCH_INFO_105836-01=Installed: Tue Feb  3 17:09:43 PST 1998 From: fern
    Obsoletes:  Requires: Incompatibles:
PATCH_INFO_105797-01=Installed: Tue Feb  3 17:11:52 PST 1998 From: fern
    Obsoletes:  Requires: Incompatibles:
INSTDATE=Oct 07 1999 15:21
UPDATE=yes
PATCH_PROGRESSIVE=false
PATCH_UNCONDITIONAL=false
PATCH_NO_UNDO=true
PATCH_BUILD_DIR=none
PATCH_UNDO_ARCHIVE=none
INTERRUPTION=no
hydrogen#

To determine the patches installed, this file is parsed by the patchadd command. It pulls out all the patch-related information contained in the PATCH_INFO fields.

In fact, if we search for this field we'll see that the information we get is very similar to the output produced by patchadd:

hydrogen# grep PATCH_INFO /var/sadm/pkg/SUNWcsr/pkginfo
PATCH_INFO_105181-03=Installed: Tue Feb  3 17:03:47 PST 1998 From: fern
    Obsoletes:  Requires: Incompatibles:
PATCH_INFO_105847-01=Installed: Tue Feb  3 17:06:46 PST 1998 From: fern
    Obsoletes:  Requires: Incompatibles:
PATCH_INFO_105845-01=Installed: Tue Feb  3 17:07:55 PST 1998 From: fern
    Obsoletes:  Requires: Incompatibles:
PATCH_INFO_105836-01=Installed: Tue Feb  3 17:09:43 PST 1998 From: fern
    Obsoletes:  Requires: Incompatibles:
PATCH_INFO_105797-01=Installed: Tue Feb  3 17:11:52 PST 1998 From: fern
    Obsoletes:  Requires: Incompatibles:
hydrogen#

Pkgparam

We can also use a command named pkgparam to detect which packages will be affected by the patch installation. This again uses the pkginfo file to locate its information. We can see that every line in the pkginfo file consists of a variable and a value that is assigned to that variable. For example, the following line assigns the list of patch IDs to a variable named PATCHLIST:

PATCHLIST=105181-03 105847-01 105845-01 105836-01 105797-01

We could determine which patches affect the SUNWcsr package by using pkgparam to query the package as shown below:

hydrogen# pkgparam SUNWcsr PATCHLIST
105181-03 105847-01 105845-01 105836-01 105797-01
hydrogen#

Similarly, to display the full information about a particular patch, run the following on the patch ID:

hydrogen# pkgparam SUNWcsr PATCH_INFO_105181-03
Installed: Oct 22 17:00:01 GMT 1999 From: fern Obseletes:
   Requires: Incompatibles:
hydrogen#

We can see from the above examples that the pkginfo file is important for patches as well as packages. If this file should become corrupt or is removed, it will be very difficult to determine which patches are installed on the system. It will also become impossible for programs such as patchadd and patchrm to administer the system (since they cannot detect which patches have been installed) or update the system by adding or removing any patches.

PatchDB

Whenever patchadd -p runs, it will first check to see if a file named /var/sadm/patch/.patchDB exists and is up to date. To check this, a command (similar to the following one) first runs to calculate the checksum of all the pkginfo files on the system:

nawk '/PATCHID/ {print} /PATCHLIST/ {print}' /var/sadm/pkg/*/
   pkginfo | sum

Once this has been obtained, it is compared to the checksum value stored in the .patchDB file. If the two agree, the .patchDB file is assumed to be correct and its contents are read and displayed.

This file contains the list of patches installed on the system, formatted exactly as patchadd displays. It is used because determining the installed patches can be quite time-consuming, and it allows the utilities to display the list of patches as fast as possible. If, for any reason, .patchDB is removed, becomes corrupt, or produces checksum mismatches, it will simply be recreated the next time patchadd or patchrm is run.

The following extract from a .patchDB file shows the checksum information, which in this case is 35957:

hydrogen# more /var/sadm/patch/.patchDB
Version 1.0 35957
Patch: 105416-01 Obsoletes: Requires: Incompatibles: Packages: SUNWaccu
Patch: 105800-01 Obsoletes: Requires: Incompatibles: Packages: SUNWadmap
<lines removed for clarity>
hydrogen#

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset