如果当前目录下有110668-04目录,patchadd将安装此补丁。补丁安装后,系统会备份原文件,以便在以后删除此补丁。如果使用patchadd -d 选项安装补丁,系统将不备份源文件,这意味着你将不能在以后删除此补丁。使用patchadd -p 选项可以检验已安装的patch,例如:
# patchadd -p
Patch: 106793-01 Obsoletes: Requires: Incompatibles:
Packages: SUNWhea
. . .
同样,solaris提供了另一命令来查看已安装的patch:
# showrev -p
Patch: 106793-01 Obsoletes: Requires: Incompatibles:
Packages: SUNWhea
. . .
patchrm 如果因为某种情况你想卸载某一补丁,你可以使用patchrm命令来完成。此命令通过调用 pkgadd来恢复安装补丁前的文件备份来卸载补丁。使用Patch-ID作为patchrm的参数就可以卸载补丁:
# patchrm 106793-01
Checking installed packages and patches...
Backing out patch 106793-01...
Patch 106793-01 has been backed out.
这里需要说明一下,在如下三种情况下,补丁将不能卸载:
1).在安装patch时,用patchadd -d命令指定patchadd不备份被更新的文件。这样安装的patch无法删除。
2).另一patch需要此patch,即存在dependence(关联性), 如一定要删掉该patch,先删掉另一patch。
3).要删的patch已被另一更新的patch废弃了。如安装110668-04补丁后,如果以前安装过110668-03,则110668-03将被110668-04废弃,110668-03将无法删除。
3.3 Cluster补丁的安装
Cluster补丁为单个补丁的集合,下载解压后,可以通过执行./install_Cluster脚本来完成补丁集的安装。执行./install_Cluster后,脚本将检查当前目录下的patch_order文件,此文件标明了Patch的安装顺序,./install_Cluster将按照patch_order文件给出的顺序来安装patch。如果没有patch_order文件,则假定当前目录下所有以1开始的目录名均为需要安装的补丁目录,并且假定这些目录的名称次序作为安装Patch的次序。因此你可以通过修改patch_order文件来决定安装或不安装某Patch。
3.4 安装Patch时的注意事项
由于在安装Patch时需要更新文件,故此Solaris官方推荐在安装补丁时进入单用户模式安装。在某些重要服务器上可能带来不便,因此你完全可以在多用户模式下通过停止相关服务进程来完成Patch的安装。
Sun推出的Patch并不是每个都一定要安装的,因此需要在安装patch前仔细阅读README来确定是否需要安装此补丁。另外,某些补丁具有依赖性,需要先安装另一补丁才能完成此补丁的安装,这些都会在README中标明。总之,安装补丁之前强烈建议你阅读相应的README(每个Patch都提供单独的README文件)。
3.5 安装PATCH过程中出现的问题
在安装补丁的过程中,经常出现一些错误提示。例如:
Installation of 123456-11 failed. Return code 2
通过Return code我们可以知道错误类型。需要注意的是,Return code 2说明此补丁已被安装,Return code 8说明此补丁要修复的软件没有被系统安装。因此,2和8是完全可以被忽略的错误提示。下表说明了各个Return code对应的错误类型。
Exit code Meaning
0 No error
1 Usage error
2 Attempt to apply a patch that's already been applied
3 Effective UID is not root
4 Attempt to save original files failed
5 pkgadd failed
6 Patch is obsoleted
7 Invalid package directory
8 Attempting to patch a package that is not installed
9 Cannot access /usr/sbin/pkgadd (client problem)
10 Package validation errors
11 Error adding patch to root template
12 Patch script terminated due to signal
13 Symbolic link included in patch
14 NOT USED
15 The prepatch script had a return code other than 0.
16 The postpatch script had a return code other than 0.
17 Mismatch of the -d option between a previous patch install and the current one.
18 Not enough space in the file systems that are targets of the patch.
19 $SOFTINFO/INST_RELEASE file not found
20 A direct instance patch was required but not found
21 The required patches have not been installed on the manager
22 A progressive instance patch was required but not found ;
23 A restricted patch is already applied to the package
24 An incompatible patch is applied
25 A required patch is not applied
26 The user specified backout data can't be found
27 The relative directory supplied can't be found
28 A pkginfo file is corrupt or missing
29 Bad patch ID format
30 Dryrun failure(s)
31 Path given for -C option is invalid
32 Must be running Solaris 2.6 or greater
33 Bad formatted patch file or patch file not found
34 The appropriate kernel jumbo patch needs to be installed
35 Later revision already installed
Reference:
1.Solaris™8 Operating Environment System Administration I, (SA-238)
2.System Administration Guide, Volume 1, (805-7228),Solaris
3.SunSolve Patch Support Portal http://sunsolve.sun.com/pub-cgi/show.pl?target=patchpage#